Add lots of comments

This commit is contained in:
Ritiek
2017-06-18 02:57:55 +05:30
parent c270aa8365
commit 80c167e702
3 changed files with 41 additions and 11 deletions

View File

@@ -13,10 +13,12 @@ def compare(file, metadata):
try:
if file.endswith('.mp3'):
audiofile = EasyID3('Music/' + file)
# fetch track title metadata
already_tagged = audiofile['title'][0] == metadata['name']
elif file.endswith('.m4a'):
tag = {'title': '\xa9nam'}
audiofile = MP4('Music/' + file)
# fetch track title metadata
already_tagged = audiofile[tags['title']] == metadata['name']
except KeyError:
already_tagged = False
@@ -35,7 +37,7 @@ def embed(music_file, meta_tags, output_ext):
print('Cannot embed meta-tags into given output extension')
def embed_mp3(music_file, meta_tags, output_ext):
#EasyID3 is fun to use ;)
# EasyID3 is fun to use ;)
audiofile = EasyID3('Music/' + music_file + output_ext)
audiofile['artist'] = meta_tags['artists'][0]['name']
audiofile['albumartist'] = meta_tags['artists'][0]['name']

View File

@@ -58,6 +58,7 @@ def get_arguments():
return parser.parse_args()
# check if input song is spotify link
def is_spotify(raw_song):
if (len(raw_song) == 22 and raw_song.replace(" ", "%20") == raw_song) or (raw_song.find('spotify') > -1):
return True
@@ -91,6 +92,7 @@ def generate_token():
return token
def generate_search_URL(song):
# urllib2.quote() encodes URL with special characters
URL = "https://www.youtube.com/results?sp=EgIQAQ%253D%253D&q=" + quote(song)
return URL
@@ -105,4 +107,4 @@ def grace_quit():
print('')
print('')
print('Exitting..')
exit()
sys.exit()