Skip to content

Commit

Permalink
Fix remote streams not triggering track events (#842)
Browse files Browse the repository at this point in the history
* Fix remote streams not triggering track events
  • Loading branch information
eri-trabiccolo committed Feb 14, 2023
1 parent 26da151 commit cbdbd09
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions xl/player/gst/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import logging
import os
import urllib.parse
import copy

from xl import common
from xl import event
Expand Down Expand Up @@ -633,9 +634,12 @@ def on_message(self, bus, message):
Useful for streams and files mutagen doesn't understand."""

current = self.current_track

remote_newsong = False
if not current.is_local():
gst_utils.parse_stream_tags(current, message.parse_tag())
prior_track = copy.deepcopy(current)
remote_newsong = gst_utils.parse_stream_tags(
current, message.parse_tag()
)

if current and not current.get_tag_raw('__length'):
res, raw_duration = self.playbin.query_duration(Gst.Format.TIME)
Expand All @@ -646,6 +650,10 @@ def on_message(self, bus, message):
if duration > 0:
current.set_tag_raw('__length', duration)

if remote_newsong:
self.engine.player.engine_notify_track_end(prior_track, False)
self.engine.player.engine_notify_track_start(current)

elif (
message.type == Gst.MessageType.EOS
and not self.get_gst_state() == Gst.State.PAUSED
Expand Down

0 comments on commit cbdbd09

Please sign in to comment.