Small bug fixes: non-ascii characters in log on Windows, firstchar sorting under The

This commit is contained in:
Remy
2011-08-04 00:14:05 -07:00
parent b7396a27db
commit 7ee5e78bf4
2 changed files with 13 additions and 12 deletions

View File

@@ -172,11 +172,16 @@ def moveFiles(albumpath, release, tracks):
artist = release['ArtistName'].replace('/', '_')
album = release['AlbumTitle'].replace('/', '_')
if release['ArtistName'].startswith('The '):
sortname = release['ArtistName'][4:]
else:
sortname = release['ArtistName']
if artist[0].isdigit():
if sortname.isdigit():
firstchar = '0-9'
else:
firstchar = artist[0]
firstchar = sortname[0]
values = { 'artist': artist,

View File

@@ -508,18 +508,14 @@ class WebInterface(object):
page.append(templates._logobar)
page.append(templates._nav)
page.append('''<div class="table"><p class="logtext">''')
if os.path.isfile(os.path.join(headphones.LOG_DIR, 'headphones.log')):
fileHandle = open(os.path.join(headphones.LOG_DIR, 'headphones.log'))
log_file = os.path.join(headphones.LOG_DIR, 'headphones.log')
if os.path.isfile(log_file):
fileHandle = open(log_file)
lineList = fileHandle.readlines()
fileHandle.close()
i = -1
if len(lineList) < 100:
limit = -len(lineList)
else:
limit = -100
while i > limit:
page.append(lineList[i] + '<br /><br />')
i -= 1
lineList.reverse()
for line in lineList[1:200]:
page.append(line.decode('utf-8') + '<br /><br />')
page.append('''</p></div>''')
page.append(templates._footer % headphones.CURRENT_VERSION)
return page