Updated artist to mbid function to accept non utf8 chars

This commit is contained in:
Remy
2011-08-16 13:42:14 -07:00
parent 10b334f29e
commit c866316c09
4 changed files with 31 additions and 13 deletions

View File

@@ -1,14 +1,18 @@
<%inherit file="base.html" />
<%!
import headphones
%>
<%def name="body()">
<div id="paddingheader">
<h1>Manage New Artists<h1>
<h1>Manage Artists<h1>
</div>
<form action="addArtists" method="get">
<form action="markArtists" method="get">
<p class="indented">
Add selected artists
<select name="action">
<option value="pause">Pause</option>
<option value="resume">Resume</option>
<option value="refresh">Refresh</option>
<option value="delete">Delete</option>
</select>
selected artists
<input type="submit" value="Go">
</p>
<table class="display" id="artist_table">
@@ -16,13 +20,23 @@
<tr>
<th id="select"><input type="checkbox" onClick="toggle(this)" /></th>
<th id="name">Artist Name</th>
<th id="status">Status</th>
</tr>
</thead>
<tbody>
%for artist in headphones.NEW_ARTISTS:
<tr class="gradeZ">
%for artist in artists:
<%
if artist['Status'] == 'Paused':
grade = 'X'
elif artist['Status'] == 'Loading':
grade = 'C'
else:
grade = 'Z'
%>
<tr class="grade${grade}">
<td id="select"><input type="checkbox" name="${artist['ArtistID']}" class="checkbox" /></td>
<td id="name"><span title="${artist['ArtistSortName']}"></span><a href="artistPage?ArtistID=${artist['ArtistID']}">${artist['ArtistName']}</a></td>
<td id="status">${artist['Status']}</td>
</tr>
%endfor
</tbody>
@@ -44,6 +58,7 @@
"aoColumns": [
null,
{ "sType": "title-string"},
null
],
"bStateSave": true,
"bPaginate": false

View File

@@ -201,7 +201,7 @@ def initialize():
PREFERRED_QUALITY = check_setting_int(CFG, 'General', 'preferred_quality', 0)
PREFERRED_BITRATE = check_setting_int(CFG, 'General', 'preferred_bitrate', '')
DETECT_BITRATE = bool(check_setting_int(CFG, 'General', 'detect_bitrate', 0))
ADD_ARTISTS = bool(check_setting_int(CFG, 'General', 'add_artists', 1))
ADD_ARTISTS = bool(check_setting_int(CFG, 'General', 'auto_add_artists', 1))
CORRECT_METADATA = bool(check_setting_int(CFG, 'General', 'correct_metadata', 0))
MOVE_FILES = bool(check_setting_int(CFG, 'General', 'move_files', 0))
RENAME_FILES = bool(check_setting_int(CFG, 'General', 'rename_files', 0))
@@ -366,7 +366,7 @@ def config_write():
new_config['General']['preferred_quality'] = PREFERRED_QUALITY
new_config['General']['preferred_bitrate'] = PREFERRED_BITRATE
new_config['General']['detect_bitrate'] = int(DETECT_BITRATE)
new_config['General']['add_artists'] = int(ADD_ARTISTS)
new_config['General']['auto_add_artists'] = int(ADD_ARTISTS)
new_config['General']['correct_metadata'] = int(CORRECT_METADATA)
new_config['General']['move_files'] = int(MOVE_FILES)
new_config['General']['rename_files'] = int(RENAME_FILES)

View File

@@ -22,10 +22,13 @@ def is_exists(artistid):
return False
def artistlist_to_mbids(artistlist):
def artistlist_to_mbids(artistlist, forced=False):
for artist in artistlist:
if forced:
artist = unicode(artist, 'utf-8')
results = mb.findArtist(artist, limit=1)
if not results:

View File

@@ -150,7 +150,7 @@ class WebInterface(object):
markAlbums.exposed = True
def addArtists(self, **args):
threading.Thread(target=importer.artistlist_to_mbids, args=[args]).start()
threading.Thread(target=importer.artistlist_to_mbids, args=[args, True]).start()
time.sleep(5)
raise cherrypy.HTTPRedirect("home")
addArtists.exposed = True