diff --git a/config.py b/config.py index ae559ec8..0049c883 100644 --- a/config.py +++ b/config.py @@ -9,6 +9,11 @@ http_host = General['http_host'] http_port = General['http_port'] http_username = General['http_username'] http_password = General['http_password'] +try: + http_root = General['http_root'] +except KeyError: + General['http_root'] = '' + config.write() launch_browser = General['launch_browser'] usenet_retention = General['usenet_retention'] include_lossless = General['include_lossless'] diff --git a/configcreate.py b/configcreate.py index 476f1922..df8cc035 100644 --- a/configcreate.py +++ b/configcreate.py @@ -8,6 +8,7 @@ def configCreate(path): config['General']['http_port'] = 8181 config['General']['http_username'] = '' config['General']['http_password'] = '' + config['General']['http_root'] = '' config['General']['launch_browser'] = 1 config['General']['include_lossless'] = 0 config['General']['flac_to_mp3'] = 0 diff --git a/data/css/style.css b/data/css/style.css index 98b31847..1f871014 100644 --- a/data/css/style.css +++ b/data/css/style.css @@ -86,6 +86,9 @@ h1{ .smalltext{ font-size: 11px; } +.bigtext{ + font-size: 22px; + } a:link { color: #5E2612; text-decoration: none; diff --git a/headphones.py b/headphones.py index 331713ef..68e973f9 100755 --- a/headphones.py +++ b/headphones.py @@ -20,6 +20,7 @@ FULL_PATH = os.path.dirname(os.path.abspath(__file__)) config_file = os.path.join(FULL_PATH, 'config.ini') LOG_DIR = os.path.join(FULL_PATH, 'logs') +web_root = None if os.path.exists(config_file): pass @@ -105,20 +106,28 @@ def serverstart(): logger.sb_log_instance.initLogging(consoleLogging=consoleLogging) - + global web_root + try: + web_root = settings['http_root'] + except KeyError: + web_root = '/' + def browser(): if settings['http_host'] == '0.0.0.0': host = 'localhost' else: host = settings['http_host'] - webbrowser.open('http://' + host + ':' + settings['http_port']) + webbrowser.open('http://' + host + ':' + settings['http_port'] + web_root) if settings['launch_browser'] == '1': cherrypy.engine.subscribe('start', browser, priority=90) logger.log(u"Starting Headphones on port:" + settings['http_port']) - cherrypy.quickstart(webServer.Headphones(), config = conf) + + + + cherrypy.quickstart(webServer.Headphones(), web_root, config = conf) if __name__ == '__main__': diff --git a/musicbrainz2/webservice.py b/musicbrainz2/webservice.py index a869530d..f2df7d65 100644 --- a/musicbrainz2/webservice.py +++ b/musicbrainz2/webservice.py @@ -241,7 +241,7 @@ class WebService(IWebService): query = urllib.urlencode(params) url = urlparse.urlunparse(('http', netloc, path, '', query,'')) - + return url diff --git a/webServer.py b/webServer.py index 1ee05afe..70b5f17b 100644 --- a/webServer.py +++ b/webServer.py @@ -163,19 +163,19 @@ class Headphones: artistResults = ws.Query().getArtists(ws.ArtistFilter(string.replace(name, '&', '%38'), limit=8)) if len(artistResults) == 0: logger.log(u"No results found for " + name) - page.append('''No results!Go back''') + page.append('''No results!Go back''') return page elif len(artistResults) > 1: page.append('''Search returned multiple artists. Click the artist you want to add:

''') for result in artistResults: artist = result.artist - page.append('''%s (more info)
''' % (u.extractUuid(artist.id), artist.name, u.extractUuid(artist.id))) + page.append('''%s (more info)
''' % (u.extractUuid(artist.id), artist.name, u.extractUuid(artist.id))) return page else: for result in artistResults: artist = result.artist logger.log(u"Found one artist matching your search term: " + artist.name +" ("+ artist.id+")") - raise cherrypy.HTTPRedirect("/addArtist?artistid=%s" % u.extractUuid(artist.id)) + raise cherrypy.HTTPRedirect("addArtist?artistid=%s" % u.extractUuid(artist.id)) findArtist.exposed = True @@ -200,7 +200,7 @@ class Headphones: artistlist = c.fetchall() if any(artistid in x for x in artistlist): page = [templates._header] - page.append('''%s has already been added. Go back.''' % artist.name) + page.append('''%s has already been added. Go back.''' % artist.name) logger.log(artist.name + u" is already in the database!", logger.WARNING) c.close() return page @@ -334,7 +334,9 @@ class Headphones: ''' % (albumart, albums[i][6], albums[i][5], albums[i][4], albums[i][0], albums[i][1])) i += 1 page.append('''''') - page.append(templates._footer) + if len(albums): + page.append(templates._footer) + return page upcoming.exposed = True