Esempio n. 1
0
        escapedpartdir = cgi.escape(partdir)
        if 'playlist' in form:
            print "/ <a href='browse.py?dir=/" + escapeddir + mode + \
                  "&amp;playlist=" + urllib.quote(form['playlist'].value) + "'>" + escapedpartdir + \
                  "</a>"
        else:
            print "/ <a href='browse.py?dir=/" + escapeddir + mode + "'>" + \
                escapedpartdir + "</a>"
        incdir = incdir + partdir + '/'

    partdir = dirs[len(dirs)-1]
    escapedpartdir = cgi.escape(partdir)
    if escapedpartdir != '':
        print "/ <strong>" + escapedpartdir + "</strong>"
    print " /</p>"
    print "<p>" + common.get_cover(mediadir + givendir, myconfig['coverwidth']) + "</p>"
elif not os.path.exists(mediadir + givendir):
    # if $mediadir == "/": just build filelist, no dir-splitting needed
    print "<h1>Error!</h1>"
    print "The directory " + givendir + " could not be found."
    print "</body></html>"

if viewplaylist and 'playlist' in form:
    allfiles = []
    playlistfile = open(myconfig['savedir'] + "lists/" + form['playlist'].value)
    for line in playlistfile.readlines():
        line = line.replace(mediadir, '', 1)
        allfiles.append(line[:-1])
    playlistfile.close()
    common.results = allfiles
    common.listdir('/', 0, 'file2', 0, urllib.quote(playlist))
Esempio n. 2
0
tag = taginfo.get_tag(mediadir + soundfile)

timesplayed = 0
logmatcher = re.compile(
    '\A[0-9]{4}[0-9]{2}[0-9]{2}\-[0-9]{2}[0-9]{2}[0-9]{2} ([^ ]*) (.*)\Z')
log = open(myconfig['savedir'] + "logs/" + playlist)
for line in log.readlines():
    matcher = logmatcher.match(line[:-1])
    if matcher is not None and matcher.group(2).find(
            soundfile) > -1 and matcher.group(1) == 'DONE':
        timesplayed += 1

log.close()

albumdir = os.path.dirname(mediadir + soundfile) + "/"
coverdata = common.get_cover(albumdir, myconfig['coverwidth'])

print "<table border='0'>"
if 'title' in tag:
    print "<tr><td class='fileinfo'>Title: </td><td>" + tag['title']

    if 'artist' in tag and 'title' in tag:
        print "<a class='file' href='lyrics.py?artist=" + urllib.quote(tag['artist']) + \
              "&amp;song=" + urllib.quote(tag['title']) + "'> (Songtext)</a>"

    print "</td></tr>"

if 'artist' in tag:
    print "<tr><td class='fileinfo'>Artist: </td><td>"
    print "<a href='search.py?searchtype=normal&amp;playlist=current&amp;" + \
        "search=" + urllib.quote(tag['artist']) + "' title='Search for " + \
Esempio n. 3
0
regexfile = urllib.quote("^" + re.escape(soundfile) + "$")

tag = taginfo.get_tag(mediadir + soundfile)

timesplayed = 0
logmatcher = re.compile('\A[0-9]{4}[0-9]{2}[0-9]{2}\-[0-9]{2}[0-9]{2}[0-9]{2} ([^ ]*) (.*)\Z')
log = open(myconfig['savedir'] + "logs/" + playlist)
for line in log.readlines():
    matcher = logmatcher.match(line[:-1])
    if matcher is not None and matcher.group(2).find(soundfile) > -1 and matcher.group(1) == 'DONE':
        timesplayed += 1

log.close()

albumdir = os.path.dirname(mediadir + soundfile) + "/"
coverdata = common.get_cover(albumdir, myconfig['coverwidth'])

print "<table border='0'>"
if 'title' in tag:
    print "<tr><td class='fileinfo'>Title: </td><td>" + tag['title']

    if 'artist' in tag and 'title' in tag:
        print "<a class='file' href='lyrics.py?artist=" + urllib.quote(tag['artist']) + \
              "&amp;song=" + urllib.quote(tag['title']) + "'> (Songtext)</a>"

    print "</td></tr>"

if 'artist' in tag:
    print "<tr><td class='fileinfo'>Artist: </td><td>"
    print "<a href='search.py?searchtype=normal&amp;playlist=current&amp;" + \
        "search=" + urllib.quote(tag['artist']) + "' title='Search for " + \
Esempio n. 4
0
        escapedpartdir = cgi.escape(partdir)
        if 'playlist' in form:
            print "/ <a href='browse.py?dir=/" + escapeddir + mode + \
                  "&amp;playlist=" + urllib.quote(form['playlist'].value) + "'>" + escapedpartdir + \
                  "</a>"
        else:
            print "/ <a href='browse.py?dir=/" + escapeddir + mode + "'>" + \
                escapedpartdir + "</a>"
        incdir = incdir + partdir + '/'

    partdir = dirs[len(dirs) - 1]
    escapedpartdir = cgi.escape(partdir)
    if escapedpartdir != '':
        print "/ <strong>" + escapedpartdir + "</strong>"
    print " /</p>"
    print "<p>" + common.get_cover(mediadir + givendir,
                                   myconfig['coverwidth']) + "</p>"
elif not os.path.exists(mediadir + givendir):
    # if $mediadir == "/": just build filelist, no dir-splitting needed
    print "<h1>Error!</h1>"
    print "The directory " + givendir + " could not be found."
    print "</body></html>"

if viewplaylist and 'playlist' in form:
    allfiles = []
    playlistfile = open(myconfig['savedir'] + "lists/" +
                        form['playlist'].value)
    for line in playlistfile.readlines():
        line = line.replace(mediadir, '', 1)
        allfiles.append(line[:-1])
    playlistfile.close()
    common.results = allfiles