mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Change back to functions for consistency
This commit is contained in:
@@ -20,22 +20,19 @@ def compare(file, metadata):
|
|||||||
already_tagged = False
|
already_tagged = False
|
||||||
return already_tagged
|
return already_tagged
|
||||||
|
|
||||||
class embed(object):
|
def embed(music_file, meta_tags, output_ext):
|
||||||
|
|
||||||
def __init__(self, music_file, meta_tags, output_ext):
|
|
||||||
|
|
||||||
if meta_tags is None:
|
if meta_tags is None:
|
||||||
print('Could not find meta-tags')
|
print('Could not find meta-tags')
|
||||||
elif output_ext == '.m4a':
|
elif output_ext == '.m4a':
|
||||||
print('Fixing meta-tags')
|
print('Fixing meta-tags')
|
||||||
self.embed_m4a(music_file, meta_tags, output_ext)
|
embed_m4a(music_file, meta_tags, output_ext)
|
||||||
elif output_ext == '.mp3':
|
elif output_ext == '.mp3':
|
||||||
print('Fixing meta-tags')
|
print('Fixing meta-tags')
|
||||||
self.embed_mp3(music_file, meta_tags, output_ext)
|
embed_mp3(music_file, meta_tags, output_ext)
|
||||||
else:
|
else:
|
||||||
print('Cannot embed meta-tags into given output extension')
|
print('Cannot embed meta-tags into given output extension')
|
||||||
|
|
||||||
def embed_mp3(self, music_file, meta_tags, output_ext):
|
def embed_mp3(music_file, meta_tags, output_ext):
|
||||||
artists = []
|
artists = []
|
||||||
for artist in meta_tags['artists']:
|
for artist in meta_tags['artists']:
|
||||||
artists.append(artist['name'])
|
artists.append(artist['name'])
|
||||||
@@ -67,7 +64,7 @@ class embed(object):
|
|||||||
albumart.close()
|
albumart.close()
|
||||||
audiofile.save(v2_version=3)
|
audiofile.save(v2_version=3)
|
||||||
|
|
||||||
def embed_m4a(self, music_file, meta_tags, output_ext):
|
def embed_m4a(music_file, meta_tags, output_ext):
|
||||||
# eyed serves only mp3 not aac so using mutagen
|
# eyed serves only mp3 not aac so using mutagen
|
||||||
# Apple has specific tags - see mutagen docs -
|
# Apple has specific tags - see mutagen docs -
|
||||||
# http://mutagen.readthedocs.io/en/latest/api/mp4.html
|
# http://mutagen.readthedocs.io/en/latest/api/mp4.html
|
||||||
|
|||||||
Reference in New Issue
Block a user