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
+7 -2
View File
@@ -173,10 +173,15 @@ def moveFiles(albumpath, release, tracks):
artist = release['ArtistName'].replace('/', '_') artist = release['ArtistName'].replace('/', '_')
album = release['AlbumTitle'].replace('/', '_') album = release['AlbumTitle'].replace('/', '_')
if artist[0].isdigit(): if release['ArtistName'].startswith('The '):
sortname = release['ArtistName'][4:]
else:
sortname = release['ArtistName']
if sortname.isdigit():
firstchar = '0-9' firstchar = '0-9'
else: else:
firstchar = artist[0] firstchar = sortname[0]
values = { 'artist': artist, values = { 'artist': artist,
+6 -10
View File
@@ -508,18 +508,14 @@ class WebInterface(object):
page.append(templates._logobar) page.append(templates._logobar)
page.append(templates._nav) page.append(templates._nav)
page.append('''<div class="table"><p class="logtext">''') page.append('''<div class="table"><p class="logtext">''')
if os.path.isfile(os.path.join(headphones.LOG_DIR, 'headphones.log')): log_file = os.path.join(headphones.LOG_DIR, 'headphones.log')
fileHandle = open(os.path.join(headphones.LOG_DIR, 'headphones.log')) if os.path.isfile(log_file):
fileHandle = open(log_file)
lineList = fileHandle.readlines() lineList = fileHandle.readlines()
fileHandle.close() fileHandle.close()
i = -1 lineList.reverse()
if len(lineList) < 100: for line in lineList[1:200]:
limit = -len(lineList) page.append(line.decode('utf-8') + '<br /><br />')
else:
limit = -100
while i > limit:
page.append(lineList[i] + '<br /><br />')
i -= 1
page.append('''</p></div>''') page.append('''</p></div>''')
page.append(templates._footer % headphones.CURRENT_VERSION) page.append(templates._footer % headphones.CURRENT_VERSION)
return page return page