Add Video.audioStreams() convenience method (#891)

* Add Video.audioStreams() convenience method

* Add test for Video.audioStreams()
This commit is contained in:
JonnyWong16 2022-02-26 22:24:43 -08:00 committed by GitHub
parent 3e57c9b262
commit 87a7ec6ddf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -111,6 +111,15 @@ class Video(PlexPartialObject):
""" Returns str, default title for a new syncItem. """
return self.title
def audioStreams(self):
""" Returns a list of :class:`~plexapi.media.AudioStream` objects for all MediaParts. """
streams = []
parts = self.iterParts()
for part in parts:
streams += part.audioStreams()
return streams
def subtitleStreams(self):
""" Returns a list of :class:`~plexapi.media.SubtitleStream` objects for all MediaParts. """
streams = []

View file

@ -361,11 +361,16 @@ def test_video_Movie_download(monkeydownload, tmpdir, movie):
assert filename in with_resolution[0]
def test_video_Movie_subtitlestreams(movie):
def test_video_Movie_audioStreams(movie):
movie.reload()
assert movie.audioStreams()
def test_video_Movie_subtitleStreams(movie):
assert not movie.subtitleStreams()
def test_video_Episode_subtitlestreams(episode):
def test_video_Episode_subtitleStreams(episode):
assert not episode.subtitleStreams()