diff --git a/data/interfaces/default/album.html b/data/interfaces/default/album.html index 7dde799d..9f803a75 100644 --- a/data/interfaces/default/album.html +++ b/data/interfaces/default/album.html @@ -1,5 +1,5 @@ <%inherit file="base.html" /> -<%! +<%! from headphones import db, helpers myDB = db.DBConnection() %> @@ -16,7 +16,28 @@ %else: Retry Download Try New Version - %endif + %endif + Choose Alternate Version + « Back to ${album['ArtistName']} @@ -144,6 +165,10 @@ } $(document).ready(function() { + $('#album_chooser').click(function() { + $('#dialog').dialog(); + return false; + }); getAlbumInfo(); getAlbumArt(); initActions(); diff --git a/headphones/__init__.py b/headphones/__init__.py index 02824880..83b48d62 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -853,7 +853,6 @@ def dbcheck(): c.execute('SELECT ReleaseID from albums') except sqlite3.OperationalError: c.execute('ALTER TABLE albums ADD COLUMN ReleaseID TEXT DEFAULT NULL') - c.execute('UPDATE TABLE albums SET ReleaseID = AlbumID') try: c.execute('SELECT ReleaseFormat from albums') diff --git a/headphones/importer.py b/headphones/importer.py index 45a8d5ab..e8949e1d 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -293,6 +293,8 @@ def addArtisttoDB(artistid, extrasonly=False): # If there is a release, check the ReleaseID against the AlbumID to see if they differ (user updated) if not rg_exists: releaseid = rg['id'] + elif rg_exists and not rg_exists['ReleaseID']: + releaseid = rg['id'] else: releaseid = rg_exists['ReleaseID'] @@ -300,9 +302,9 @@ def addArtisttoDB(artistid, extrasonly=False): controlValueDict = {"AlbumID": rg['id']} - newValueDict = {"ArtistID": artistid, - "ArtistName": artist['artist_name'], - "AlbumTitle": rg['title'], + newValueDict = {"ArtistID": album['ArtistID'], + "ArtistName": album['ArtistName'], + "AlbumTitle": album['AlbumTitle'], "ReleaseID": album['ReleaseID'], "AlbumASIN": album['AlbumASIN'], "ReleaseDate": album['ReleaseDate'], @@ -572,8 +574,8 @@ def getHybridRelease(fullreleaselist): release_dict = { 'hasasin': bool(release['AlbumASIN']), - 'asin': release['AlbumASIN'] - 'trackscount': len(release['Tracks'], + 'asin': release['AlbumASIN'], + 'trackscount': len(release['Tracks']), 'releaseid': release['ReleaseID'], 'releasedate': release['ReleaseDate'], 'format': format, @@ -597,7 +599,7 @@ def getHybridRelease(fullreleaselist): sortable_release_list.sort(key=lambda x:getSortableReleaseDate(x['releasedate'])) - average_tracks = sum(x['trackscount'] for x in releaselist) / float(len(releaselist)) + average_tracks = sum(x['trackscount'] for x in sortable_release_list) / float(len(sortable_release_list)) for item in sortable_release_list: item['trackscount_delta'] = abs(average_tracks - item['trackscount'])