lib/webradio.rb in rget-4.2.0 vs lib/webradio.rb in rget-4.2.1
- old
+ new
@@ -74,11 +74,11 @@
$stderr.puts e.message
return
end
end
if !@options.mp3 || src == dst
- add_cover(dst)
+ add_cover(src) if src =~ /\.mp3$/
move(src) if @options.path
return
end
# convert to mp3
@@ -144,21 +144,24 @@
end
end
def move(dst)
if @options.path
- print "move to #{@options.path}..."
begin
+ print "move to #{@options.path}..."
if @dropbox
open(dst) do |r|
@dropbox.upload(dropbox_file(dst)) do
print '.'
r.read(10_000_000)
end
end
File.delete(dst)
- elsif @options.path
+ elsif !(Pathname(@options.path).expand_path == Pathname(dst).expand_path.dirname)
FileUtils.mv(dst, @options.path)
+ else
+ puts "skip."
+ return
end
puts "done."
rescue => e
puts "failed."
$stderr.puts e.message