Added logging to WebUI (refresh browser if the font is huge so it uses the new css)

This commit is contained in:
Remy
2011-07-23 16:03:39 -07:00
parent 73710ab76e
commit 3aa178a4a6
4 changed files with 26 additions and 5 deletions

View File

@@ -99,6 +99,10 @@ h1{
font-size: 16px;
margin-left: 100px;
}
.logtext{
font-size: 14px;
padding: 4px
}
.bigtext{
font-size: 22px;
}

View File

@@ -25,14 +25,12 @@ def findArtist(name, limit=1):
chars = set('!?')
if any((c in chars) for c in name):
term = '"'+name+'"'
else:
term = name
name = '"'+name+'"'
while attempt < 5:
try:
artistResults = q.getArtists(ws.ArtistFilter(query=term, limit=limit))
artistResults = q.getArtists(ws.ArtistFilter(query=name, limit=limit))
break
except WebServiceError, e:
logger.warn('Attempt to query MusicBrainz for %s failed: %s' % (name, e))

View File

@@ -34,6 +34,7 @@ _nav = '''<div class="nav">
<a href="upcoming">UPCOMING</a>
<a href="manage">MANAGE</a>
<a href="history">HISTORY</a>
<a href="logs">LOGS</a>
<a href="config">SETTINGS</a>
<div style="float:right">
<a href="restart" title="Restart"><img src="images/restart.png" height="15px" width="15px" border="0"></a>
@@ -148,7 +149,7 @@ configform = form = '''
<p>Music Download Directory:</p><input type="text" name="download_dir" value="%s" size="60"><br>
<i class="smalltext">Absolute or relative path to the dir where SAB downloads your music<br>
<i class="smalltext">Full path to the directory where SAB downloads your music<br>
i.e. Downloads/music or /Users/name/Downloads/music</i>
</td>
</tr>

View File

@@ -487,6 +487,24 @@ class WebInterface(object):
return page
history.exposed = True
def logs(self):
page = [templates._header]
page.append(templates._logobar)
page.append(templates._nav)
page.append('''<div class="table"><p class="logtext">''')
fileHandle = open(os.path.join(headphones.LOG_DIR, 'headphones.log'))
lineList = fileHandle.readlines()
fileHandle.close()
i = -1
while i > -100:
page.append(lineList[i] + '<br /><br />')
i -= 1
page.append('''</p></div>''')
page.append(templates._footer % headphones.CURRENT_VERSION)
return page
logs.exposed = True
def clearhistory(self):
logger.info(u"Clearing history")