Multiple fixes
- Fixed pwa location in manifest.json - made database generator check the .env for location rather than runtime attribute - fixed dark mode preference based on cookie/browser preference - changed to socketio.sleep for compatibility
This commit is contained in:
parent
419eed375c
commit
f95ecc78d4
4 changed files with 13 additions and 10 deletions
|
|
@ -11,18 +11,18 @@ parser=argparse.ArgumentParser(description="Options for the generation of the so
|
||||||
# parser.add_argument('-k','--apikey', help='String: LastFM api key', default="")
|
# parser.add_argument('-k','--apikey', help='String: LastFM api key', default="")
|
||||||
parser.add_argument('-m', '--mode', help='new/update: Remake database or update current', default= "update")
|
parser.add_argument('-m', '--mode', help='new/update: Remake database or update current', default= "update")
|
||||||
parser.add_argument('-a', '--art', help="True/False: Add art to the database using LastFm (takes minimum 0.25s per song)", default="True")
|
parser.add_argument('-a', '--art', help="True/False: Add art to the database using LastFm (takes minimum 0.25s per song)", default="True")
|
||||||
parser.add_argument('-d','--directory',help="Directory of the song files", default="./sound/")
|
# parser.add_argument('-d','--directory',help="Directory of the song files", default="./sound/")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
dotenv.load_dotenv()
|
dotenv.load_dotenv()
|
||||||
apikeylastfm = os.getenv("API_KEY")
|
apikeylastfm = os.getenv("API_KEY")
|
||||||
soundLocation = os.getenv("DIRECTORY")
|
soundLocation = os.getenv("DIRECTORY")
|
||||||
# apikeylastfm = args.apikey
|
# apikeylastfm = args.apikey
|
||||||
if args.directory[-1] == "/" or args.directory[-1] == "\\":
|
if soundLocation[-1] == "/" or soundLocation[-1] == "\\":
|
||||||
soundLocation = args.directory
|
soundLocation = soundLocation
|
||||||
elif "/" in args.directory:
|
elif "/" in soundLocation:
|
||||||
soundLocation = args.directory + "/"
|
soundLocation = soundLocation + "/"
|
||||||
else:
|
else:
|
||||||
soundLocation = args.directory + "\\"
|
soundLocation = soundLocation + "\\"
|
||||||
|
|
||||||
songFiles = os.listdir(soundLocation)
|
songFiles = os.listdir(soundLocation)
|
||||||
fileOfDB = sql.connect("songDatabase.db")
|
fileOfDB = sql.connect("songDatabase.db")
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "Jukebox Remote",
|
"name": "Jukebox Remote",
|
||||||
"short_name": "Jukebox Remote",
|
"short_name": "Jukebox Remote",
|
||||||
"description": "Controller for the PartyJukebox server app.",
|
"description": "Controller for the PartyJukebox server app.",
|
||||||
"start_url": "index.html",
|
"start_url": "/",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"background_color": "#eeeeee",
|
"background_color": "#eeeeee",
|
||||||
"theme_color": "#eeeeee",
|
"theme_color": "#eeeeee",
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ let currentlyPlaying = false;
|
||||||
const params = new URLSearchParams(location.search);
|
const params = new URLSearchParams(location.search);
|
||||||
|
|
||||||
let darkmodetemp = getCookie("darkmode");
|
let darkmodetemp = getCookie("darkmode");
|
||||||
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches && darkmodetemp === undefined) {
|
||||||
darkmodetemp = "true";
|
darkmodetemp = "true";
|
||||||
}
|
}
|
||||||
if(darkmodetemp === "") {
|
if(darkmodetemp === "") {
|
||||||
|
|
@ -191,8 +191,10 @@ async function searchSongs(searchTerm){
|
||||||
}
|
}
|
||||||
image.id = String(fileName)+" image";
|
image.id = String(fileName)+" image";
|
||||||
let head3 = document.createElement("h3");
|
let head3 = document.createElement("h3");
|
||||||
|
head3.id = fileName;
|
||||||
head3.innerText = currentSongInJSON["title"];
|
head3.innerText = currentSongInJSON["title"];
|
||||||
let head4 = document.createElement("h4");
|
let head4 = document.createElement("h4");
|
||||||
|
head4.id = fileName;
|
||||||
head4.innerText = currentSongInJSON["artist"];
|
head4.innerText = currentSongInJSON["artist"];
|
||||||
newItem.appendChild(image);
|
newItem.appendChild(image);
|
||||||
newItem.appendChild(head3);
|
newItem.appendChild(head3);
|
||||||
|
|
@ -489,6 +491,7 @@ async function submitSong(songid) {
|
||||||
function checkWhatSongWasClicked(e) {
|
function checkWhatSongWasClicked(e) {
|
||||||
if(e.type == "click" || e.key == "Enter") {
|
if(e.type == "click" || e.key == "Enter") {
|
||||||
itemId = e.srcElement.id;
|
itemId = e.srcElement.id;
|
||||||
|
// console.log(e.srcElement);
|
||||||
if ((itemId.length-itemId.lastIndexOf("image") == 5) && itemId.lastIndexOf("image")!=-1) {
|
if ((itemId.length-itemId.lastIndexOf("image") == 5) && itemId.lastIndexOf("image")!=-1) {
|
||||||
itemId = itemId.slice(0,-6)
|
itemId = itemId.slice(0,-6)
|
||||||
}
|
}
|
||||||
|
|
@ -565,7 +568,7 @@ async function submitPerms(e) {
|
||||||
|
|
||||||
async function clearPlaylist() {
|
async function clearPlaylist() {
|
||||||
let returncode = await getFromServer({control:"clear"},"controls");
|
let returncode = await getFromServer({control:"clear"},"controls");
|
||||||
if(returncode == ERR_NO_ADMIN || returncode == null) {
|
if(returncode["status"] === ERR_NO_ADMIN || returncode == null) {
|
||||||
// alertText("Admin Restricted ")
|
// alertText("Admin Restricted ")
|
||||||
// there's an admin restrict alert built into getFromServer
|
// there's an admin restrict alert built into getFromServer
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ def playQueuedSongs():
|
||||||
# check for new songs every second
|
# check for new songs every second
|
||||||
# I just didn't want to eat too much processing looping
|
# I just didn't want to eat too much processing looping
|
||||||
# this also has another useful affect that skips get "queued" to only 1 per second, that way somebody usually can't skip twice accidentally
|
# this also has another useful affect that skips get "queued" to only 1 per second, that way somebody usually can't skip twice accidentally
|
||||||
time.sleep(1)
|
socketio.sleep(1)
|
||||||
|
|
||||||
@socketio.on("connect")
|
@socketio.on("connect")
|
||||||
def handleConnect():
|
def handleConnect():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue