def __display_next_random(): global i, nextinfo, nexttag i = 0 print "<tr><td colspan='2'><strong>" + _('Next Random') + ":</strong></td></tr>" for nextinfo in nextarray: nexttag = taginfo.get_tag(nextinfo) nextinfo = re.sub('\A' + re.escape(myconfig['mediadir']), '', nextinfo) nextinfo = urllib.quote("/" + nextinfo) print "<tr>" print "<td><strong><a class='file' href='fileinfo.py?file=" + nextinfo + "' title='" + _('View details') + "'>" print nexttag['display'] + "</a></strong></td>" print "<td>" #print "<a href='home.py?action=changerandom" + str(i) + "&file=" + nextinfo + "' title='" + _('Replace_With_Random') + "'>" #print "<img src='themes/" + myconfig['theme'] + "/changerandom.png' alt='Change'/>" #print "</a>" if common.is_show_admin_controls(): print "<a href='home.py?action=delrandom" + str(i) + "&file=" + nextinfo + "' title='" +\ _('Delete_Song') + "'>" print "<img src='themes/" + myconfig['theme'] + "/delrandom.png' alt='Delete'/>" print "</a>" print "</td>" print "</tr>" i += 1 print "<tr><td colspan='2'> </td></tr>"
else: print "" print "</p>" print "<p>" if isblacklisted: print "<span class='blacklisted'>This song is blacklisted</span>" else: regexfile = urllib.quote("^" + re.escape(soundfile) + "$") print "<a class='file' href='blacklist.py?affects=" + regexfile + "&action=add'>Add this song to blacklist</a>" print "</p>" 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'>"
infofile.close() nextarray = [] if os.path.exists(basedir + 'nextfile'): nextfile = open(basedir + 'nextfile') for line in nextfile.readlines(): nextarray.append(line[:-1]) nextfile.close() playlist = config.get_playlist() playreason = info.split()[0] # Remove playreason from info line info = re.sub(r'^[A-Z]* ', '', info) tag = taginfo.get_tag(info) if playreason == 'PLAYLIST': playreason = ' (random)' pr_image = 'pr_random.png' pr_alt = 'random' elif playreason == 'SCORED': playreason = ' (scored)' pr_image = 'pr_scored.png' pr_alt = 'scored' elif playreason == 'ENQUEUED': playreason = ' (enqueued)' pr_image = 'pr_enqueued.png' pr_alt = 'enqueued' elif playreason == 'VOTED': playreason = ' (voted)'
else: print "" print "</p>" print "<p>" if isblacklisted: print "<span class='blacklisted'>This song is blacklisted</span>" elif common.is_show_admin_controls(): regexfile = urllib.quote("^" + re.escape(soundfile) + "$") print "<a class='file' href='blacklist.py?affects=" + regexfile + "&action=add'>Add this song to blacklist</a>" print "</p>" 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'])