mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-30 01:29:26 +01:00
Added Manage Artist section under Manage
This commit is contained in:
@@ -143,6 +143,7 @@ div#main { margin: 0; padding: 80px 0 0 0; }
|
||||
|
||||
table#artist_table { background-color: white; width: 100%; padding: 20px; }
|
||||
|
||||
table#artist_table th#select { text-align: left; }
|
||||
table#artist_table th#name { text-align: left; min-width: 200px; }
|
||||
table#artist_table th#status { text-align: left; min-width: 50px; }
|
||||
table#artist_table th#album { text-align: left; min-width: 300px; }
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
%>
|
||||
<tr class="grade${grade}">
|
||||
<td id="select"><input type="checkbox" name="${album['AlbumID']}" class="checkbox" /></th>
|
||||
<td id="select"><input type="checkbox" name="${album['AlbumID']}" class="checkbox" /></td>
|
||||
<td id="albumart"><img src="http://ec1.images-amazon.com/images/P/${album['AlbumASIN']}.01.MZZZZZZZ.jpg" height="50" width="50"></td>
|
||||
<td id="albumname"><a href="albumPage?AlbumID=${album['AlbumID']}">${album['AlbumTitle']}</a></td>
|
||||
<td id="reldate">${album['ReleaseDate']}</td>
|
||||
|
||||
@@ -2,8 +2,18 @@
|
||||
<%!
|
||||
import headphones
|
||||
%>
|
||||
<%def name="headerIncludes()">
|
||||
<div id="subhead_container">
|
||||
<ul id="subhead_menu">
|
||||
<li><a href="manageArtists">Manage Artists</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
<%def name="body()">
|
||||
<div id="paddingheader">
|
||||
<h1><h1>
|
||||
</div>
|
||||
<div class="table_wrapper">
|
||||
<h1>Scan Music Library</h1><br />
|
||||
Where do you keep your music?<br /><br />
|
||||
|
||||
69
data/interfaces/default/manageartists.html
Normal file
69
data/interfaces/default/manageartists.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<%inherit file="base.html" />
|
||||
|
||||
<%def name="body()">
|
||||
<div id="paddingheader">
|
||||
<h1>Manage Artists<h1>
|
||||
</div>
|
||||
<form action="markArtists" method="get">
|
||||
<p class="indented">
|
||||
<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">
|
||||
<thead>
|
||||
<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 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>
|
||||
</table>
|
||||
</form>
|
||||
</%def>
|
||||
|
||||
<%def name="headIncludes()">
|
||||
<link rel="stylesheet" href="css/data_table.css">
|
||||
</%def>
|
||||
|
||||
<%def name="javascriptIncludes()">
|
||||
<script src="js/libs/jquery.dataTables.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#artist_table').dataTable(
|
||||
{
|
||||
"aoColumns": [
|
||||
null,
|
||||
{ "sType": "title-string"},
|
||||
null
|
||||
],
|
||||
"bStateSave": true,
|
||||
"bPaginate": false
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</%def>
|
||||
@@ -183,6 +183,34 @@ class WebInterface(object):
|
||||
return serve_template(templatename="manage.html", title="Manage")
|
||||
manage.exposed = True
|
||||
|
||||
def manageArtists(self):
|
||||
myDB = db.DBConnection()
|
||||
artists = myDB.select('SELECT * from artists order by ArtistSortName COLLATE NOCASE')
|
||||
return serve_template(templatename="manageartists.html", title="Manage Artists", artists=artists)
|
||||
manageArtists.exposed = True
|
||||
|
||||
def markArtists(self, action=None, **args):
|
||||
myDB = db.DBConnection()
|
||||
for ArtistID in args:
|
||||
if action == 'delete':
|
||||
myDB.action('DELETE from artists WHERE ArtistID=?', [ArtistID])
|
||||
myDB.action('DELETE from albums WHERE ArtistID=?', [ArtistID])
|
||||
myDB.action('DELETE from tracks WHERE ArtistID=?', [ArtistID])
|
||||
elif action == 'pause':
|
||||
controlValueDict = {'ArtistID': ArtistID}
|
||||
newValueDict = {'Status': 'Paused'}
|
||||
myDB.upsert("artists", newValueDict, controlValueDict)
|
||||
elif action == 'resume':
|
||||
controlValueDict = {'ArtistID': ArtistID}
|
||||
newValueDict = {'Status': 'Active'}
|
||||
myDB.upsert("artists", newValueDict, controlValueDict)
|
||||
else:
|
||||
# These may and probably will collide - need to make a better way to queue musicbrainz queries
|
||||
threading.Thread(target=importer.addArtisttoDB, args=[ArtistID]).start()
|
||||
time.sleep(30)
|
||||
raise cherrypy.HTTPRedirect("home")
|
||||
markArtists.exposed = True
|
||||
|
||||
def importLastFM(self, username):
|
||||
headphones.LASTFM_USERNAME = username
|
||||
headphones.config_write()
|
||||
|
||||
Reference in New Issue
Block a user