narou 3.4.7 → 3.4.7.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of narou might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4063cfeb6e0240eba89a4774f479e0f69a9f7c9e5725b903872cc208f7421622
4
- data.tar.gz: 4b395e083e9f49e3b58197766d12da1bb4b3a4e8065a798aba6b588efbd29443
3
+ metadata.gz: 40f1f0d7736259e40738de61af66039fd1344c00bd21fb7e30e2cdec8a9d1f86
4
+ data.tar.gz: 3744f318af16e36ed8018fd948a38f6e03eee6716b4dfc3d8c45e33d56cd0738
5
5
  SHA512:
6
- metadata.gz: 2762a5dae9195fbda42c7f97d99ad88ee10dc57b31d69e071e4f8c59642c670ba9fe93caedcf8673ad54eca43a1617af7eec9a32732b53c1bdd765d8f4f99f45
7
- data.tar.gz: ebb543d574b09a290f685d9eeb02ad764d2aa9fa619acc9c79f7f85806bef929d463ef8a2aaf0ab32450de3234cc54ea21f9b4bc4f6491dd33da79b4c7a117f6
6
+ metadata.gz: 1d1a1e57cc5bf72066079265f6fa2d7b1ebe17f4c822fc8d0338afd6bad661cdc484a5f986e5f6c3702f789c31b19f57d86720140ae06e0e7f5039607e69527a
7
+ data.tar.gz: b3dafdecd49cf9ccebd2812948377e0bedbabf02a084001eeb941e82ac84d41344a66f534646869e891ba64f40ae51b43b8096898a92774d2e22adc88c518580
@@ -22,7 +22,12 @@ module Command
22
22
 
23
23
  Examples:
24
24
  narou restore346
25
+
25
26
  HELP
27
+
28
+ @opt.on('-f') do
29
+ @options["f"] = true
30
+ end
26
31
  end
27
32
 
28
33
  def execute(argv)
@@ -33,7 +38,7 @@ module Command
33
38
  puts "<gray>#{data["title"].escape}</gray>".termcolor
34
39
  downloader = Downloader.new(data["id"])
35
40
  toc = downloader.load_toc_file
36
- modified = restore(toc)
41
+ modified = @options["f"] ? restore_subupdate(toc) : restore(toc)
37
42
  downloader.save_toc_once(toc) if modified
38
43
  rescue StandardError
39
44
  next
@@ -50,6 +55,11 @@ module Command
50
55
  subdate = Regexp.last_match[:subdate]
51
56
  subupdate = Regexp.last_match[:subupdate]
52
57
 
58
+ download_time = subtitle["download_time"]
59
+ if Time.parse(subupdate) > download_time
60
+ subupdate = ''
61
+ end
62
+
53
63
  subtitle["subdate"] = subdate
54
64
  subtitle["subupdate"] = subupdate
55
65
  modified = true
@@ -61,5 +71,27 @@ module Command
61
71
 
62
72
  modified
63
73
  end
74
+
75
+ def restore_subupdate(toc)
76
+ subtitles = toc["subtitles"]
77
+ modified = false
78
+ subtitles.each do |subtitle|
79
+ subupdate = subtitle["subupdate"]
80
+
81
+ next if subupdate.blank?
82
+
83
+ download_time = subtitle["download_time"]
84
+ next if Time.parse(subupdate) <= download_time
85
+
86
+ subtitle["subupdate"] = ''
87
+ modified = true
88
+ end
89
+
90
+ if modified
91
+ puts "<green>#{toc["title"].escape} の目次データを復元しました</green>".termcolor
92
+ end
93
+
94
+ modified
95
+ end
64
96
  end
65
97
  end
@@ -5,5 +5,5 @@
5
5
  #
6
6
 
7
7
  module Narou
8
- VERSION = "3.4.7"
8
+ VERSION = "3.4.7.1"
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: narou
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.7
4
+ version: 3.4.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - whiteleaf7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-06 00:00:00.000000000 Z
11
+ date: 2019-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: termcolorlight