Beispiel #1
0
myconfig = config.get_config()
basedir = myconfig['basedir']
mediadir = myconfig['mediadir'][:-1]
form = cgi.FieldStorage()

common.navigation_header(title=_("Overview"), refreshpage="home.py")

if 'file' in form:
    filename = form['file'].value
else:
    filename = ''

if 'action' in form:
    action = form['action'].value
    if action == 'start' or os.path.exists(basedir):
        fifocontrol.do_action(action, filename)
else:
    action = ''

if 'vol' in form:
    volumeLevel = form['vol'].value
    fifocontrol.do_action("volset " + volumeLevel, filename)

if os.path.isfile(myconfig['basedir'] + 'status'):
    statusfile = open(myconfig['basedir'] + 'status')
    status = statusfile.readline()
    statusfile.close()
else:
    status = ''

notVotedReason = None
Beispiel #2
0
    print "<link rel='stylesheet' type='text/css' href='themes/" + myconfig['theme'] + "/layout.css' />"
    print "<link rel='shortcut icon' href='themes/" + myconfig['theme'] + "/favicon.png' />"
    print "</head><body>"
    print "<form method='post' target='_top' action='index.html'><input type='hidden' name='view' value='playlists'>"
    print "<p align='center'><b>Editing playlist " + playlist + "</b> " +\
        "<input type='submit' value='Done'></p></form>"
    print "</body></html>"
    
myconfig = config.get_config()
basedir = myconfig['basedir']
savedir = myconfig['savedir']
mediadir = myconfig['mediadir'][:-1]
form = cgi.FieldStorage()

if 'action' in form and form['action'].value == 'addnewlist' and 'newlistname' in form:
    fifocontrol.do_action('addnewlist', form['newlistname'].value)
        
if 'playlist' in form:
    playlist = form['playlist'].value
elif 'newlistname' in form:
    playlist = form['newlistname'].value
else:
    common.navigation_header(title="Oyster-GUI")
    print "<p>You did not specify a name for the playlist.</p>"
    print "<p>Please press the <i>Back</i> button in your browser and try again.</a></p>"
    common.html_footer()
    sys.exit()

if playlist == 'default':
    common.navigation_header(title="Oyster-GUI")
    print "<p>It is not allowed to edit the default playlist.</p>"
Beispiel #3
0
if not form.has_key('action'):

    alreadyshown = []
    deletelist = []
    for line in scores:
        if not os.path.exists(line[:-1]) and line not in alreadyshown:
            deletelist.append(line[:-1])
            alreadyshown.append(line)

    if deletelist != []:
        print "<h1>The following files will be removed from the scorefile:</h1>"
        for filename in deletelist:
            print filename.replace(mediadir, '', 1) + "<br>"
        print "<br><a href='clearscores.py?action=delete'>" + \
            "Delete these entries</a>"
    else:
        print "<h1>There are no non-existing files in the scorefile.</h1>"

elif form['action'].value == 'delete':

    counter = 0
    for line in scores:
        if not os.path.exists(line[:-1]):
            fifocontrol.do_action('scoredown',line.replace(mediadir,'',1)[:-1])
            counter += 1

    print "<h1>" + str(counter) + " entries deleted.</h1>"
    
print "</body></html>"
Beispiel #4
0
myconfig = config.get_config()
basedir = myconfig['basedir']
savedir = myconfig['savedir']
mediadir = myconfig['mediadir'][:-1]
form = cgi.FieldStorage()
playlist = config.get_playlist()

# Is oyster currently running?

if os.path.exists(myconfig['basedir']):
    oysterruns = 1
else:
    oysterruns = 0
    
if form.has_key('action'):
    fifocontrol.do_action(form['action'].value, form['file'].value)

import common
common.navigation_header("Scoring")

score = {}
maxscore = 1

if os.path.exists(myconfig['savedir'] + "scores/" + playlist):
    scorefile = open (myconfig['savedir'] + "scores/" + playlist)
    scorefile.readline() # skip initial number
    for line in scorefile.readlines():
        line = line[:-1]
        if score.has_key(line):
            score[line] = score[line] + 1
            if maxscore < score[line]:
Beispiel #5
0
import cgi
form = cgi.FieldStorage()

playlist = config.get_playlist()

import common
common.navigation_header()

try:
    soundfile = form['file'].value
except KeyError:
    soundfile = ''

import fifocontrol
if 'action' in form:
    fifocontrol.do_action(form['action'].value, soundfile)

import os.path
import sys
if not os.path.exists(mediadir + soundfile):
    print "<h1>Error!</h1>"
    print "<p>File <strong>" + soundfile + "</strong> could not be found.</p>"
    print "</body></html>"
    sys.exit()

if os.path.exists(myconfig['basedir']):
    oysterruns = 1
else:
    oysterruns = 0

print "<p><a href='browse.py?dir=/'>Mediadir</a>"
Beispiel #6
0
    oysterruns = True
else:
    oysterruns = False

common.navigation_header("Playlists")

if 'action' in form and ('listname' in form or 'newlistname' in form):
    if form['action'].value == 'confirmdelete':
        confirmdelete()
        sys.exit()
    else:
        if 'listname' in form:
            filename = form['listname'].value
        else:
            filename = form['newlistname'].value
        fifocontrol.do_action(form['action'].value, filename)

if 'playlist' in form and 'action' in form and form['action'].value == 'move':
    renameform(form['playlist'].value)

if 'action' in form and form['action'].value == 'rename' and 'playlist' in form and 'newname' in form:
    if form['playlist'].value.find('_') > -1:
        section = re.sub('_.*\Z', '_', form['playlist'].value)
    else:
        section = ''
    listrename(form['playlist'].value, section + form['newname'].value)

# Move playlist to new or existing section

if 'action' in form and form['action'].value == 'movelistsave' and 'sectiontype' in form and 'playlist' in form:
Beispiel #7
0
myconfig = config.get_config()
basedir = myconfig['basedir']
savedir = myconfig['savedir']
mediadir = myconfig['mediadir'][:-1]
form = cgi.FieldStorage()
playlist = config.get_playlist()

# Is oyster currently running?

if os.path.exists(myconfig['basedir']):
    oysterruns = 1
else:
    oysterruns = 0
    
if form.has_key('action'):
    fifocontrol.do_action(form['action'].value, form['file'].value)

import common
common.navigation_header("Scoring")

score = {}
maxscore = 1

if os.path.exists(myconfig['savedir'] + "scores/" + playlist):
    scorefile = open (myconfig['savedir'] + "scores/" + playlist)
    scorefile.readline() # skip initial number
    for line in scorefile.readlines():
        line = line[:-1]
        if score.has_key(line):
            score[line] = score[line] + 1
            if maxscore < score[line]:
Beispiel #8
0
form = cgi.FieldStorage()

playlist = config.get_playlist()

import common

common.navigation_header()

try:
    soundfile = form['file'].value
except KeyError:
    soundfile = ''

import fifocontrol
if 'action' in form:
    fifocontrol.do_action(form['action'].value, soundfile)

import os.path
import sys
if not os.path.exists(mediadir + soundfile):
    print "<h1>Error!</h1>"
    print "<p>File <strong>" + soundfile + "</strong> could not be found.</p>"
    common.html_footer()
    sys.exit()

if os.path.exists(myconfig['basedir']):
    oysterruns = 1
else:
    oysterruns = 0

print "<p><a href='browse.py?dir=/'>Mediadir</a>"
Beispiel #9
0
cgitb.enable()

myconfig = config.get_config()
basedir = myconfig['basedir']
mediadir = myconfig['mediadir'][:-1]
form = cgi.FieldStorage()

if 'file' in form:
    filename = form['file'].value
else:
    filename = ''

if 'action' in form:
    action = form['action'].value
    if action == 'start' or os.path.exists(basedir):
        fifocontrol.do_action(action, filename)
else:
    action = ''

if 'vol' in form:
    volumeLevel = form['vol'].value
    fifocontrol.do_action("volset " + myconfig['midvolume'], filename)

if os.path.isfile(myconfig['basedir'] + 'status'):
    statusfile = open(myconfig['basedir'] + 'status')
    status = statusfile.readline()
    statusfile.close()
else:
    status = ''

notVotedReason = None
Beispiel #10
0
    print "</head><body>"
    print "<form method='post' target='_top' action='index.html'><input type='hidden' name='view' value='playlists'>"
    print "<p align='center'><b>Editing playlist " + playlist + "</b> " +\
        "<input type='submit' value='Done'></p></form>"
    print "</body></html>"


myconfig = config.get_config()
basedir = myconfig['basedir']
savedir = myconfig['savedir']
mediadir = myconfig['mediadir'][:-1]
form = cgi.FieldStorage()

if 'action' in form and form[
        'action'].value == 'addnewlist' and 'newlistname' in form:
    fifocontrol.do_action('addnewlist', form['newlistname'].value)

if 'playlist' in form:
    playlist = form['playlist'].value
elif 'newlistname' in form:
    playlist = form['newlistname'].value
else:
    common.navigation_header(title="Oyster-GUI")
    print "<p>You did not specify a name for the playlist.</p>"
    print "<p>Please press the <i>Back</i> button in your browser and try again.</a></p>"
    common.html_footer()
    sys.exit()

if playlist == 'default':
    common.navigation_header(title="Oyster-GUI")
    print "<p>It is not allowed to edit the default playlist.</p>"