Skip to content

Instantly share code, notes, and snippets.

@oct2pus
Created August 23, 2020 00:13
Show Gist options
  • Save oct2pus/dce6190adc97d0818b67b093c2e1266f to your computer and use it in GitHub Desktop.
Save oct2pus/dce6190adc97d0818b67b093c2e1266f to your computer and use it in GitHub Desktop.
script i wrote to figure out what albums left i need to download from bandcamp
# include Array
# include Dir
require 'colorize'
input = ARGV
folders = Array.new
zips = Array.new
flacs = Array.new
Dir.foreach(input[0]) do |x|
if x.include?("-")
folders.push(x)
end
end
Dir.foreach(input[1]) do |y|
if y.end_with?(".zip")
zips.push(y.chomp!(".zip"))
end
if y.end_with?(".flac")
flacs.push(y.chomp!(".flac"))
end
end
puts "#{folders.length-zips.length} file difference"
folders.sort!
zips.sort!
match = Array.new
noMatch = Array.new
folders.each do |x|
foundMatch = false
zips.each do |y|
if x.eql?(y)
foundMatch = true
break
end
#puts "\'#{x}\' != \'#{y}\'"
end
foundMatch ? match.append(x) : noMatch.append(x)
end
match.each do |a|
puts a.colorize(:green)
end
noMatch.each do |b|
puts b.colorize(:red)
end
puts "found these flac files"
flacs.each do |f|
puts f
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment