diff --git a/README.md b/README.md index 0436293..caecec8 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ Uses 'bottle' and 'librespot-python' for playback, and 'spotipy' for the playlis Thanks to kokarare1212 for creating ['librespot-python'](https://github.com/kokarare1212/librespot-python/). -This a fork of the [glk1001](https://github.com/glk1001/plugin.audio.spotify) version, modified to work with librespot-python instead of spotty. +This a fork of the [glk1001](https://github.com/glk1001/plugin.audio.spotify) addon, modified to work with librespot-python instead of spotty. -It may take some disabling/re-enabling the addon to get it to generate the initial authorization token. Dunno why. +It may take some disabling/re-enabling the addon (or just reopening it a few times) to get it to generate the initial authorization token. Dunno why. ## Support None, like my Piped addon this is for personal use. If you wanna update it, fork it (and let me know if you end up doing so!) \ No newline at end of file diff --git a/resources/language/resource.language.de_de/strings.po b/resources/language/resource.language.de_de/strings.po index 14381b2..a77eeca 100644 --- a/resources/language/resource.language.de_de/strings.po +++ b/resources/language/resource.language.de_de/strings.po @@ -24,6 +24,10 @@ msgctxt "#11002" msgid "Password" msgstr "Passwort" +msgctxt "#11003" +msgid "Premium Account" +msgstr "" + msgctxt "#11005" msgid "New releases" msgstr "Neuerscheinungen" diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index c914125..3fa68ea 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -24,6 +24,10 @@ msgctxt "#11002" msgid "Password" msgstr "" +msgctxt "#11003" +msgid "Premium Account" +msgstr "" + msgctxt "#11005" msgid "New releases" msgstr "" diff --git a/resources/language/resource.language.es_ar/strings.po b/resources/language/resource.language.es_ar/strings.po index cdd7253..382e1b1 100644 --- a/resources/language/resource.language.es_ar/strings.po +++ b/resources/language/resource.language.es_ar/strings.po @@ -24,6 +24,10 @@ msgctxt "#11002" msgid "Password" msgstr "Contraseña" +msgctxt "#11003" +msgid "Premium Account" +msgstr "" + msgctxt "#11005" msgid "New releases" msgstr "Nuevos Lanzamientos" diff --git a/resources/language/resource.language.es_es/strings.po b/resources/language/resource.language.es_es/strings.po index 61ca289..6f5bdc3 100644 --- a/resources/language/resource.language.es_es/strings.po +++ b/resources/language/resource.language.es_es/strings.po @@ -24,6 +24,10 @@ msgctxt "#11002" msgid "Password" msgstr "Contraseña" +msgctxt "#11003" +msgid "Premium Account" +msgstr "" + msgctxt "#11005" msgid "New releases" msgstr "Nuevos Lanzamientos" diff --git a/resources/language/resource.language.es_mx/strings.po b/resources/language/resource.language.es_mx/strings.po index 6c85d38..7457d43 100644 --- a/resources/language/resource.language.es_mx/strings.po +++ b/resources/language/resource.language.es_mx/strings.po @@ -24,6 +24,10 @@ msgctxt "#11002" msgid "Password" msgstr "Contraseña" +msgctxt "#11003" +msgid "Premium Account" +msgstr "" + msgctxt "#11005" msgid "New releases" msgstr "Nuevos Lanzamientos" diff --git a/resources/language/resource.language.fr_fr/strings.po b/resources/language/resource.language.fr_fr/strings.po index 3938f3d..05952c5 100644 --- a/resources/language/resource.language.fr_fr/strings.po +++ b/resources/language/resource.language.fr_fr/strings.po @@ -24,6 +24,10 @@ msgctxt "#11002" msgid "Password" msgstr "Mot de passe" +msgctxt "#11003" +msgid "Premium Account" +msgstr "" + msgctxt "#11005" msgid "New releases" msgstr "Nouveautés" diff --git a/resources/language/resource.language.he_he/strings.po b/resources/language/resource.language.he_he/strings.po index 07bb55c..d29813f 100644 --- a/resources/language/resource.language.he_he/strings.po +++ b/resources/language/resource.language.he_he/strings.po @@ -25,6 +25,10 @@ msgctxt "#11002" msgid "Password" msgstr "ססמה" +msgctxt "#11003" +msgid "Premium Account" +msgstr "" + msgctxt "#11005" msgid "New releases" msgstr "שיחרורים חדשים" diff --git a/resources/language/resource.language.nl_nl/strings.po b/resources/language/resource.language.nl_nl/strings.po index fc75d5e..76f5d5d 100644 --- a/resources/language/resource.language.nl_nl/strings.po +++ b/resources/language/resource.language.nl_nl/strings.po @@ -25,6 +25,10 @@ msgctxt "#11002" msgid "Password" msgstr "Wachtwoord" +msgctxt "#11003" +msgid "Premium Account" +msgstr "" + msgctxt "#11005" msgid "New releases" msgstr "Nieuwe releases" diff --git a/resources/lib/bottle_manager.py b/resources/lib/bottle_manager.py index c262845..75e3c17 100644 --- a/resources/lib/bottle_manager.py +++ b/resources/lib/bottle_manager.py @@ -4,27 +4,35 @@ sys.path.insert(1, os.path.join(os.path.dirname(__file__), "deps")) from wsgiref.simple_server import make_server from bottle import app, request, HTTPResponse, Bottle -import xbmc +import xbmcaddon from librespot.core import Session from librespot.audio.decoders import AudioQuality, VorbisOnlyAudioQuality from librespot.metadata import TrackId -from utils import log_msg +from utils import ADDON_ID, log_msg class LibrespotServer(Bottle): + __addon: xbmcaddon.Addon = xbmcaddon.Addon(id=ADDON_ID) + def __init__(self, session: Session): super(LibrespotServer, self).__init__() self.session: Session = session self.route('/track/', callback=self.stream) + self.is_premium: bool = self.__addon.getSetting("isPremium") # TODO: Make Range header work PLEASE I BEG def stream(self, track_id): try: playabletrack_id = TrackId.from_uri(f"spotify:track:{track_id}") + + quality = AudioQuality.NORMAL + if self.is_premium: + quality = AudioQuality.VERY_HIGH + stream = self.session.content_feeder().load( - playabletrack_id, VorbisOnlyAudioQuality(AudioQuality.NORMAL), False, + playabletrack_id, VorbisOnlyAudioQuality(quality), False, None) start = 0 end = stream.input_stream.size diff --git a/resources/settings.xml b/resources/settings.xml index 8310211..75bb48e 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -3,6 +3,7 @@ +