party-upload: minor CSS and Python 3 fixes
authorClinton Ebadi <clinton@unknownlamer.org>
Sat, 13 Nov 2021 03:28:45 +0000 (22:28 -0500)
committerClinton Ebadi <clinton@unknownlamer.org>
Sat, 13 Nov 2021 03:28:45 +0000 (22:28 -0500)
party-upload/admin.cgi
party-upload/normals.cgi
party-upload/partyparty.py

index fb27e84..c1be02e 100755 (executable)
@@ -36,6 +36,7 @@ import numbers
 import os
 import random
 import subprocess
+import urllib
 from kodijson import Kodi
 from yattag import Doc
 
@@ -43,7 +44,9 @@ import partyparty
 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>")
index ff3efbe..22004ab 100755 (executable)
@@ -38,8 +38,13 @@ print ("content-type: text/html; charset=utf-8\n\n")
 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>')
 
 
 
index c8ce3f0..377e998 100644 (file)
@@ -39,7 +39,9 @@ def connect (_kodi):
     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):
@@ -378,7 +380,7 @@ class PartyManager:
             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: