mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-22 04:39:26 +00:00
Updated artist to mbid function to accept non utf8 chars
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user