(2020-10-05, 16:31)kriznik Wrote: (2020-09-15, 19:31)kriznik Wrote: I have exactly same issue when playing from LMS it stops after 2-3seconds
and in log a lot of demuxers
Code:
2020-09-15 12:43:02.751 T:139637611808512 NOTICE: plugin.audio.squeezebox --> play started by lms server
2020-09-15 12:43:02.998 T:139637628593920 ERROR: Init: Error creating demuxer
2020-09-15 12:43:03.031 T:139637628593920 NOTICE: CDVDAudioCodecFFmpeg::Open() Successful opened audio decoder pcm_s16le
2020-09-15 12:43:03.163 T:139638178051840 NOTICE: PulseAudio: Opened device Default in pcm mode with Buffersize 150 ms
just to head up for anyone who needs to solve this issue:
(tested on libreelec and regular kodi on linux machine as well)
you need to do two edits:
1:
.kodi/addons/plugin.audio.squeezebox/resources/lib/player_monitor.py
comment this section
Code:
def onPlayBackStopped(self):
'''Kodi event fired when playback is stopped'''
if self.is_playing:
self.lmsserver.stop()
log_msg("playback stopped")
self.is_playing = False
2:
.kodi/addons/plugin.audio.squeezebox/resources/lib/main_service.py
Code:
elif self.lmsserver.status["title"] != xbmc.getInfoLabel("MusicPlayer.Title").decode("utf-8")
change to
Code:
elif self.lmsserver.status["title"].strip() != xbmc.getInfoLabel("MusicPlayer.Title").decode("utf-8")
it still throws demuxer errors into log, but playback is not interrupted and everything works!
I commented that section out but it resulted in not being able to stop playback at all.
It seems that xbmc.player calls the OnPlayBackStopped function if play is called while already playing.
I made below changes and it seems to work fine so far. I also had an issue with the playlist not always being updated. Maybe you can test it. I'd refine it a bit and then maybe write a pull request.
To test, put below content into a file, e.g. patch.txt and then apply patch -p1 < patch.txt from the .kodi/addons/ folder
Code:
diff -x '.*' -ruN ./plugin.audio.squeezebox/resources/lib/main_service.py .kodi/addons/plugin.audio.squeezebox/resources/lib/main_service.py
--- ./plugin.audio.squeezebox/resources/lib/main_service.py 2020-11-16 19:23:13.119458346 +0100
+++ .kodi/addons/plugin.audio.squeezebox/resources/lib/main_service.py 2020-11-16 19:16:19.090921696 +0100
@@ -139,12 +139,14 @@
self._prev_checksum = self.lmsserver.timestamp
log_msg("playlist changed on lms server")
self.kodiplayer.update_playlist()
- self.kodiplayer.play(self.kodiplayer.playlist, startpos=self.lmsserver.cur_index)
+ # self.kodiplayer.play(self.kodiplayer.playlist, startpos=self.lmsserver.cur_index) # Don't start playing again
elif not self.kodiplayer.is_playing and self.lmsserver.mode == "play":
# playback started
log_msg("play started by lms server")
- if not len(self.kodiplayer.playlist):
- self.kodiplayer.update_playlist()
+ self._prev_checksum = self.lmsserver.timestamp # Set Timestemp on start of playing
+ self.kodiplayer.update_playlist() # Update playlist on start of playing
+ # if not len(self.kodiplayer.playlist):
+ # self.kodiplayer.update_playlist()
self.kodiplayer.play(self.kodiplayer.playlist, startpos=self.lmsserver.cur_index)
elif self.kodiplayer.is_playing:
@@ -158,6 +160,7 @@
log_msg("Playlist is randomized! Reload to unshuffle....")
self.kodiplayer.playlist.unshuffle()
self.kodiplayer.update_playlist()
+ self.kodiplayer.is_playing = False # it seems that xbmc.player calls the OnPlayBackStopped function if the play function is called while already playing.
self.kodiplayer.play(self.kodiplayer.playlist, startpos=self.lmsserver.cur_index)
elif xbmc.getCondVisibility("Player.Paused") and self.lmsserver.mode == "play":
# playback resumed
@@ -169,12 +172,15 @@
self.kodiplayer.pause()
elif self.kodiplayer.playlist.getposition() != self.lmsserver.cur_index:
# other track requested
+ self.kodiplayer.is_playing = False # it seems that xbmc.player calls the OnPlayBackStopped function if the play function is called while already playing.
log_msg("other track requested by lms server")
self.kodiplayer.play(self.kodiplayer.playlist, startpos=self.lmsserver.cur_index)
elif self.lmsserver.status["title"] != xbmc.getInfoLabel("MusicPlayer.Title").decode("utf-8"):
# monitor if title still matches
log_msg("title mismatch - updating playlist...")
self.kodiplayer.update_playlist()
+ log_msg("other track requested by lms server")
+ self.kodiplayer.is_playing = False # it seems that xbmc.player calls the OnPlayBackStopped function if the play function is called while already playing.
self.kodiplayer.play(self.kodiplayer.playlist, startpos=self.lmsserver.cur_index)
elif self.lmsserver.mode == "play" and not self.lmsserver.status["current_title"]:
# check if seeking is needed - if current_title has value, it means it's a radio stream so we ignore that
diff -x '.*' -ruN ./plugin.audio.squeezebox/resources/lib/player_monitor.py .kodi/addons/plugin.audio.squeezebox/resources/lib/player_monitor.py
--- ./plugin.audio.squeezebox/resources/lib/player_monitor.py 2020-11-16 19:23:13.119458346 +0100
+++ .kodi/addons/plugin.audio.squeezebox/resources/lib/player_monitor.py 2020-11-15 17:51:37.529612468 +0100
@@ -129,9 +129,11 @@
def update_playlist(self):
'''Update the playlist'''
lmsplaylist = self.lmsserver.cur_playlist(True)
- if len(self.playlist) > len(lmsplaylist):
- log_msg("clearing playlist...")
- self.playlist.clear()
+ log_msg("clearing playlist...") #
+ self.playlist.clear() # Always clear playlist if requested, don't compare size
+# if len(self.playlist) > len(lmsplaylist):
+# log_msg("clearing playlist...")
+# self.playlist.clear()
for item in lmsplaylist:
li, file_name = self.create_listitem(item)
self.playlist.add(file_name, li, item["playlist index"])