[media.mpv] Fix for media duration if playback_time is not available.

This commit is contained in:
Fabio Manganiello 2024-07-12 03:11:30 +02:00
parent 9b42815d77
commit c8fa53e62f
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -468,10 +468,12 @@ class MediaMpvPlugin(MediaPlugin):
'audio_channels': getattr(self._player, 'audio_channels', None), 'audio_channels': getattr(self._player, 'audio_channels', None),
'audio_codec': getattr(self._player, 'audio_codec_name', None), 'audio_codec': getattr(self._player, 'audio_codec_name', None),
'delay': getattr(self._player, 'delay', None), 'delay': getattr(self._player, 'delay', None),
'duration': getattr(self._player, 'playback_time', 0) 'duration': (
(getattr(self._player, 'playback_time', 0) or 0)
+ getattr(self._player, 'playtime_remaining', 0) + getattr(self._player, 'playtime_remaining', 0)
if getattr(self._player, 'playtime_remaining', None) if getattr(self._player, 'playtime_remaining', None)
else None, else None
),
'filename': getattr(self._player, 'filename', None), 'filename': getattr(self._player, 'filename', None),
'file_size': getattr(self._player, 'file_size', None), 'file_size': getattr(self._player, 'file_size', None),
'fullscreen': getattr(self._player, 'fs', None), 'fullscreen': getattr(self._player, 'fs', None),