import os
import random
import subprocess
+import urllib
from kodijson import Kodi
from yattag import Doc
from partyparty import Song, SongControls, Search, Playlist, PartyManager
cgitb.enable()
-PAGE_SELF = os.environ['SCRIPT_NAME'] if 'SCRIPT_NAME' in os.environ else ''
+#PAGE_SELF = os.environ['SCRIPT_NAME'] if 'SCRIPT_NAME' in os.environ else ''
+PAGE_SELF = os.environ['SCRIPT_NAME'].rsplit('/', 1)[-1] if 'SCRIPT_NAME' in os.environ else ''
+#PAGE_SELF = 'admin.cgi'
print ("content-type: text/html; charset=utf-8\n\n")
print ("<!DOCTYPE html>\n<html><head><title>partyparty beb</title></head><body>")
sys.stdout.flush ()
print ("<!DOCTYPE html>\n<html><head><title>partyparty beb</title></head><body>")
print (partyparty.css ())
+# Override max-width of song since controls will be zero width
+print ('<style>.flex_row p { font-size: 175%; max-width: 100% !important; min-width: 50% }</style>');
+
+PAGE_SELF = os.environ['SCRIPT_NAME'].rsplit('/', 1)[-1] if 'SCRIPT_NAME' in os.environ else ''
+
+print ('<p style="font-size: 5rem"><a href="upload.html">upload a song</a> | <a href="youtube.html">add from YouTube</a> | <a href="normals.cgi">reload</a> | <a href="normals.cgi?browseartists=1">browse library</a>')
-print ('<p style="font-size: 5rem"><a href="upload.html">Upload A Song</a> | <a href="youtube.html">Add From YouTube</a> | <a href="normals.cgi">home</a> | <a href="normals.cgi?browseartists=1">browse</a></p>')
return kodi
SONG_PROPERTIES = ['album', 'artist', 'albumartist', 'title', 'dateadded', 'userrating', 'displayartist']
-PAGE_SELF = os.environ['SCRIPT_NAME'] if 'SCRIPT_NAME' in os.environ else ''
+#PAGE_SELF = os.environ['SCRIPT_NAME'] if 'SCRIPT_NAME' in os.environ else ''
+PAGE_SELF = os.environ['SCRIPT_NAME'].rsplit('/', 1)[-1] if 'SCRIPT_NAME' in os.environ else ''
+
class Song:
def __init__ (self, song):
with tag ('ol', klass='flex_list'):
for artist in artists:
with tag ('li', style='padding: 1rem; font-size: x-large'):
- with tag ('a', href='{}?searchgo=1&searchterm={}&searchfield=artist'.format (PAGE_SELF, urllib.quote_plus (artist['artist'].encode ('utf-8')).decode ('utf-8'))):
+ with tag ('a', href='{}?searchgo=1&searchterm={}&searchfield=artist'.format (PAGE_SELF, urllib.parse.quote_plus (artist['artist']))):
text (artist['label'])
print (doc.getvalue ())
elif 'uploadgo' in form: