<%inherit file="base.html"/> <%! from headphones import db import headphones import string %> <%def name="headerIncludes()">
« Back to overview <%def name="body()">

# ${artist['ArtistName']}

Mark selected albums as

|  | Name | Date | Type | Metacritic | Status | Have | Bitrate | Format
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
%for album in albums: <% if album['Status'] == 'Skipped': grade = 'Z' elif album['Status'] == 'Wanted': grade = 'X' elif album['Status'] == 'Snatched': grade = 'C' elif album['Status'] == 'Ignored': grade = 'I' else: grade = 'A' myDB = db.DBConnection() totaltracks = len(myDB.select('SELECT TrackTitle from tracks WHERE AlbumID=?', [album['AlbumID']])) havetracks = len(myDB.select('SELECT TrackTitle from tracks WHERE AlbumID=? AND Location IS NOT NULL', [album['AlbumID']])) + len(myDB.select('SELECT TrackTitle from have WHERE ArtistName like ? AND AlbumTitle LIKE ? AND Matched = "Failed"', [album['ArtistName'], album['AlbumTitle']])) try: percent = (havetracks*100.0)/totaltracks if percent > 100: percent = 100 except (ZeroDivisionError, TypeError): percent = 0 totaltracks = '?' avgbitrate = myDB.action("SELECT AVG(BitRate) FROM tracks WHERE AlbumID=?", [album['AlbumID']]).fetchone()[0] if avgbitrate: bitrate = str(int(avgbitrate)/1000) + ' kbps' else: bitrate = '' albumformatcount = myDB.action("SELECT COUNT(DISTINCT Format) FROM tracks WHERE AlbumID=?", [album['AlbumID']]).fetchone()[0] if albumformatcount == 1: albumformat = myDB.action("SELECT DISTINCT Format FROM tracks WHERE AlbumID=?", [album['AlbumID']]).fetchone()[0] elif albumformatcount > 1: albumformat = 'Mixed' else: albumformat = '' lossy_formats = [str.upper(fmt) for fmt in headphones.LOSSY_MEDIA_FORMATS] %>
|  | ${album['AlbumTitle']} | ${album['ReleaseDate']} | ${album['Type']} | ${album['CriticScore']}/${album['UserScore']} | ${album['Status']} %if album['Status'] == 'Skipped' or album['Status'] == 'Ignored': [want] %elif (album['Status'] == 'Wanted' or album['Status'] == 'Wanted Lossless'): [skip] [search] %else: [retry][new] %endif %if albumformat in lossy_formats and album['Status'] == 'Skipped': [want lossless] %elif albumformat in lossy_formats and (album['Status'] == 'Snatched' or album['Status'] == 'Downloaded'): [retry lossless] %endif | ${havetracks}/${totaltracks} | ${bitrate} | ${albumformat}
%endfor

<%def name="headIncludes()"> <%def name="javascriptIncludes()">