mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-10 13:49:32 +01:00
Finishing touches - adjusted css for config, fixed bug when no track duration, helpers now converts milliseconds to H:M:S if its more than an hour
This commit is contained in:
@@ -221,6 +221,8 @@ footer { margin: 20px auto 20px auto; }
|
||||
div#version { text-align: center; font-weight: bold; }
|
||||
div#donate { text-align: center; margin: 20px auto 20px auto; }
|
||||
|
||||
div#shutdown{ text-align: center; vertical-align: middle; }
|
||||
|
||||
.cloudtag { padding-top: 30px; font-size:16px; }
|
||||
#cloud a.tag1 { font-size: 0.7em; font-weight: 100; }
|
||||
#cloud a.tag2 { font-size: 0.8em; font-weight: 200; }
|
||||
|
||||
@@ -30,9 +30,14 @@
|
||||
<%
|
||||
totalduration = myDB.action("SELECT SUM(TrackDuration) FROM tracks WHERE AlbumID=?", [album['AlbumID']]).fetchone()[0]
|
||||
totaltracks = len(myDB.select("SELECT TrackTitle from tracks WHERE AlbumID=?", [album['AlbumID']]))
|
||||
try:
|
||||
albumduration = helpers.convert_milliseconds(totalduration)
|
||||
except:
|
||||
albumduration = 'n/a'
|
||||
|
||||
%>
|
||||
<h3>Tracks: ${totaltracks}</h3>
|
||||
<h3>Duration: ${helpers.convert_milliseconds(totalduration)}</h3>
|
||||
<h3>Duration: ${albumduration}</h3>
|
||||
%if description:
|
||||
<h3>Description: </h3>
|
||||
${description['Summary']}
|
||||
@@ -55,18 +60,22 @@
|
||||
%for track in tracks:
|
||||
<%
|
||||
i += 1
|
||||
have = myDB.select('SELECT TrackTitle from have WHERE ArtistName like ? AND AlbumTitle like ? AND TrackTitle like ?', [album['ArtistName'], album['AlbumTitle'], track['TrackTitle']])
|
||||
have = myDB.select('SELECT TrackTitle from have WHERE ArtistName like ? AND AlbumTitle like ? AND TrackTitle like ?', [track['ArtistName'], track['AlbumTitle'], track['TrackTitle']])
|
||||
if len(have):
|
||||
grade = 'A'
|
||||
check = '<img src="images/checkmark.png" alt="checkmark">'
|
||||
else:
|
||||
grade = 'Z'
|
||||
check = ''
|
||||
try:
|
||||
trackduration = helpers.convert_milliseconds(track['TrackDuration'])
|
||||
except:
|
||||
trackduration = 'n/a'
|
||||
%>
|
||||
<tr class="grade${grade}">
|
||||
<td id="number">${i}</td>
|
||||
<td id="name">${track['TrackTitle']}</td>
|
||||
<td id="duration">${helpers.convert_milliseconds(track['TrackDuration'])}</td>
|
||||
<td id="duration">${trackduration}</td>
|
||||
<td id="have">${check}</td>
|
||||
</tr>
|
||||
%endfor
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<%inherit file="base.html"/>
|
||||
|
||||
<%def name="headerIncludes()">
|
||||
<div id="subhead_container">
|
||||
<ul id="subhead_menu">
|
||||
<li><a href="shutdown">Shut Down</a></li>
|
||||
<li><a href="restart">Restart</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</%def>
|
||||
<%def name="body()">
|
||||
<div id="paddingheader">
|
||||
<h1><h1>
|
||||
</div>
|
||||
<div class="table_wrapper">
|
||||
<form action="configUpdate" method="post">
|
||||
<a name="web_interface"><h1><u>Web Interface</u></h1></a>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<%inherit file="base.html"/>
|
||||
|
||||
<%def name="headIncludes()">
|
||||
<meta http-equiv="refresh" content="15;url=index">
|
||||
<meta http-equiv="refresh" content="${timer};url=index">
|
||||
</%def>
|
||||
|
||||
<%def name="body()">
|
||||
<div class="table_wrapper">
|
||||
<div id="shutdown">
|
||||
<h1>Headphones is ${message}</h1>
|
||||
</div>
|
||||
</div>
|
||||
</%def>
|
||||
@@ -79,8 +79,10 @@ def convert_milliseconds(ms):
|
||||
|
||||
seconds = ms/1000
|
||||
gmtime = time.gmtime(seconds)
|
||||
|
||||
minutes = time.strftime("%M:%S", gmtime)
|
||||
if seconds > 3600:
|
||||
minutes = time.strftime("%H:%M:%S", gmtime)
|
||||
else:
|
||||
minutes = time.strftime("%M:%S", gmtime)
|
||||
|
||||
return minutes
|
||||
|
||||
|
||||
@@ -357,8 +357,8 @@ class WebInterface(object):
|
||||
def shutdown(self):
|
||||
logger.info(u"Headphones is shutting down...")
|
||||
threading.Timer(2, headphones.shutdown).start()
|
||||
message = 'Shutting Down'
|
||||
return serve_template(templatename="shutdown.html", title="Shutting Down", message=message)
|
||||
message = 'Shutting Down...'
|
||||
return serve_template(templatename="shutdown.html", title="Shutting Down", message=message, timer=15)
|
||||
return page
|
||||
|
||||
shutdown.exposed = True
|
||||
@@ -366,15 +366,15 @@ class WebInterface(object):
|
||||
def restart(self):
|
||||
logger.info(u"Headphones is restarting...")
|
||||
threading.Timer(2, headphones.shutdown, [True]).start()
|
||||
message = 'Restarting'
|
||||
return serve_template(templatename="shutdown.html", title="Restarting", message=message)
|
||||
message = 'Restarting...'
|
||||
return serve_template(templatename="shutdown.html", title="Restarting", message=message, timer=30)
|
||||
restart.exposed = True
|
||||
|
||||
def update(self):
|
||||
logger.info('Headphones is updating...')
|
||||
threading.Timer(2, headphones.shutdown, [True, True]).start()
|
||||
message = 'Updating'
|
||||
return serve_template(templatename="shutdown.html", title="Updating", message=message)
|
||||
message = 'Updating...'
|
||||
return serve_template(templatename="shutdown.html", title="Updating", message=message, timer=120)
|
||||
return page
|
||||
|
||||
update.exposed = True
|
||||
@@ -388,6 +388,7 @@ class WebInterface(object):
|
||||
|
||||
def addReleaseById(self, rid):
|
||||
threading.Thread(target=importer.addReleaseById, args=[rid]).start()
|
||||
time.sleep(5)
|
||||
raise cherrypy.HTTPRedirect("home")
|
||||
addReleaseById.exposed = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user