mirror of https://github.com/captn3m0/muse-dl.git
Fixes #6
This commit is contained in:
parent
1a5086b2d7
commit
00c80bf8e4
|
@ -16,6 +16,11 @@ module Muse::Dl
|
|||
"#{tmp_path}/chapter-#{id}.pdf"
|
||||
end
|
||||
|
||||
def self.cleanup(tmp_path : String, id : String)
|
||||
fns = chapter_file_name(id, tmp_path)
|
||||
File.delete(fns) if File.exists?(fns)
|
||||
end
|
||||
|
||||
def self.save_chapter(tmp_path : String, chapter_id : String, chapter_title : String, cookie : String | Nil = nil, add_bookmark = true)
|
||||
final_pdf_file = chapter_file_name chapter_id, tmp_path
|
||||
tmp_pdf_file = "#{final_pdf_file}.tmp"
|
||||
|
|
|
@ -47,6 +47,13 @@ module Muse::Dl
|
|||
|
||||
temp_stitched_file.delete if temp_stitched_file
|
||||
puts "Saved final output to #{parser.output}"
|
||||
|
||||
# Cleanup the chapter files
|
||||
if parser.cleanup
|
||||
thing.chapters.each do |c|
|
||||
Fetch.cleanup(parser.tmp, c[0])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue