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 +4 -4
- data/lib/command/restore346.rb +33 -1
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40f1f0d7736259e40738de61af66039fd1344c00bd21fb7e30e2cdec8a9d1f86
|
4
|
+
data.tar.gz: 3744f318af16e36ed8018fd948a38f6e03eee6716b4dfc3d8c45e33d56cd0738
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d1a1e57cc5bf72066079265f6fa2d7b1ebe17f4c822fc8d0338afd6bad661cdc484a5f986e5f6c3702f789c31b19f57d86720140ae06e0e7f5039607e69527a
|
7
|
+
data.tar.gz: b3dafdecd49cf9ccebd2812948377e0bedbabf02a084001eeb941e82ac84d41344a66f534646869e891ba64f40ae51b43b8096898a92774d2e22adc88c518580
|
data/lib/command/restore346.rb
CHANGED
@@ -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
|
data/lib/version.rb
CHANGED
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-
|
11
|
+
date: 2019-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: termcolorlight
|