forked from platypush/platypush
Merge branch 'master' into 391/improve-youtube-support
This commit is contained in:
commit
5ff839919c
3 changed files with 16 additions and 4 deletions
Binary file not shown.
|
@ -468,10 +468,12 @@ class MediaMpvPlugin(MediaPlugin):
|
|||
'audio_channels': getattr(self._player, 'audio_channels', None),
|
||||
'audio_codec': getattr(self._player, 'audio_codec_name', 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)
|
||||
if getattr(self._player, 'playtime_remaining', None)
|
||||
else None,
|
||||
else None
|
||||
),
|
||||
'filename': getattr(self._player, 'filename', None),
|
||||
'file_size': getattr(self._player, 'file_size', None),
|
||||
'fullscreen': getattr(self._player, 'fs', None),
|
||||
|
|
|
@ -199,12 +199,22 @@ class PipedPlaylistSchema(Schema):
|
|||
},
|
||||
)
|
||||
|
||||
url = fields.Url(
|
||||
metadata={
|
||||
'description': 'Playlist URL',
|
||||
'example': 'https://youtube.com/playlist?list=1234567890',
|
||||
},
|
||||
)
|
||||
|
||||
@pre_dump
|
||||
def fill_urls(self, data: dict, **_):
|
||||
for attr in ('url', 'uploaderUrl'):
|
||||
if data.get(attr) and not data[attr].startswith('https://'):
|
||||
data[attr] = f'https://youtube.com{data[attr]}'
|
||||
|
||||
if not data.get('id') and data.get('url'):
|
||||
data['id'] = data['url'].split('=')[-1]
|
||||
|
||||
return data
|
||||
|
||||
@pre_dump
|
||||
|
|
Loading…
Reference in a new issue