From cb6c3629eafede24bf271f008c354ce083d797ae Mon Sep 17 00:00:00 2001 From: Ben Arc Date: Mon, 7 Jun 2021 23:29:40 +0100 Subject: [PATCH] Works! --- lnbits/extensions/jukebox/crud.py | 6 +- lnbits/extensions/jukebox/migrations.py | 4 +- lnbits/extensions/jukebox/models.py | 2 - lnbits/extensions/jukebox/static/js/index.js | 2 +- .../jukebox/templates/jukebox/jukebox.html | 166 +++++++-------- lnbits/extensions/jukebox/views.py | 34 ---- lnbits/extensions/jukebox/views_api.py | 189 +++++++++++------- 7 files changed, 188 insertions(+), 215 deletions(-) diff --git a/lnbits/extensions/jukebox/crud.py b/lnbits/extensions/jukebox/crud.py index 272d3e1a5..074791c10 100644 --- a/lnbits/extensions/jukebox/crud.py +++ b/lnbits/extensions/jukebox/crud.py @@ -3,6 +3,7 @@ from typing import List, Optional from . import db from .models import Jukebox, JukeboxPayment from lnbits.helpers import urlsafe_short_hash +import json async def create_jukebox( @@ -21,8 +22,8 @@ async def create_jukebox( juke_id = urlsafe_short_hash() result = await db.execute( """ - INSERT INTO jukebox (id, user, title, wallet, sp_user, sp_secret, sp_access_token, sp_refresh_token, sp_device, sp_playlists, price, profit, queue) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + INSERT INTO jukebox (id, user, title, wallet, sp_user, sp_secret, sp_access_token, sp_refresh_token, sp_device, sp_playlists, price, profit) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) """, ( juke_id, @@ -37,7 +38,6 @@ async def create_jukebox( sp_playlists, int(price), 0, - "[]", ), ) jukebox = await get_jukebox(juke_id) diff --git a/lnbits/extensions/jukebox/migrations.py b/lnbits/extensions/jukebox/migrations.py index 946620140..7d4fe2e34 100644 --- a/lnbits/extensions/jukebox/migrations.py +++ b/lnbits/extensions/jukebox/migrations.py @@ -17,9 +17,7 @@ async def m001_initial(db): sp_device TEXT, sp_playlists TEXT, price INTEGER, - profit INTEGER, - queue TEXT, - last_checked TIMESTAMP NOT NULL DEFAULT (strftime('%s', 'now')) + profit INTEGER ); """ ) diff --git a/lnbits/extensions/jukebox/models.py b/lnbits/extensions/jukebox/models.py index e88f5896b..1d57a0284 100644 --- a/lnbits/extensions/jukebox/models.py +++ b/lnbits/extensions/jukebox/models.py @@ -21,8 +21,6 @@ class Jukebox(NamedTuple): sp_playlists: str price: int profit: int - queue: list - last_checked: int @classmethod def from_row(cls, row: Row) -> "Jukebox": diff --git a/lnbits/extensions/jukebox/static/js/index.js b/lnbits/extensions/jukebox/static/js/index.js index c162bf518..64e056b97 100644 --- a/lnbits/extensions/jukebox/static/js/index.js +++ b/lnbits/extensions/jukebox/static/js/index.js @@ -199,7 +199,7 @@ new Vue({ console.log(self.devices) console.log("this.devices") setTimeout(function () { - if (self.devices.length < 1 && self.playlists.length < 1) { + if (self.devices.length < 1 || self.playlists.length < 1) { self.$q.notify({ spinner: true, color: 'red', diff --git a/lnbits/extensions/jukebox/templates/jukebox/jukebox.html b/lnbits/extensions/jukebox/templates/jukebox/jukebox.html index 2cafd32ad..6db64018e 100644 --- a/lnbits/extensions/jukebox/templates/jukebox/jukebox.html +++ b/lnbits/extensions/jukebox/templates/jukebox/jukebox.html @@ -9,8 +9,7 @@
- {{ currentPlay.name }}
+ {{ currentPlay.name }}
{{ currentPlay.artist }}
@@ -20,29 +19,15 @@

Pick a song

- + +
- +