コード例 #1
0
    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
if 'vote' in form:
    (mayVote, notVotedReason) = common.may_vote(form['vote'].value, None)
    if mayVote:
        fifocontrol.do_vote(form['vote'].value)

if 'votelist' in form:
    fifocontrol.do_votelist(form['votelist'].value)

check_oyster_started()

infofile = open(basedir + 'info')
info = infofile.readline()[:-1]
infofile.close()

nextarray = []
if os.path.exists(basedir + 'nextfile'):
    nextfile = open(basedir + 'nextfile')
コード例 #2
0
ファイル: browse.py プロジェクト: nabcos/oyster
        # more generic alternation
        if alt == '':
            alt = '2'
        else:
            alt = ''
            
        escapedfile = cgi.escape(curfile)

        if editplaylist:
            print "<td><a class='" + cssfileclass + "' href=" + \
                  "'editplaylist.py?playlist=" + urllib.quote(form['playlist'].value) + \
                  "&amp;addfile=" + escapeddir + "' target='playlist'>Add</a></td>"
        else:
            # only generate "Vote"-link if oyster is running
            (mayVote, reason) = may_vote(dir, playlist, playlistContents, historyList)
            if oysterruns and mayVote:
                print "<td><a title='Vote this song' class='" + cssfileclass + "' href='home.py?vote=" + escapeddir +\
                      "' ><img src='themes/" + myconfig['theme'] + "/votefile" + alt + ".png'/></a></td>"
            elif oysterruns and not mayVote:
                print "<td><span class='" + cssfileclass + "' style='font-style: italic;' '>"
                print "<img title='Voting not allowed: " + reason + "' src='themes/" + myconfig['theme'] +\
                      "/notmayvote" + alt + ".png'/>"
                print "</span></td>"
            else:
                print "<td></td>"

        print "<td><a class='" + cssfileclass + "' href='fileinfo.py?file=" \
            + escapeddir + "'>" + escapedfile + "</a></td>"

    elif curfile[-3:] == 'm3u' or curfile[-3:] == 'pls':  # if we have a list...
コード例 #3
0
isblacklisted = 0
if os.path.exists(myconfig['savedir'] + "blacklists/" + playlist):
    blacklist = open(myconfig['savedir'] + "blacklists/" + playlist)
    for rule in blacklist.readlines():
        if re.match('.*' + rule[:-1] + '.*', soundfile):
            isblacklisted = 1
    blacklist.close()

escapedfile = urllib.quote(soundfile)

if not os.access(mediadir + soundfile, os.R_OK):
    print "<h1>Sorry, Oyster does not have the permission to read this file!</h1>"
    common.html_footer()
    sys.exit()

(mayVote, reason) = common.may_vote(soundfile, None)

print "<p>"
if oysterruns and mayVote:
    print "<span class='file'><a class='file' href='home.py?vote=" + escapedfile + "' >"
    print "<img src='themes/" + myconfig[
        'theme'] + "/votefile.png'/> Vote this song</a></span>"
elif oysterruns and not mayVote:
    print "<span class='file' style='font-style: italic;' '>"
    print "<img src='themes/" + myconfig['theme'] + "/notmayvote.png'/> "
    print reason + "</span>"
else:
    print ""
print "</p>"

print "<p>"
コード例 #4
0
ファイル: fileinfo.py プロジェクト: nabcos/oyster
isblacklisted = 0
if os.path.exists(myconfig['savedir'] + "blacklists/" + playlist):
    blacklist = open(myconfig['savedir'] + "blacklists/" + playlist)
    for rule in blacklist.readlines():
        if re.match('.*' + rule[:-1] + '.*', soundfile):
            isblacklisted = 1
    blacklist.close()

escapedfile = urllib.quote(soundfile)

if not os.access(mediadir + soundfile, os.R_OK):
    print "<h1>Sorry, Oyster does not have the permission to read this file!</h1>"
    print "</body></html>"
    sys.exit()

(mayVote, reason) = common.may_vote(soundfile, None)

print "<p>"
if oysterruns and mayVote:
    print "<span class='file'><a class='file' href='home.py?vote=" + escapedfile + "' >"
    print "<img src='themes/" + myconfig['theme'] + "/votefile.png'/> Vote this song</a></span>"
elif oysterruns and not mayVote:
    print "<span class='file' style='font-style: italic;' '>" 
    print "<img src='themes/" + myconfig['theme'] + "/notmayvote.png'/> "
    print reason + "</span>"
else:
    print ""
print "</p>"

print "<p>"
コード例 #5
0
ファイル: browse.py プロジェクト: speutel/oyster
            alt = '2'
        else:
            alt = ''

        escapedfile = cgi.escape(curfile)

        if editplaylist:
            if mediadir + dir in playlistContents:
                print "<td></td>"
            else:
                print "<td><a class='" + cssfileclass + "' href=" + \
                      "'editplaylist.py?playlist=" + urllib.quote(form['playlist'].value) + \
                      "&amp;addfile=" + escapeddir + "' target='playlist'>Add</a></td>"
        else:
            # only generate "Vote"-link if oyster is running
            (mayVote, reason) = may_vote(dir, playlist, playlistContents,
                                         historyList)
            if oysterruns and mayVote:
                print "<td><a title='Vote this song' class='" + cssfileclass + "' href='home.py?vote=" + escapeddir +\
                      "' ><img src='themes/" + myconfig['theme'] + "/votefile" + alt + ".png'/></a></td>"
            elif oysterruns and not mayVote:
                print "<td><span class='" + cssfileclass + "' style='font-style: italic;' '>"
                print "<img title='Voting not allowed: " + reason + "' src='themes/" + myconfig['theme'] +\
                      "/notmayvote" + alt + ".png'/>"
                print "</span></td>"
            else:
                print "<td></td>"

        print "<td><a class='" + cssfileclass + "' href='fileinfo.py?file=" \
            + escapeddir + "'>" + escapedfile + "</a></td>"

    elif curfile[-3:] == 'm3u' or curfile[-3:] == 'pls':  # if we have a list...