Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion hypeme.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import json
import string
import os
import eyed3

##############AREA_TO_SCRAPE################
# This is the general area that you'd
Expand Down Expand Up @@ -146,14 +147,21 @@ def download_songs(self, tracks, cookie):
mp3_song_file = open(filename, "wb")
mp3_song_file.write(download_response.read() )
mp3_song_file.close()

edit_metadata(filename, artist, title)
except urllib2.HTTPError, e:
print 'HTTPError = ' + str(e.code) + " trying hypem download url."
except urllib2.URLError, e:
print 'URLError = ' + str(e.reason) + " trying hypem download url."
except Exception, e:
print 'generic exception: ' + str(e)


def edit_metadata(filename, artist, title):
song = eyed3.load(filename)
song.initTag()
song.tag.artist = unicode(artist, "utf-8")
song.tag.title = unicode(title, "utf-8")
song.tag.save()


def main():
Expand Down