cgitb.enable() _ = common.get_prefered_language() myconfig = config.get_config() basedir = myconfig['basedir'] mediadir = re.sub('/\Z', '', myconfig['mediadir'][:-1]) form = cgi.FieldStorage() playlist = config.get_playlist() if 'mode' in form and form['mode'].value == 'editplaylist': viewplaylist = False editplaylist = True mode = '&mode=editplaylist' common.html_header(title=_("Browse")) print "<ul id='navigation'>" print "<li class='double'><a href='browse.py?mode=editplaylist&playlist=" + urllib.quote(form['playlist'].value) +\ "'>Browse</a></li>" print "<li class='double'><a href='search.py?mode=playlist&playlist=" + urllib.quote(form['playlist'].value) +\ "'>Search</a></li>" print "</ul>" print "<br/><hr/>" elif 'mode' in form and form['mode'].value == 'browseplaylist' and 'playlist' in form: viewplaylist = True editplaylist = False title = _("Songs in playlist") + " '" + form['playlist'].value + "'" common.navigation_header(title=title) print "<h1>" + title + "</h1>"
"""Tests if the given program exists and can be executed""" if os.path.exists(var) and os.access(var, os.X_OK): result = 0 else: result = 1 print "<tr>" print "<td>Is " + name + " (" + var + ") installed and executable?</td>" print_result(result) print "</tr>" myconfig = config.get_config() common.html_header(title="Oyster Configuration Checker") print "<h1>Configuration Checker</h1>" if not os.path.exists(myconfig['savedir'] + "config/default"): print "<p>No config file found! Please use the " print "<a href='configedit.py' target='control'>Configuration Editor</a> to create one</p>" else: print "<table width='100%'>" print "<tr><th colspan='2' class='configsection'>" + \ "Testing permissions...</th></tr>" test_readable('savedir', myconfig['savedir']) test_writeable('savedir', myconfig['savedir']) test_createable('basedir', myconfig['basedir'])
common.navigation_header(title="Oyster-GUI") print "<p>It is not allowed to edit the default playlist.</p>" common.html_footer() sys.exit() if not 'mode' in form and not 'delfile' in form and not 'deldir' in form and not 'addfile' in form\ and not 'adddir' in form: print_frameset() sys.exit() elif 'mode' in form and form['mode'].value == 'title': print_title() sys.exit() # Starting from here: mode == edit common.html_header(title="Oyster-GUI") allfiles = [] playlistfile = open(savedir + "lists/" + playlist) for line in playlistfile.readlines(): line = line.replace(mediadir, '', 1) allfiles.append(line[:-1]) playlistfile.close() # Delete a single file if 'delfile' in form: allfiles.remove(form['delfile'].value) # Delete a complete directory
import re import urllib cgitb.enable() _ = common.get_prefered_language() myconfig = config.get_config() basedir = myconfig['basedir'] mediadir = myconfig['mediadir'][:-1] form = cgi.FieldStorage() if 'playlist' in form and 'mode' in form and form['mode'].value == 'playlist': editplaylist = 1 mode = '&mode=playlist' common.html_header(title="Suchen") print "<ul id='navigation'>" print "<li class='double'><a href='browse.py?mode=editplaylist&playlist=" +\ urllib.quote(form['playlist'].value) + "'>" + _("Browse") + "</a></li>" print "<li class='double'><a href='search.py?mode=playlist&playlist=" +\ urllib.quote(form['playlist'].value) + "'>" + _("Search") + "</a></li>" print "</ul>" print "<br/><hr/>" else: editplaylist = 0 common.navigation_header(title="Suchen") mode = ''
myconfig = config.get_config() basedir = myconfig['basedir'] mediadir = re.sub('/\Z', '', myconfig['mediadir'][:-1]) form = cgi.FieldStorage() if 'playlist' in form: playlist = form['playlist'].value else: playlist = config.get_playlist() if 'mode' in form and form['mode'].value == 'editplaylist': viewplaylist = False editplaylist = True mode = '&mode=editplaylist' common.html_header(title=_("Browse")) print "<ul id='navigation'>" print "<li class='double'><a href='browse.py?mode=editplaylist&playlist=" + urllib.quote(form['playlist'].value) +\ "'>Browse</a></li>" print "<li class='double'><a href='search.py?mode=playlist&playlist=" + urllib.quote(form['playlist'].value) +\ "'>Search</a></li>" print "</ul>" print "<br/><hr/>" elif 'mode' in form and form[ 'mode'].value == 'browseplaylist' and 'playlist' in form: viewplaylist = True editplaylist = False title = _("Songs in playlist") + " '" + form['playlist'].value + "'" common.navigation_header(title=title)