mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-21 00:14:02 +01:00
Updated artist to mbid function to accept non utf8 chars
This commit is contained in:
@@ -1,14 +1,18 @@
|
|||||||
<%inherit file="base.html" />
|
<%inherit file="base.html" />
|
||||||
<%!
|
|
||||||
import headphones
|
|
||||||
%>
|
|
||||||
<%def name="body()">
|
<%def name="body()">
|
||||||
<div id="paddingheader">
|
<div id="paddingheader">
|
||||||
<h1>Manage New Artists<h1>
|
<h1>Manage Artists<h1>
|
||||||
</div>
|
</div>
|
||||||
<form action="addArtists" method="get">
|
<form action="markArtists" method="get">
|
||||||
<p class="indented">
|
<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">
|
<input type="submit" value="Go">
|
||||||
</p>
|
</p>
|
||||||
<table class="display" id="artist_table">
|
<table class="display" id="artist_table">
|
||||||
@@ -16,13 +20,23 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th id="select"><input type="checkbox" onClick="toggle(this)" /></th>
|
<th id="select"><input type="checkbox" onClick="toggle(this)" /></th>
|
||||||
<th id="name">Artist Name</th>
|
<th id="name">Artist Name</th>
|
||||||
|
<th id="status">Status</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
%for artist in headphones.NEW_ARTISTS:
|
%for artist in artists:
|
||||||
<tr class="gradeZ">
|
<%
|
||||||
|
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="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="name"><span title="${artist['ArtistSortName']}"></span><a href="artistPage?ArtistID=${artist['ArtistID']}">${artist['ArtistName']}</a></td>
|
||||||
|
<td id="status">${artist['Status']}</td>
|
||||||
</tr>
|
</tr>
|
||||||
%endfor
|
%endfor
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -44,6 +58,7 @@
|
|||||||
"aoColumns": [
|
"aoColumns": [
|
||||||
null,
|
null,
|
||||||
{ "sType": "title-string"},
|
{ "sType": "title-string"},
|
||||||
|
null
|
||||||
],
|
],
|
||||||
"bStateSave": true,
|
"bStateSave": true,
|
||||||
"bPaginate": false
|
"bPaginate": false
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ def initialize():
|
|||||||
PREFERRED_QUALITY = check_setting_int(CFG, 'General', 'preferred_quality', 0)
|
PREFERRED_QUALITY = check_setting_int(CFG, 'General', 'preferred_quality', 0)
|
||||||
PREFERRED_BITRATE = check_setting_int(CFG, 'General', 'preferred_bitrate', '')
|
PREFERRED_BITRATE = check_setting_int(CFG, 'General', 'preferred_bitrate', '')
|
||||||
DETECT_BITRATE = bool(check_setting_int(CFG, 'General', 'detect_bitrate', 0))
|
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))
|
CORRECT_METADATA = bool(check_setting_int(CFG, 'General', 'correct_metadata', 0))
|
||||||
MOVE_FILES = bool(check_setting_int(CFG, 'General', 'move_files', 0))
|
MOVE_FILES = bool(check_setting_int(CFG, 'General', 'move_files', 0))
|
||||||
RENAME_FILES = bool(check_setting_int(CFG, 'General', 'rename_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_quality'] = PREFERRED_QUALITY
|
||||||
new_config['General']['preferred_bitrate'] = PREFERRED_BITRATE
|
new_config['General']['preferred_bitrate'] = PREFERRED_BITRATE
|
||||||
new_config['General']['detect_bitrate'] = int(DETECT_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']['correct_metadata'] = int(CORRECT_METADATA)
|
||||||
new_config['General']['move_files'] = int(MOVE_FILES)
|
new_config['General']['move_files'] = int(MOVE_FILES)
|
||||||
new_config['General']['rename_files'] = int(RENAME_FILES)
|
new_config['General']['rename_files'] = int(RENAME_FILES)
|
||||||
|
|||||||
@@ -22,10 +22,13 @@ def is_exists(artistid):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def artistlist_to_mbids(artistlist):
|
def artistlist_to_mbids(artistlist, forced=False):
|
||||||
|
|
||||||
for artist in artistlist:
|
for artist in artistlist:
|
||||||
|
|
||||||
|
if forced:
|
||||||
|
artist = unicode(artist, 'utf-8')
|
||||||
|
|
||||||
results = mb.findArtist(artist, limit=1)
|
results = mb.findArtist(artist, limit=1)
|
||||||
|
|
||||||
if not results:
|
if not results:
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class WebInterface(object):
|
|||||||
markAlbums.exposed = True
|
markAlbums.exposed = True
|
||||||
|
|
||||||
def addArtists(self, **args):
|
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)
|
time.sleep(5)
|
||||||
raise cherrypy.HTTPRedirect("home")
|
raise cherrypy.HTTPRedirect("home")
|
||||||
addArtists.exposed = True
|
addArtists.exposed = True
|
||||||
|
|||||||
Reference in New Issue
Block a user