mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-27 20:56:55 +00:00
librespot: python2 fixes
This commit is contained in:
parent
153f3d3658
commit
cfc89de6a7
@ -1,3 +1,4 @@
|
|||||||
|
import pipes
|
||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import threading
|
import threading
|
||||||
@ -33,9 +34,9 @@ MAX_PANICS = 3
|
|||||||
class Librespot(xbmc.Player):
|
class Librespot(xbmc.Player):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super(Librespot, self).__init__()
|
||||||
settings = get_settings()
|
settings = get_settings()
|
||||||
quoted = {k: shlex.quote(v) for (k, v) in settings.items()}
|
quoted = {k: pipes.quote(v) for (k, v) in settings.items()}
|
||||||
command = LIBRESPOT
|
command = LIBRESPOT
|
||||||
if settings['autoplay'] == 'true':
|
if settings['autoplay'] == 'true':
|
||||||
command += LIBRESPOT_AUTOPLAY
|
command += LIBRESPOT_AUTOPLAY
|
||||||
@ -118,11 +119,13 @@ class Librespot(xbmc.Player):
|
|||||||
cwd=ADDON_HOME,
|
cwd=ADDON_HOME,
|
||||||
env=ADDON_ENVT,
|
env=ADDON_ENVT,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE)
|
||||||
text=True)
|
|
||||||
log('librespot started')
|
log('librespot started')
|
||||||
with self.librespot.stdout:
|
with self.librespot.stdout:
|
||||||
for line in self.librespot.stdout:
|
while True:
|
||||||
|
line = self.librespot.stdout.readline()
|
||||||
|
if line == '':
|
||||||
|
break
|
||||||
words = line.split()
|
words = line.split()
|
||||||
if words[0] == '@Playing':
|
if words[0] == '@Playing':
|
||||||
self.on_event_playing(words[1], words[2])
|
self.on_event_playing(words[1], words[2])
|
||||||
@ -151,7 +154,7 @@ class Librespot(xbmc.Player):
|
|||||||
if self.is_playing_librespot and not self.is_aborted:
|
if self.is_playing_librespot and not self.is_aborted:
|
||||||
log('stopping librespot playback')
|
log('stopping librespot playback')
|
||||||
self.is_playing_librespot = False
|
self.is_playing_librespot = False
|
||||||
super().stop()
|
super(Librespot, self).stop()
|
||||||
|
|
||||||
def stop_librespot(self, restart=False):
|
def stop_librespot(self, restart=False):
|
||||||
self.restart = restart
|
self.restart = restart
|
||||||
|
@ -4,7 +4,7 @@ from ls_addon import log as log
|
|||||||
|
|
||||||
|
|
||||||
def run(command):
|
def run(command):
|
||||||
return subprocess.check_output(command.split(), text=True)
|
return subprocess.check_output(command.split())
|
||||||
|
|
||||||
|
|
||||||
class Pulseaudio:
|
class Pulseaudio:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user