I am trying to create directory for my MP3 collection of FLAC Album such a way that it creates Artist- Album Name (format) or Various Artists - Album Name (format)(If different tracks has different artist says track 1,2,3,7,8 Jay Sean and 4,5 Jay Z and 7,9,10, 11 Another artist. The directory should be Various Artists) . I am using mutagen with python3.6.
This is code
for file in files:
tags = mutagen.File(os.path.join(root, file), easy=True)
if tags:
print(tags)
try:
albumartist = tags.get('albumartist')[0]
except TypeError:
albumartist = tags.get('artist')[0]
AlbumName = tags.get('album')[0]
print (albumartist)
if albumartist is not albumartist:#This Is problem I think.
albumartist = 'Various Artist'
else:
albumartist = albumartist
directory = albumartist + " - " + AlbumName + "(MP3 320)"
It print outs all the Artist of album say if album has 10 songs correctly, But when it comes to creating directory it creates the last Artist for loop is running to. I am not able to rectify this issue, if anyone could help me with this.
thank you guys
Aucun commentaire:
Enregistrer un commentaire