bilibili_sunday 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bilibili_sunday/downloader.rb +12 -0
- data/lib/bilibili_sunday/version.rb +1 -1
- metadata +1 -1
@@ -33,6 +33,7 @@ module BilibiliSunday
|
|
33
33
|
|
34
34
|
videos.each do |cid|
|
35
35
|
update_status(cid)
|
36
|
+
cleanup(cid)
|
36
37
|
concat(cid) if (cache_completed?(cid) && (!concat_started?(cid)))
|
37
38
|
end
|
38
39
|
end
|
@@ -103,6 +104,17 @@ module BilibiliSunday
|
|
103
104
|
|
104
105
|
private
|
105
106
|
|
107
|
+
def cleanup(cid)
|
108
|
+
if concat_completed?(cid)
|
109
|
+
# Deletes the partial files
|
110
|
+
downloads = load_yaml(downloads_yaml_path(cid))
|
111
|
+
downloads.each do |download|
|
112
|
+
path = download[:path]
|
113
|
+
FileUtils.rm(path) if File.exists?(path)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
106
118
|
def get_all_videos
|
107
119
|
Dir.glob(File.join(video_store_path, '*')).select {|f| File.directory? f}.map { |f| File.basename(f).to_i }
|
108
120
|
end
|