Merge pull request #258 from elelay/gtk3-mpris-listener

python3 mpris listener fix
This commit is contained in:
Eric Le Lay 2017-04-15 20:13:03 +02:00 committed by GitHub
commit 83718c9ff8
2 changed files with 2 additions and 6 deletions

View File

@ -42,7 +42,7 @@ TrackInfo = collections.namedtuple('TrackInfo',
['uri', 'length', 'status', 'pos', 'rate'])
def subsecond_difference(usec1, usec2):
return abs(usec1 - usec2) < USECS_IN_SEC
return usec1 is not None and usec2 is not None and abs(usec1 - usec2) < USECS_IN_SEC
class CurrentTrackTracker(object):
'''An instance of this class is responsible for tracking the state of the
@ -124,6 +124,7 @@ class CurrentTrackTracker(object):
self.notify_stop()
if ( (kwargs['pos']) == 0
and self.pos is not None
and self.pos > (self.length - USECS_IN_SEC)
and self.pos < (self.length + 2 * USECS_IN_SEC)
):

View File

@ -77,11 +77,6 @@ class MediaPlayerDBusReceiver(object):
pass
def on_playback_stopped(self, start, end, total, file_uri):
# Assume the URI comes as quoted UTF-8 string, so decode
# it first to utf-8 (should be no problem) for unquoting
# to work correctly on this later on (Maemo bug 11811)
if isinstance(file_uri, str):
file_uri = file_uri.encode('utf-8')
if file_uri.startswith('/'):
file_uri = 'file://' + urllib.parse.quote(file_uri)
self.on_play_event(start, end, total, file_uri)