diff --git a/headphones/itunesimport.py b/headphones/itunesimport.py index f36e0dd6..80d018c6 100644 --- a/headphones/itunesimport.py +++ b/headphones/itunesimport.py @@ -99,11 +99,16 @@ def importartist(artistlist): if any(artistid in x for x in artistlist): logger.info(result.artist.name + u" is already in the database, skipping") else: - c.execute('INSERT INTO artists VALUES( ?, ?, ?, CURRENT_DATE, ?)', (artistid, artist.name, artist.sortName, 'Active')) + if artist.name.startswith('The '): + sortname = artist.name[4:] + else: + sortname = artist.name + c.execute('INSERT INTO artists VALUES( ?, ?, ?, CURRENT_DATE, ?)', (artistid, artist.name, sortname, 'Active')) for rg in artist.getReleaseGroups(): rgid = u.extractUuid(rg.id) releaseid = getReleaseGroup(rgid) + time.sleep(1) inc = ws.ReleaseIncludes(artist=True, releaseEvents= True, tracks= True, releaseGroup=True) results = ws.Query().getReleaseById(releaseid, inc) diff --git a/headphones/webserve.py b/headphones/webserve.py index 20c6f76b..19a21ced 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -259,7 +259,11 @@ class WebInterface(object): else: logger.info(u"Adding " + artist.name + " to the database.") - c.execute('INSERT INTO artists VALUES( ?, ?, ?, CURRENT_DATE, ?)', (artistid, artist.name, artist.sortName, 'Active')) + if artist.name.startswith('The '): + sortname = artist.name[4:] + else: + sortname = artist.name + c.execute('INSERT INTO artists VALUES( ?, ?, ?, CURRENT_DATE, ?)', (artistid, artist.name, sortname, 'Active')) for rg in artist.getReleaseGroups(): rgid = u.extractUuid(rg.id)