Compare commits

...

2 commits

Author SHA1 Message Date
0ff526b5ca
fixed a potential endless loop if the image had a lot of metadata 2019-12-16 21:57:55 +10:00
8db04fa526
cleaned up 2019-05-05 04:00:18 +10:00

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
#BCAO - BandCamp Automatic Organiser #BCAO - BandCamp Automatic Organiser
#copyright 2018 lynnear software babyyyyyyyyyyyy #copyright 2018-2019 @LynnearSoftware@fedi.lynnesbian.space
#GPLv3 because why the fuck not #Licensed under the GPLv3: https://www.gnu.org/licenses/gpl-3.0.html#content
#input: a .zip from bandcamp #input: a .zip from bandcamp
#output: it organises it, adds cover art, puts it in the right place... #output: it organises it, adds cover art, puts it in the right place...
@ -105,7 +105,7 @@ if cover == "":
while os.path.getsize(cover) / 1024 > args.threshold: while os.path.getsize(cover) / 1024 > args.threshold:
if os.path.basename(cover) != "cover-lq.jpg": if os.path.basename(cover) != "cover-lq.jpg":
nucover = os.path.dirname(cover) + os.sep + "cover-lq.jpg" nucover = os.path.dirname(cover) + os.sep + "cover-lq.jpg"
subprocess.check_output(["convert", cover, "-quality", "85", nucover]) #convert the file to a jpeg subprocess.check_output(["convert", cover, "-quality", "85", "-strip", nucover]) #convert the file to a jpeg
cover = nucover cover = nucover
else: else:
subprocess.check_output(["convert", cover, "-resize", "90%", cover]) #shrink it slightly subprocess.check_output(["convert", cover, "-resize", "90%", cover]) #shrink it slightly
@ -154,13 +154,14 @@ if choice == "Custom...":
# print("Setting artist to {0}".format(choice)) # print("Setting artist to {0}".format(choice))
artist = choice artist = choice
mPath = "/home/lynne/Music/Music/{0}/{1}".format(artist, album) #todo: don't hardcode this mPath = "/home/lynne/Music/Music/{}/{}".format(artist, album) #todo: don't hardcode this
subprocess.check_output(["mkdir", "-p", mPath]) subprocess.check_output(["mkdir", "-p", mPath])
for root, dirs, filez in os.walk(tmp): for root, dirs, filez in os.walk(tmp):
for file in filez: #for every file for file in filez: #for every file
subprocess.check_output(["mv", root + os.sep + file, mPath + os.sep + file]) subprocess.check_output(["mv", root + os.sep + file, mPath + os.sep + file])
print("Deleting {}...".format(tmp))
subprocess.check_output(["rm", "-rf", tmp]) subprocess.check_output(["rm", "-rf", tmp])
print("Done!") print("Done!")