python-plexapi/tests/test_video.py

1041 lines
36 KiB
Python
Raw Normal View History

2017-01-09 14:21:54 +00:00
# -*- coding: utf-8 -*-
2020-04-15 22:30:00 +00:00
import os
2017-02-15 02:57:09 +00:00
from datetime import datetime
from time import sleep
2020-05-12 21:26:29 +00:00
from urllib.parse import quote_plus
2020-04-14 20:13:30 +00:00
import pytest
2017-02-14 05:35:13 +00:00
from plexapi.exceptions import BadRequest, NotFound
2020-04-14 20:13:30 +00:00
from . import conftest as utils
2021-01-24 23:03:23 +00:00
from . import test_mixins
2017-01-29 21:22:48 +00:00
2017-01-09 14:21:54 +00:00
def test_video_Movie(movies, movie):
movie2 = movies.get(movie.title)
assert movie2.title == movie.title
2017-01-09 14:21:54 +00:00
2020-04-15 22:30:00 +00:00
2017-10-07 20:14:22 +00:00
def test_video_Movie_attributeerror(movie):
with pytest.raises(AttributeError):
movie.asshat
2020-04-15 22:30:00 +00:00
2017-10-13 23:46:09 +00:00
def test_video_ne(movies):
2020-04-29 21:23:22 +00:00
assert (
len(
movies.fetchItems(
"/library/sections/%s/all" % movies.key, title__ne="Sintel"
)
)
== 3
)
2017-10-13 23:46:09 +00:00
2017-10-26 21:55:59 +00:00
def test_video_Movie_delete(movie, patched_http_call):
movie.delete()
2020-05-01 21:06:29 +00:00
def test_video_Movie_merge(movie, patched_http_call):
movie.merge(1337)
2021-01-24 23:03:23 +00:00
def test_video_Movie_mixins_tags(movie):
test_mixins.edit_collection(movie)
test_mixins.edit_country(movie)
test_mixins.edit_director(movie)
test_mixins.edit_genre(movie)
test_mixins.edit_label(movie)
test_mixins.edit_producer(movie)
test_mixins.edit_writer(movie)
2017-02-02 04:47:22 +00:00
Improvements in tests process (#297) * lets begin * skip plexpass tests if there is not plexpass on account * test new myplex attrubutes * bootstrap: proper photos organisation * fix rest of photos tests * fix myplex new attributes test * fix music bootstrap by setting agent to lastfm * fix sync tests * increase bootstrap timeout * remove timeout from .travis.yml * do not create playlist-style photoalbums in plex-bootstraptest.py * allow negative filtering in LibrarySection.search() * fix sync tests once again * use sendCrashReports in test_settings * fix test_settings * fix test_video * do not accept eula in bootstrap * fix PlexServer.isLatest() * add test against old version of PlexServer * fix MyPlexAccount.OutOut * add flag for one-time testing in Travis * fix test_library onDeck tests * fix more tests * use tqdm in plex-bootstraptest for media scanning progress * create sections one-by-one * update docs on AlertListener for timeline entries * fix plex-bootstraptest for server version 1.3.2 * display skip/xpass/xfail reasons * fix tests on 1.3 * wait for music to be fully processed in plex-bootstraptest * fix misplaced TEST_ACCOUNT_ONCE * fix test_myplex_users, not sure if in proper-way * add pytest-rerunfailures; mark test_myplex_optout as flaky * fix comment * Revert "add pytest-rerunfailures; mark test_myplex_optout as flaky" This reverts commit 580e4c95a758c92329d757eb2f3fc3bf44b26f09. * restart plex container on failure * add conftest.wait_until() and used where some retries are required * add more wait_until() usage in test_sync * fix managed user search * fix updating managed users in myplex * allow to add new servers to existent users * add new server to a shared user while bootstrapping * add some docs on testing process * perform few attemps when unable to get the claim token * unlock websocket-client in requirements_dev * fix docblock in tools/plex-teardowntest * do not hardcode mediapart size in test_video * remove cache:pip from travis * Revert "unlock websocket-client in requirements_dev" This reverts commit 0d536bd06dbdc4a4b869a1686f8cd008898859fe. * remove debug from server.py * improve webhook tests * fix type() check to isinstance() * remove excessive `else` branch due to Hellowlol advice * add `unknown` as allowed `myPlexMappingState` in test_server
2018-09-14 18:03:23 +00:00
def test_video_Movie_getStreamURL(movie, account):
key = movie.ratingKey
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert movie.getStreamURL() == (
"{0}/video/:/transcode/universal/start.m3u8?"
"X-Plex-Platform=Chrome&copyts=1&mediaIndex=0&"
"offset=0&path=%2Flibrary%2Fmetadata%2F{1}&X-Plex-Token={2}").format(
2020-04-29 21:23:22 +00:00
utils.SERVER_BASEURL, key, account.authenticationToken
) # noqa
assert movie.getStreamURL(
videoResolution="800x600"
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
) == ("{0}/video/:/transcode/universal/start.m3u8?"
"X-Plex-Platform=Chrome&copyts=1&mediaIndex=0&"
"offset=0&path=%2Flibrary%2Fmetadata%2F{1}&videoResolution=800x600&X-Plex-Token={2}").format(
2020-04-29 21:23:22 +00:00
utils.SERVER_BASEURL, key, account.authenticationToken
) # noqa
2017-01-09 14:21:54 +00:00
2017-02-02 04:47:22 +00:00
def test_video_Movie_isFullObject_and_reload(plex):
2020-04-29 21:23:22 +00:00
movie = plex.library.section("Movies").get("Sita Sings the Blues")
2017-01-09 14:21:54 +00:00
assert movie.isFullObject() is False
movie.reload(checkFiles=False)
assert movie.isFullObject() is False
2017-01-09 14:21:54 +00:00
movie.reload()
assert movie.isFullObject() is True
movie_via_search = plex.library.search(movie.title)[0]
2017-01-09 14:21:54 +00:00
assert movie_via_search.isFullObject() is False
movie_via_search.reload()
assert movie_via_search.isFullObject() is True
2020-04-29 21:23:22 +00:00
movie_via_section_search = plex.library.section("Movies").search(movie.title)[0]
2017-01-09 14:21:54 +00:00
assert movie_via_section_search.isFullObject() is False
movie_via_section_search.reload()
assert movie_via_section_search.isFullObject() is True
# If the verify that the object has been reloaded. xml from search only returns 3 actors.
assert len(movie_via_section_search.roles) >= 3
2017-01-09 14:21:54 +00:00
def test_video_Movie_isPartialObject(movie):
assert movie.isPartialObject()
2017-10-26 21:55:59 +00:00
def test_video_Movie_delete_part(movie, mocker):
# we need to reload this as there is a bug in part.delete
# See https://github.com/pkkid/python-plexapi/issues/201
m = movie.reload()
for media in m.media:
2017-10-28 20:58:47 +00:00
with utils.callable_http_patch():
media.delete()
2017-10-26 21:55:59 +00:00
def test_video_Movie_iterParts(movie):
assert len(list(movie.iterParts())) >= 1
def test_video_Movie_download(monkeydownload, tmpdir, movie):
filepaths1 = movie.download(savepath=str(tmpdir))
assert len(filepaths1) >= 1
2020-04-29 21:23:22 +00:00
filepaths2 = movie.download(savepath=str(tmpdir), videoResolution="500x300")
assert len(filepaths2) >= 1
2017-10-25 21:43:23 +00:00
def test_video_Movie_subtitlestreams(movie):
assert not movie.subtitleStreams()
2020-04-15 22:30:00 +00:00
def test_video_Episode_subtitlestreams(episode):
assert not episode.subtitleStreams()
2020-04-15 22:30:00 +00:00
def test_video_Movie_upload_select_remove_subtitle(movie, subtitle):
2020-04-15 22:30:00 +00:00
filepath = os.path.realpath(subtitle.name)
movie.uploadSubtitles(filepath)
2020-04-15 22:30:00 +00:00
movie.reload()
subtitles = [sub.title for sub in movie.subtitleStreams()]
2020-04-29 21:23:22 +00:00
subname = subtitle.name.rsplit(".", 1)[0]
assert subname in subtitles
subtitleSelection = movie.subtitleStreams()[0]
parts = [part for part in movie.iterParts()]
parts[0].setDefaultSubtitleStream(subtitleSelection)
2020-04-15 22:30:00 +00:00
movie.reload()
subtitleSelection = movie.subtitleStreams()[0]
assert subtitleSelection.selected
movie.removeSubtitles(streamTitle=subname)
2020-04-15 22:30:00 +00:00
movie.reload()
subtitles = [sub.title for sub in movie.subtitleStreams()]
assert subname not in subtitles
2020-04-15 22:30:00 +00:00
try:
os.remove(filepath)
2020-04-15 22:30:00 +00:00
except:
pass
2017-10-25 21:43:23 +00:00
def test_video_Movie_attrs(movies):
2020-04-29 21:23:22 +00:00
movie = movies.get("Sita Sings the Blues")
2020-12-24 07:03:08 +00:00
assert len(movie.locations) == 1
assert len(movie.locations[0]) >= 10
assert utils.is_datetime(movie.addedAt)
assert utils.is_metadata(movie.art)
assert movie.artUrl
assert float(movie.rating) >= 6.4
assert movie.ratingImage == 'rottentomatoes://image.rating.ripe'
assert movie.audienceRating >= 8.5
assert movie.audienceRatingImage == 'rottentomatoes://image.rating.upright'
movie.reload() # RELOAD
assert movie.chapterSource is None
assert not movie.collections
assert movie.contentRating in utils.CONTENTRATINGS
if movie.countries:
assert "United States of America" in [i.tag for i in movie.countries]
if movie.producers:
assert "Nina Paley" in [i.tag for i in movie.producers]
if movie.directors:
assert "Nina Paley" in [i.tag for i in movie.directors]
if movie.roles:
assert "Reena Shah" in [i.tag for i in movie.roles]
if movie.writers:
assert "Nina Paley" in [i.tag for i in movie.writers]
2017-04-23 05:54:53 +00:00
assert movie.duration >= 160000
assert not movie.fields
assert movie.posters()
assert "Animation" in [i.tag for i in movie.genres]
assert "imdb://tt1172203" in [i.id for i in movie.guids]
assert movie.guid == "plex://movie/5d776846880197001ec967c6"
assert utils.is_metadata(movie._initpath)
assert utils.is_metadata(movie.key)
2020-10-08 20:15:43 +00:00
assert utils.is_datetime(movie.lastViewedAt)
assert int(movie.librarySectionID) >= 1
2020-04-29 21:23:22 +00:00
assert movie.listType == "video"
assert movie.originalTitle is None
2020-04-14 20:13:30 +00:00
assert utils.is_datetime(movie.originallyAvailableAt)
assert movie.playlistItemID is None
if movie.primaryExtraKey:
assert utils.is_metadata(movie.primaryExtraKey)
assert movie.ratingKey >= 1
assert movie._server._baseurl == utils.SERVER_BASEURL
assert movie.sessionKey is None
2020-04-29 21:23:22 +00:00
assert movie.studio == "Nina Paley"
assert utils.is_string(movie.summary, gte=100)
2020-04-29 21:23:22 +00:00
assert movie.tagline == "The Greatest Break-Up Story Ever Told"
assert utils.is_thumb(movie.thumb)
2020-04-29 21:23:22 +00:00
assert movie.title == "Sita Sings the Blues"
assert movie.titleSort == "Sita Sings the Blues"
2017-10-13 22:02:21 +00:00
assert not movie.transcodeSessions
2020-04-29 21:23:22 +00:00
assert movie.type == "movie"
assert movie.updatedAt > datetime(2017, 1, 1)
assert movie.userRating is None
assert movie.viewCount == 0
2017-04-23 05:54:53 +00:00
assert utils.is_int(movie.viewOffset, gte=0)
assert movie.viewedAt is None
assert movie.year == 2008
# Audio
audio = movie.media[0].parts[0].audioStreams()[0]
if audio.audioChannelLayout:
assert audio.audioChannelLayout in utils.AUDIOLAYOUTS
assert audio.bitDepth is None
assert utils.is_int(audio.bitrate)
assert audio.bitrateMode is None
assert audio.channels in utils.AUDIOCHANNELS
assert audio.codec in utils.CODECS
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert audio.default is True
assert audio.displayTitle == "Unknown (AAC Stereo)"
assert audio.duration is None
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert audio.extendedDisplayTitle == "Unknown (AAC Stereo)"
assert audio.id >= 1
assert audio.index == 1
assert utils.is_metadata(audio._initpath)
Improvements in tests process (#297) * lets begin * skip plexpass tests if there is not plexpass on account * test new myplex attrubutes * bootstrap: proper photos organisation * fix rest of photos tests * fix myplex new attributes test * fix music bootstrap by setting agent to lastfm * fix sync tests * increase bootstrap timeout * remove timeout from .travis.yml * do not create playlist-style photoalbums in plex-bootstraptest.py * allow negative filtering in LibrarySection.search() * fix sync tests once again * use sendCrashReports in test_settings * fix test_settings * fix test_video * do not accept eula in bootstrap * fix PlexServer.isLatest() * add test against old version of PlexServer * fix MyPlexAccount.OutOut * add flag for one-time testing in Travis * fix test_library onDeck tests * fix more tests * use tqdm in plex-bootstraptest for media scanning progress * create sections one-by-one * update docs on AlertListener for timeline entries * fix plex-bootstraptest for server version 1.3.2 * display skip/xpass/xfail reasons * fix tests on 1.3 * wait for music to be fully processed in plex-bootstraptest * fix misplaced TEST_ACCOUNT_ONCE * fix test_myplex_users, not sure if in proper-way * add pytest-rerunfailures; mark test_myplex_optout as flaky * fix comment * Revert "add pytest-rerunfailures; mark test_myplex_optout as flaky" This reverts commit 580e4c95a758c92329d757eb2f3fc3bf44b26f09. * restart plex container on failure * add conftest.wait_until() and used where some retries are required * add more wait_until() usage in test_sync * fix managed user search * fix updating managed users in myplex * allow to add new servers to existent users * add new server to a shared user while bootstrapping * add some docs on testing process * perform few attemps when unable to get the claim token * unlock websocket-client in requirements_dev * fix docblock in tools/plex-teardowntest * do not hardcode mediapart size in test_video * remove cache:pip from travis * Revert "unlock websocket-client in requirements_dev" This reverts commit 0d536bd06dbdc4a4b869a1686f8cd008898859fe. * remove debug from server.py * improve webhook tests * fix type() check to isinstance() * remove excessive `else` branch due to Hellowlol advice * add `unknown` as allowed `myPlexMappingState` in test_server
2018-09-14 18:03:23 +00:00
assert audio.language is None
assert audio.languageCode is None
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert audio.profile == "lc"
assert audio.requiredBandwidths is None or audio.requiredBandwidths
Improvements in tests process (#297) * lets begin * skip plexpass tests if there is not plexpass on account * test new myplex attrubutes * bootstrap: proper photos organisation * fix rest of photos tests * fix myplex new attributes test * fix music bootstrap by setting agent to lastfm * fix sync tests * increase bootstrap timeout * remove timeout from .travis.yml * do not create playlist-style photoalbums in plex-bootstraptest.py * allow negative filtering in LibrarySection.search() * fix sync tests once again * use sendCrashReports in test_settings * fix test_settings * fix test_video * do not accept eula in bootstrap * fix PlexServer.isLatest() * add test against old version of PlexServer * fix MyPlexAccount.OutOut * add flag for one-time testing in Travis * fix test_library onDeck tests * fix more tests * use tqdm in plex-bootstraptest for media scanning progress * create sections one-by-one * update docs on AlertListener for timeline entries * fix plex-bootstraptest for server version 1.3.2 * display skip/xpass/xfail reasons * fix tests on 1.3 * wait for music to be fully processed in plex-bootstraptest * fix misplaced TEST_ACCOUNT_ONCE * fix test_myplex_users, not sure if in proper-way * add pytest-rerunfailures; mark test_myplex_optout as flaky * fix comment * Revert "add pytest-rerunfailures; mark test_myplex_optout as flaky" This reverts commit 580e4c95a758c92329d757eb2f3fc3bf44b26f09. * restart plex container on failure * add conftest.wait_until() and used where some retries are required * add more wait_until() usage in test_sync * fix managed user search * fix updating managed users in myplex * allow to add new servers to existent users * add new server to a shared user while bootstrapping * add some docs on testing process * perform few attemps when unable to get the claim token * unlock websocket-client in requirements_dev * fix docblock in tools/plex-teardowntest * do not hardcode mediapart size in test_video * remove cache:pip from travis * Revert "unlock websocket-client in requirements_dev" This reverts commit 0d536bd06dbdc4a4b869a1686f8cd008898859fe. * remove debug from server.py * improve webhook tests * fix type() check to isinstance() * remove excessive `else` branch due to Hellowlol advice * add `unknown` as allowed `myPlexMappingState` in test_server
2018-09-14 18:03:23 +00:00
assert audio.samplingRate == 44100
assert audio.selected is True
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert audio.streamIdentifier == 2
assert audio.streamType == 2
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert audio._server._baseurl == utils.SERVER_BASEURL
assert audio.title is None
assert audio.type == 2
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
with pytest.raises(AttributeError):
assert audio.albumGain is None # Check track only attributes are not available
# Media
media = movie.media[0]
2017-04-29 05:47:21 +00:00
assert media.aspectRatio >= 1.3
assert media.audioChannels in utils.AUDIOCHANNELS
assert media.audioCodec in utils.CODECS
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert media.audioProfile == "lc"
assert utils.is_int(media.bitrate)
assert media.container in utils.CONTAINERS
2017-04-23 05:54:53 +00:00
assert utils.is_int(media.duration, gte=160000)
assert utils.is_int(media.height)
assert utils.is_int(media.id)
assert utils.is_metadata(media._initpath)
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert media.has64bitOffsets is False
assert media.optimizedForStreaming in [None, False, True]
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert media.proxyType is None
assert media._server._baseurl == utils.SERVER_BASEURL
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert media.target is None
assert media.title is None
assert media.videoCodec in utils.CODECS
assert media.videoFrameRate in utils.FRAMERATES
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert media.videoProfile == "main"
assert media.videoResolution in utils.RESOLUTIONS
assert utils.is_int(media.width, gte=200)
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
with pytest.raises(AttributeError):
assert media.aperture is None # Check photo only attributes are not available
# Video
video = movie.media[0].parts[0].videoStreams()[0]
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert video.anamorphic is None
2020-04-29 21:23:22 +00:00
assert video.bitDepth in (
8,
None,
) # Different versions of Plex Server return different values
assert utils.is_int(video.bitrate)
assert video.cabac is None
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert video.chromaLocation == "left"
2020-04-29 21:23:22 +00:00
assert video.chromaSubsampling in ("4:2:0", None)
assert video.codec in utils.CODECS
assert video.codecID is None
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert utils.is_int(video.codedHeight, gte=1080)
assert utils.is_int(video.codedWidth, gte=1920)
assert video.colorPrimaries is None
assert video.colorRange is None
Improvements in tests process (#297) * lets begin * skip plexpass tests if there is not plexpass on account * test new myplex attrubutes * bootstrap: proper photos organisation * fix rest of photos tests * fix myplex new attributes test * fix music bootstrap by setting agent to lastfm * fix sync tests * increase bootstrap timeout * remove timeout from .travis.yml * do not create playlist-style photoalbums in plex-bootstraptest.py * allow negative filtering in LibrarySection.search() * fix sync tests once again * use sendCrashReports in test_settings * fix test_settings * fix test_video * do not accept eula in bootstrap * fix PlexServer.isLatest() * add test against old version of PlexServer * fix MyPlexAccount.OutOut * add flag for one-time testing in Travis * fix test_library onDeck tests * fix more tests * use tqdm in plex-bootstraptest for media scanning progress * create sections one-by-one * update docs on AlertListener for timeline entries * fix plex-bootstraptest for server version 1.3.2 * display skip/xpass/xfail reasons * fix tests on 1.3 * wait for music to be fully processed in plex-bootstraptest * fix misplaced TEST_ACCOUNT_ONCE * fix test_myplex_users, not sure if in proper-way * add pytest-rerunfailures; mark test_myplex_optout as flaky * fix comment * Revert "add pytest-rerunfailures; mark test_myplex_optout as flaky" This reverts commit 580e4c95a758c92329d757eb2f3fc3bf44b26f09. * restart plex container on failure * add conftest.wait_until() and used where some retries are required * add more wait_until() usage in test_sync * fix managed user search * fix updating managed users in myplex * allow to add new servers to existent users * add new server to a shared user while bootstrapping * add some docs on testing process * perform few attemps when unable to get the claim token * unlock websocket-client in requirements_dev * fix docblock in tools/plex-teardowntest * do not hardcode mediapart size in test_video * remove cache:pip from travis * Revert "unlock websocket-client in requirements_dev" This reverts commit 0d536bd06dbdc4a4b869a1686f8cd008898859fe. * remove debug from server.py * improve webhook tests * fix type() check to isinstance() * remove excessive `else` branch due to Hellowlol advice * add `unknown` as allowed `myPlexMappingState` in test_server
2018-09-14 18:03:23 +00:00
assert video.colorSpace is None
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert video.colorTrc is None
assert video.default is True
assert video.displayTitle == "1080p (H.264)"
assert video.DOVIBLCompatID is None
assert video.DOVIBLPresent is None
assert video.DOVIELPresent is None
assert video.DOVILevel is None
assert video.DOVIPresent is None
assert video.DOVIProfile is None
assert video.DOVIRPUPresent is None
assert video.DOVIVersion is None
assert video.duration is None
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert video.extendedDisplayTitle == "1080p (H.264)"
assert utils.is_float(video.frameRate, gte=20.0)
assert video.frameRateMode is None
assert video.hasScallingMatrix is None
2017-04-29 05:47:21 +00:00
assert utils.is_int(video.height, gte=250)
assert utils.is_int(video.id)
assert utils.is_int(video.index, gte=0)
assert utils.is_metadata(video._initpath)
Improvements in tests process (#297) * lets begin * skip plexpass tests if there is not plexpass on account * test new myplex attrubutes * bootstrap: proper photos organisation * fix rest of photos tests * fix myplex new attributes test * fix music bootstrap by setting agent to lastfm * fix sync tests * increase bootstrap timeout * remove timeout from .travis.yml * do not create playlist-style photoalbums in plex-bootstraptest.py * allow negative filtering in LibrarySection.search() * fix sync tests once again * use sendCrashReports in test_settings * fix test_settings * fix test_video * do not accept eula in bootstrap * fix PlexServer.isLatest() * add test against old version of PlexServer * fix MyPlexAccount.OutOut * add flag for one-time testing in Travis * fix test_library onDeck tests * fix more tests * use tqdm in plex-bootstraptest for media scanning progress * create sections one-by-one * update docs on AlertListener for timeline entries * fix plex-bootstraptest for server version 1.3.2 * display skip/xpass/xfail reasons * fix tests on 1.3 * wait for music to be fully processed in plex-bootstraptest * fix misplaced TEST_ACCOUNT_ONCE * fix test_myplex_users, not sure if in proper-way * add pytest-rerunfailures; mark test_myplex_optout as flaky * fix comment * Revert "add pytest-rerunfailures; mark test_myplex_optout as flaky" This reverts commit 580e4c95a758c92329d757eb2f3fc3bf44b26f09. * restart plex container on failure * add conftest.wait_until() and used where some retries are required * add more wait_until() usage in test_sync * fix managed user search * fix updating managed users in myplex * allow to add new servers to existent users * add new server to a shared user while bootstrapping * add some docs on testing process * perform few attemps when unable to get the claim token * unlock websocket-client in requirements_dev * fix docblock in tools/plex-teardowntest * do not hardcode mediapart size in test_video * remove cache:pip from travis * Revert "unlock websocket-client in requirements_dev" This reverts commit 0d536bd06dbdc4a4b869a1686f8cd008898859fe. * remove debug from server.py * improve webhook tests * fix type() check to isinstance() * remove excessive `else` branch due to Hellowlol advice * add `unknown` as allowed `myPlexMappingState` in test_server
2018-09-14 18:03:23 +00:00
assert video.language is None
assert video.languageCode is None
assert utils.is_int(video.level)
assert video.profile in utils.PROFILES
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert video.pixelAspectRatio is None
assert video.pixelFormat is None
assert utils.is_int(video.refFrames)
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert video.requiredBandwidths is None or video.requiredBandwidths
2020-04-29 21:23:22 +00:00
assert video.scanType in ("progressive", None)
assert video.selected is False
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert video.streamType == 1
assert video.streamIdentifier == 1
assert video._server._baseurl == utils.SERVER_BASEURL
assert utils.is_int(video.streamType)
assert video.title is None
assert video.type == 1
assert utils.is_int(video.width, gte=400)
# Part
part = media.parts[0]
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert part.accessible
assert part.audioProfile == "lc"
assert part.container in utils.CONTAINERS
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert part.decision is None
assert part.deepAnalysisVersion is None or utils.is_int(part.deepAnalysisVersion)
assert utils.is_int(part.duration, gte=160000)
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert part.exists
assert len(part.file) >= 10
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert part.has64bitOffsets is False
assert part.hasThumbnail is None
assert utils.is_int(part.id)
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert part.indexes is None
assert utils.is_metadata(part._initpath)
assert len(part.key) >= 10
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert part.optimizedForStreaming is True
assert part.packetLength is None
assert part.requiredBandwidths is None or part.requiredBandwidths
assert utils.is_int(part.size, gte=1000000)
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
assert part.syncItemId is None
assert part.syncState is None
assert part._server._baseurl == utils.SERVER_BASEURL
assert part.videoProfile == "main"
# Stream 1
stream1 = part.streams[0]
Improvements in tests process (#297) * lets begin * skip plexpass tests if there is not plexpass on account * test new myplex attrubutes * bootstrap: proper photos organisation * fix rest of photos tests * fix myplex new attributes test * fix music bootstrap by setting agent to lastfm * fix sync tests * increase bootstrap timeout * remove timeout from .travis.yml * do not create playlist-style photoalbums in plex-bootstraptest.py * allow negative filtering in LibrarySection.search() * fix sync tests once again * use sendCrashReports in test_settings * fix test_settings * fix test_video * do not accept eula in bootstrap * fix PlexServer.isLatest() * add test against old version of PlexServer * fix MyPlexAccount.OutOut * add flag for one-time testing in Travis * fix test_library onDeck tests * fix more tests * use tqdm in plex-bootstraptest for media scanning progress * create sections one-by-one * update docs on AlertListener for timeline entries * fix plex-bootstraptest for server version 1.3.2 * display skip/xpass/xfail reasons * fix tests on 1.3 * wait for music to be fully processed in plex-bootstraptest * fix misplaced TEST_ACCOUNT_ONCE * fix test_myplex_users, not sure if in proper-way * add pytest-rerunfailures; mark test_myplex_optout as flaky * fix comment * Revert "add pytest-rerunfailures; mark test_myplex_optout as flaky" This reverts commit 580e4c95a758c92329d757eb2f3fc3bf44b26f09. * restart plex container on failure * add conftest.wait_until() and used where some retries are required * add more wait_until() usage in test_sync * fix managed user search * fix updating managed users in myplex * allow to add new servers to existent users * add new server to a shared user while bootstrapping * add some docs on testing process * perform few attemps when unable to get the claim token * unlock websocket-client in requirements_dev * fix docblock in tools/plex-teardowntest * do not hardcode mediapart size in test_video * remove cache:pip from travis * Revert "unlock websocket-client in requirements_dev" This reverts commit 0d536bd06dbdc4a4b869a1686f8cd008898859fe. * remove debug from server.py * improve webhook tests * fix type() check to isinstance() * remove excessive `else` branch due to Hellowlol advice * add `unknown` as allowed `myPlexMappingState` in test_server
2018-09-14 18:03:23 +00:00
assert stream1.bitDepth in (8, None)
assert utils.is_int(stream1.bitrate)
assert stream1.cabac is None
2020-04-29 21:23:22 +00:00
assert stream1.chromaSubsampling in ("4:2:0", None)
assert stream1.codec in utils.CODECS
Improvements in tests process (#297) * lets begin * skip plexpass tests if there is not plexpass on account * test new myplex attrubutes * bootstrap: proper photos organisation * fix rest of photos tests * fix myplex new attributes test * fix music bootstrap by setting agent to lastfm * fix sync tests * increase bootstrap timeout * remove timeout from .travis.yml * do not create playlist-style photoalbums in plex-bootstraptest.py * allow negative filtering in LibrarySection.search() * fix sync tests once again * use sendCrashReports in test_settings * fix test_settings * fix test_video * do not accept eula in bootstrap * fix PlexServer.isLatest() * add test against old version of PlexServer * fix MyPlexAccount.OutOut * add flag for one-time testing in Travis * fix test_library onDeck tests * fix more tests * use tqdm in plex-bootstraptest for media scanning progress * create sections one-by-one * update docs on AlertListener for timeline entries * fix plex-bootstraptest for server version 1.3.2 * display skip/xpass/xfail reasons * fix tests on 1.3 * wait for music to be fully processed in plex-bootstraptest * fix misplaced TEST_ACCOUNT_ONCE * fix test_myplex_users, not sure if in proper-way * add pytest-rerunfailures; mark test_myplex_optout as flaky * fix comment * Revert "add pytest-rerunfailures; mark test_myplex_optout as flaky" This reverts commit 580e4c95a758c92329d757eb2f3fc3bf44b26f09. * restart plex container on failure * add conftest.wait_until() and used where some retries are required * add more wait_until() usage in test_sync * fix managed user search * fix updating managed users in myplex * allow to add new servers to existent users * add new server to a shared user while bootstrapping * add some docs on testing process * perform few attemps when unable to get the claim token * unlock websocket-client in requirements_dev * fix docblock in tools/plex-teardowntest * do not hardcode mediapart size in test_video * remove cache:pip from travis * Revert "unlock websocket-client in requirements_dev" This reverts commit 0d536bd06dbdc4a4b869a1686f8cd008898859fe. * remove debug from server.py * improve webhook tests * fix type() check to isinstance() * remove excessive `else` branch due to Hellowlol advice * add `unknown` as allowed `myPlexMappingState` in test_server
2018-09-14 18:03:23 +00:00
assert stream1.colorSpace is None
assert stream1.duration is None
assert utils.is_float(stream1.frameRate, gte=20.0)
assert stream1.frameRateMode is None
assert stream1.hasScallingMatrix is None
2017-04-29 05:47:21 +00:00
assert utils.is_int(stream1.height, gte=250)
assert utils.is_int(stream1.id)
assert utils.is_int(stream1.index, gte=0)
assert utils.is_metadata(stream1._initpath)
Improvements in tests process (#297) * lets begin * skip plexpass tests if there is not plexpass on account * test new myplex attrubutes * bootstrap: proper photos organisation * fix rest of photos tests * fix myplex new attributes test * fix music bootstrap by setting agent to lastfm * fix sync tests * increase bootstrap timeout * remove timeout from .travis.yml * do not create playlist-style photoalbums in plex-bootstraptest.py * allow negative filtering in LibrarySection.search() * fix sync tests once again * use sendCrashReports in test_settings * fix test_settings * fix test_video * do not accept eula in bootstrap * fix PlexServer.isLatest() * add test against old version of PlexServer * fix MyPlexAccount.OutOut * add flag for one-time testing in Travis * fix test_library onDeck tests * fix more tests * use tqdm in plex-bootstraptest for media scanning progress * create sections one-by-one * update docs on AlertListener for timeline entries * fix plex-bootstraptest for server version 1.3.2 * display skip/xpass/xfail reasons * fix tests on 1.3 * wait for music to be fully processed in plex-bootstraptest * fix misplaced TEST_ACCOUNT_ONCE * fix test_myplex_users, not sure if in proper-way * add pytest-rerunfailures; mark test_myplex_optout as flaky * fix comment * Revert "add pytest-rerunfailures; mark test_myplex_optout as flaky" This reverts commit 580e4c95a758c92329d757eb2f3fc3bf44b26f09. * restart plex container on failure * add conftest.wait_until() and used where some retries are required * add more wait_until() usage in test_sync * fix managed user search * fix updating managed users in myplex * allow to add new servers to existent users * add new server to a shared user while bootstrapping * add some docs on testing process * perform few attemps when unable to get the claim token * unlock websocket-client in requirements_dev * fix docblock in tools/plex-teardowntest * do not hardcode mediapart size in test_video * remove cache:pip from travis * Revert "unlock websocket-client in requirements_dev" This reverts commit 0d536bd06dbdc4a4b869a1686f8cd008898859fe. * remove debug from server.py * improve webhook tests * fix type() check to isinstance() * remove excessive `else` branch due to Hellowlol advice * add `unknown` as allowed `myPlexMappingState` in test_server
2018-09-14 18:03:23 +00:00
assert stream1.language is None
assert stream1.languageCode is None
assert utils.is_int(stream1.level)
assert stream1.profile in utils.PROFILES
assert utils.is_int(stream1.refFrames)
2020-04-29 21:23:22 +00:00
assert stream1.scanType in ("progressive", None)
assert stream1.selected is False
assert stream1._server._baseurl == utils.SERVER_BASEURL
assert utils.is_int(stream1.streamType)
assert stream1.title is None
assert stream1.type == 1
assert utils.is_int(stream1.width, gte=400)
# Stream 2
stream2 = part.streams[1]
if stream2.audioChannelLayout:
assert stream2.audioChannelLayout in utils.AUDIOLAYOUTS
assert stream2.bitDepth is None
assert utils.is_int(stream2.bitrate)
assert stream2.bitrateMode is None
assert stream2.channels in utils.AUDIOCHANNELS
assert stream2.codec in utils.CODECS
assert stream2.duration is None
assert utils.is_int(stream2.id)
assert utils.is_int(stream2.index)
assert utils.is_metadata(stream2._initpath)
Improvements in tests process (#297) * lets begin * skip plexpass tests if there is not plexpass on account * test new myplex attrubutes * bootstrap: proper photos organisation * fix rest of photos tests * fix myplex new attributes test * fix music bootstrap by setting agent to lastfm * fix sync tests * increase bootstrap timeout * remove timeout from .travis.yml * do not create playlist-style photoalbums in plex-bootstraptest.py * allow negative filtering in LibrarySection.search() * fix sync tests once again * use sendCrashReports in test_settings * fix test_settings * fix test_video * do not accept eula in bootstrap * fix PlexServer.isLatest() * add test against old version of PlexServer * fix MyPlexAccount.OutOut * add flag for one-time testing in Travis * fix test_library onDeck tests * fix more tests * use tqdm in plex-bootstraptest for media scanning progress * create sections one-by-one * update docs on AlertListener for timeline entries * fix plex-bootstraptest for server version 1.3.2 * display skip/xpass/xfail reasons * fix tests on 1.3 * wait for music to be fully processed in plex-bootstraptest * fix misplaced TEST_ACCOUNT_ONCE * fix test_myplex_users, not sure if in proper-way * add pytest-rerunfailures; mark test_myplex_optout as flaky * fix comment * Revert "add pytest-rerunfailures; mark test_myplex_optout as flaky" This reverts commit 580e4c95a758c92329d757eb2f3fc3bf44b26f09. * restart plex container on failure * add conftest.wait_until() and used where some retries are required * add more wait_until() usage in test_sync * fix managed user search * fix updating managed users in myplex * allow to add new servers to existent users * add new server to a shared user while bootstrapping * add some docs on testing process * perform few attemps when unable to get the claim token * unlock websocket-client in requirements_dev * fix docblock in tools/plex-teardowntest * do not hardcode mediapart size in test_video * remove cache:pip from travis * Revert "unlock websocket-client in requirements_dev" This reverts commit 0d536bd06dbdc4a4b869a1686f8cd008898859fe. * remove debug from server.py * improve webhook tests * fix type() check to isinstance() * remove excessive `else` branch due to Hellowlol advice * add `unknown` as allowed `myPlexMappingState` in test_server
2018-09-14 18:03:23 +00:00
assert stream2.language is None
assert stream2.languageCode is None
assert utils.is_int(stream2.samplingRate)
assert stream2.selected is True
assert stream2._server._baseurl == utils.SERVER_BASEURL
assert stream2.streamType == 2
assert stream2.title is None
assert stream2.type == 2
def test_video_Movie_history(movie):
movie.markWatched()
history = movie.history()
assert len(history)
movie.markUnwatched()
2020-05-05 02:11:41 +00:00
def test_video_Movie_match(movies):
sectionAgent = movies.agent
sectionAgents = [agent.identifier for agent in movies.agents() if agent.shortIdentifier != 'none']
sectionAgents.remove(sectionAgent)
altAgent = sectionAgents[0]
movie = movies.all()[0]
title = movie.title
year = str(movie.year)
titleUrlEncode = quote_plus(title)
def parse_params(key):
params = key.split('?', 1)[1]
params = params.split("&")
return {x.split("=")[0]: x.split("=")[1] for x in params}
results = movie.matches(title="", year="")
if results:
initpath = results[0]._initpath
assert initpath.startswith(movie.key)
params = initpath.split(movie.key)[1]
parsedParams = parse_params(params)
assert parsedParams.get('manual') == '1'
assert parsedParams.get('title') == ""
assert parsedParams.get('year') == ""
assert parsedParams.get('agent') == sectionAgent
else:
assert len(results) == 0
results = movie.matches(title=title, year="", agent=sectionAgent)
if results:
initpath = results[0]._initpath
assert initpath.startswith(movie.key)
params = initpath.split(movie.key)[1]
parsedParams = parse_params(params)
assert parsedParams.get('manual') == '1'
assert parsedParams.get('title') == titleUrlEncode
assert parsedParams.get('year') == ""
assert parsedParams.get('agent') == sectionAgent
else:
assert len(results) == 0
results = movie.matches(title=title, agent=sectionAgent)
if results:
initpath = results[0]._initpath
assert initpath.startswith(movie.key)
params = initpath.split(movie.key)[1]
parsedParams = parse_params(params)
assert parsedParams.get('manual') == '1'
assert parsedParams.get('title') == titleUrlEncode
assert parsedParams.get('year') == year
assert parsedParams.get('agent') == sectionAgent
else:
assert len(results) == 0
results = movie.matches(title="", year="")
if results:
initpath = results[0]._initpath
assert initpath.startswith(movie.key)
params = initpath.split(movie.key)[1]
parsedParams = parse_params(params)
assert parsedParams.get('manual') == '1'
assert parsedParams.get('agent') == sectionAgent
else:
assert len(results) == 0
results = movie.matches(title="", year="", agent=altAgent)
if results:
initpath = results[0]._initpath
assert initpath.startswith(movie.key)
params = initpath.split(movie.key)[1]
parsedParams = parse_params(params)
assert parsedParams.get('manual') == '1'
assert parsedParams.get('agent') == altAgent
else:
assert len(results) == 0
results = movie.matches(agent=altAgent)
if results:
initpath = results[0]._initpath
assert initpath.startswith(movie.key)
params = initpath.split(movie.key)[1]
parsedParams = parse_params(params)
assert parsedParams.get('manual') == '1'
assert parsedParams.get('agent') == altAgent
else:
assert len(results) == 0
results = movie.matches()
if results:
initpath = results[0]._initpath
assert initpath.startswith(movie.key)
params = initpath.split(movie.key)[1]
parsedParams = parse_params(params)
assert parsedParams.get('manual') == '1'
else:
assert len(results) == 0
def test_video_Movie_hubs(movies):
movie = movies.get('Big Buck Bunny')
hubs = movie.hubs()
assert len(hubs)
hub = hubs[0]
assert hub.context == "hub.movie.similar"
assert utils.is_metadata(hub.hubKey)
assert hub.hubIdentifier == "movie.similar"
assert len(hub.items) == hub.size
assert utils.is_metadata(hub.key)
assert hub.more is False
assert hub.size == 1
assert hub.style in (None, "shelf")
assert hub.title == "Related Movies"
assert hub.type == "movie"
assert len(hub) == hub.size
# Force hub reload
hub.more = True
hub.reload()
assert len(hub.items) == hub.size
assert hub.more is False
assert hub.size == 1
def test_video_Show(show):
2020-04-29 21:23:22 +00:00
assert show.title == "Game of Thrones"
def test_video_Episode_unmatch(episode, patched_http_call):
episode.unmatch()
def test_video_Episode_updateProgress(episode, patched_http_call):
episode.updateProgress(10 * 60 * 1000) # 10 minutes.
2019-09-21 21:17:35 +00:00
2018-05-14 18:12:29 +00:00
def test_video_Episode_updateTimeline(episode, patched_http_call):
2020-04-29 21:23:22 +00:00
episode.updateTimeline(
10 * 60 * 1000, state="playing", duration=episode.duration
) # 10 minutes.
2019-09-21 21:17:35 +00:00
def test_video_Episode_stop(episode, mocker, patched_http_call):
2020-04-29 21:23:22 +00:00
mocker.patch.object(
episode, "session", return_value=list(mocker.MagicMock(id="hello"))
)
episode.stop(reason="It's past bedtime!")
def test_video_Show_attrs(show):
2017-04-29 05:47:21 +00:00
assert utils.is_datetime(show.addedAt)
2020-04-29 21:23:22 +00:00
assert utils.is_metadata(show.art, contains="/art/")
assert utils.is_metadata(show.banner, contains="/banner/")
assert utils.is_int(show.childCount)
assert show.contentRating in utils.CONTENTRATINGS
assert utils.is_int(show.duration, gte=1600000)
assert utils.is_section(show._initpath)
# Check reloading the show loads the full list of genres
2020-04-29 21:23:22 +00:00
assert not {"Adventure", "Drama"} - {i.tag for i in show.genres}
show.reload()
2020-04-29 21:23:22 +00:00
assert sorted([i.tag for i in show.genres]) == ["Adventure", "Drama", "Fantasy"]
2017-01-09 14:21:54 +00:00
# So the initkey should have changed because of the reload
assert utils.is_metadata(show._initpath)
assert utils.is_int(show.index)
assert utils.is_metadata(show.key)
2020-10-08 20:15:43 +00:00
assert utils.is_datetime(show.lastViewedAt)
assert utils.is_int(show.leafCount)
2020-04-29 21:23:22 +00:00
assert show.listType == "video"
2020-12-24 07:03:08 +00:00
assert len(show.locations) == 1
assert len(show.locations[0]) >= 10
2020-04-14 20:13:30 +00:00
assert utils.is_datetime(show.originallyAvailableAt)
assert show.rating >= 8.0
assert utils.is_int(show.ratingKey)
2020-04-29 21:23:22 +00:00
assert sorted([i.tag for i in show.roles])[:4] == [
"Aidan Gillen",
"Aimee Richardson",
"Alexander Siddig",
"Alfie Allen",
] # noqa
assert sorted([i.tag for i in show.actors])[:4] == [
"Aidan Gillen",
"Aimee Richardson",
"Alexander Siddig",
"Alfie Allen",
] # noqa
assert show._server._baseurl == utils.SERVER_BASEURL
2020-04-29 21:23:22 +00:00
assert show.studio == "HBO"
assert utils.is_string(show.summary, gte=100)
2020-04-29 21:23:22 +00:00
assert utils.is_metadata(show.theme, contains="/theme/")
assert utils.is_metadata(show.thumb, contains="/thumb/")
assert show.title == "Game of Thrones"
assert show.titleSort == "Game of Thrones"
assert show.type == "show"
assert utils.is_datetime(show.updatedAt)
assert utils.is_int(show.viewCount, gte=0)
assert utils.is_int(show.viewedLeafCount, gte=0)
2020-04-14 20:13:30 +00:00
assert show.year in (2011, 2010)
assert show.url(None) is None
def test_video_Show_history(show):
show.markWatched()
history = show.history()
assert len(history)
show.markUnwatched()
def test_video_Show_watched(tvshows):
2020-04-29 21:23:22 +00:00
show = tvshows.get("The 100")
show.episodes()[0].markWatched()
watched = show.watched()
2020-04-29 21:23:22 +00:00
assert len(watched) == 1 and watched[0].title == "Pilot"
2017-01-29 21:22:48 +00:00
2017-02-02 04:47:22 +00:00
def test_video_Show_unwatched(tvshows):
2020-04-29 21:23:22 +00:00
show = tvshows.get("The 100")
episodes = show.episodes()
episodes[0].markWatched()
unwatched = show.unwatched()
assert len(unwatched) == len(episodes) - 1
2017-01-29 21:22:48 +00:00
2017-02-02 04:47:22 +00:00
2020-06-18 13:47:22 +00:00
def test_video_Show_settings(show):
preferences = show.preferences()
assert len(preferences) >= 1
def test_video_Show_editAdvanced_default(show):
show.editAdvanced(showOrdering='absolute')
show.reload()
for pref in show.preferences():
if pref.id == 'showOrdering':
assert pref.value == 'absolute'
show.editAdvanced(flattenSeasons=1)
show.reload()
for pref in show.preferences():
if pref.id == 'flattenSeasons':
assert pref.value == 1
show.defaultAdvanced()
show.reload()
for pref in show.preferences():
assert pref.value == pref.default
def test_video_Show_reload(plex):
2020-04-29 21:23:22 +00:00
show = plex.library.section("TV Shows").get("Game of Thrones")
assert utils.is_metadata(show._initpath, prefix="/library/sections/")
assert len(show.roles) == 3
show.reload()
2020-04-29 21:23:22 +00:00
assert utils.is_metadata(show._initpath, prefix="/library/metadata/")
assert len(show.roles) > 3
2017-01-09 14:21:54 +00:00
def test_video_Show_episodes(tvshows):
2020-04-29 21:23:22 +00:00
show = tvshows.get("The 100")
episodes = show.episodes()
episodes[0].markWatched()
unwatched = show.episodes(viewCount=0)
assert len(unwatched) == len(episodes) - 1
2017-02-02 04:47:22 +00:00
2017-01-09 14:21:54 +00:00
def test_video_Show_download(monkeydownload, tmpdir, show):
episodes = show.episodes()
filepaths = show.download(savepath=str(tmpdir))
assert len(filepaths) == len(episodes)
2017-01-09 14:21:54 +00:00
def test_video_Season_download(monkeydownload, tmpdir, show):
2020-04-29 21:23:22 +00:00
season = show.season("Season 1")
filepaths = season.download(savepath=str(tmpdir))
2017-04-29 05:47:21 +00:00
assert len(filepaths) >= 4
2017-02-02 04:47:22 +00:00
def test_video_Episode_download(monkeydownload, tmpdir, episode):
f = episode.download(savepath=str(tmpdir))
2017-01-09 14:21:54 +00:00
assert len(f) == 1
2020-04-29 21:23:22 +00:00
with_sceen_size = episode.download(
savepath=str(tmpdir), **{"videoResolution": "500x300"}
)
2017-01-09 14:21:54 +00:00
assert len(with_sceen_size) == 1
def test_video_Show_thumbUrl(show):
assert utils.SERVER_BASEURL in show.thumbUrl
2020-04-29 21:23:22 +00:00
assert "/library/metadata/" in show.thumbUrl
assert "/thumb/" in show.thumbUrl
2017-01-09 14:21:54 +00:00
2017-02-02 04:47:22 +00:00
2017-05-02 03:34:43 +00:00
# Analyze seems to fail intermittently
@pytest.mark.xfail
def test_video_Show_analyze(show):
show = show.analyze()
2017-01-09 14:21:54 +00:00
2017-02-02 04:47:22 +00:00
def test_video_Show_markWatched(show):
2017-01-09 14:21:54 +00:00
show.markWatched()
assert show.isWatched
2017-01-09 14:21:54 +00:00
def test_video_Show_markUnwatched(show):
2017-01-09 14:21:54 +00:00
show.markUnwatched()
assert not show.isWatched
2017-01-09 14:21:54 +00:00
def test_video_Show_refresh(show):
2017-01-09 14:21:54 +00:00
show.refresh()
def test_video_Show_get(show):
2020-04-29 21:23:22 +00:00
assert show.get("Winter Is Coming").title == "Winter Is Coming"
2017-01-09 14:21:54 +00:00
def test_video_Show_isWatched(show):
assert not show.isWatched
2017-01-09 14:21:54 +00:00
def test_video_Show_section(show):
section = show.section()
2020-04-29 21:23:22 +00:00
assert section.title == "TV Shows"
2017-01-09 14:21:54 +00:00
2021-01-24 23:03:23 +00:00
def test_video_Show_mixins_tags(show):
test_mixins.edit_collection(show)
test_mixins.edit_genre(show)
test_mixins.edit_label(show)
2021-01-24 22:40:02 +00:00
def test_video_Episode(show):
2020-04-29 21:23:22 +00:00
episode = show.episode("Winter Is Coming")
assert episode == show.episode(season=1, episode=1)
2017-02-14 05:35:13 +00:00
with pytest.raises(BadRequest):
show.episode()
2017-01-29 21:22:48 +00:00
with pytest.raises(NotFound):
show.episode(season=1337, episode=1337)
def test_video_Episode_history(episode):
episode.markWatched()
history = episode.history()
assert len(history)
episode.markUnwatched()
def test_video_Episode_hidden_season(episode):
assert episode.skipParent is False
assert episode.parentRatingKey
assert episode.parentKey
assert episode.seasonNumber
show = episode.show()
show.editAdvanced(flattenSeasons=1)
episode.reload()
assert episode.skipParent is True
assert episode.parentRatingKey
assert episode.parentKey
assert episode.seasonNumber
show.defaultAdvanced()
def test_video_Episode_parent_weakref(show):
season = show.season(season=1)
episode = season.episode(episode=1)
assert episode._parent is not None
assert episode._parent() == season
episode = show.season(season=1).episode(episode=1)
assert episode._parent is not None
assert episode._parent() is None
2017-05-02 03:34:43 +00:00
# Analyze seems to fail intermittently
@pytest.mark.xfail
def test_video_Episode_analyze(tvshows):
2020-04-29 21:23:22 +00:00
episode = tvshows.get("Game of Thrones").episode(season=1, episode=1)
episode.analyze()
def test_video_Episode_attrs(episode):
assert utils.is_datetime(episode.addedAt)
assert episode.contentRating in utils.CONTENTRATINGS
2020-04-14 20:13:30 +00:00
if len(episode.directors):
2020-04-29 21:23:22 +00:00
assert [i.tag for i in episode.directors] == ["Tim Van Patten"]
assert utils.is_int(episode.duration, gte=120000)
2020-04-29 21:23:22 +00:00
assert episode.grandparentTitle == "Game of Thrones"
assert episode.index == 1
assert utils.is_metadata(episode._initpath)
assert utils.is_metadata(episode.key)
2020-04-29 21:23:22 +00:00
assert episode.listType == "video"
2020-04-14 20:13:30 +00:00
assert utils.is_datetime(episode.originallyAvailableAt)
assert utils.is_int(episode.parentIndex)
assert utils.is_metadata(episode.parentKey)
assert utils.is_int(episode.parentRatingKey)
2020-04-29 21:23:22 +00:00
assert utils.is_metadata(episode.parentThumb, contains="/thumb/")
assert episode.rating >= 7.7
assert utils.is_int(episode.ratingKey)
assert episode._server._baseurl == utils.SERVER_BASEURL
assert episode.skipParent is False
assert utils.is_string(episode.summary, gte=100)
2020-04-29 21:23:22 +00:00
assert utils.is_metadata(episode.thumb, contains="/thumb/")
assert episode.title == "Winter Is Coming"
assert episode.titleSort == "Winter Is Coming"
2017-10-13 22:02:21 +00:00
assert not episode.transcodeSessions
2020-04-29 21:23:22 +00:00
assert episode.type == "episode"
assert utils.is_datetime(episode.updatedAt)
assert utils.is_int(episode.viewCount, gte=0)
assert episode.viewOffset == 0
2020-04-29 21:23:22 +00:00
assert sorted([i.tag for i in episode.writers]) == sorted(
["David Benioff", "D. B. Weiss"]
)
assert episode.year == 2011
assert episode.isWatched in [True, False]
2020-12-24 07:03:08 +00:00
assert len(episode.locations) == 1
assert len(episode.locations[0]) >= 10
# Media
media = episode.media[0]
assert media.aspectRatio == 1.78
assert media.audioChannels in utils.AUDIOCHANNELS
assert media.audioCodec in utils.CODECS
assert utils.is_int(media.bitrate)
assert media.container in utils.CONTAINERS
assert utils.is_int(media.duration, gte=150000)
assert utils.is_int(media.height, gte=200)
assert utils.is_int(media.id)
assert utils.is_metadata(media._initpath)
2017-04-29 05:47:21 +00:00
if media.optimizedForStreaming:
assert isinstance(media.optimizedForStreaming, bool)
assert media._server._baseurl == utils.SERVER_BASEURL
assert media.videoCodec in utils.CODECS
assert media.videoFrameRate in utils.FRAMERATES
assert media.videoResolution in utils.RESOLUTIONS
assert utils.is_int(media.width, gte=400)
# Part
part = media.parts[0]
assert part.container in utils.CONTAINERS
assert utils.is_int(part.duration, gte=150000)
assert len(part.file) >= 10
assert utils.is_int(part.id)
assert utils.is_metadata(part._initpath)
assert len(part.key) >= 10
assert part._server._baseurl == utils.SERVER_BASEURL
Improvements in tests process (#297) * lets begin * skip plexpass tests if there is not plexpass on account * test new myplex attrubutes * bootstrap: proper photos organisation * fix rest of photos tests * fix myplex new attributes test * fix music bootstrap by setting agent to lastfm * fix sync tests * increase bootstrap timeout * remove timeout from .travis.yml * do not create playlist-style photoalbums in plex-bootstraptest.py * allow negative filtering in LibrarySection.search() * fix sync tests once again * use sendCrashReports in test_settings * fix test_settings * fix test_video * do not accept eula in bootstrap * fix PlexServer.isLatest() * add test against old version of PlexServer * fix MyPlexAccount.OutOut * add flag for one-time testing in Travis * fix test_library onDeck tests * fix more tests * use tqdm in plex-bootstraptest for media scanning progress * create sections one-by-one * update docs on AlertListener for timeline entries * fix plex-bootstraptest for server version 1.3.2 * display skip/xpass/xfail reasons * fix tests on 1.3 * wait for music to be fully processed in plex-bootstraptest * fix misplaced TEST_ACCOUNT_ONCE * fix test_myplex_users, not sure if in proper-way * add pytest-rerunfailures; mark test_myplex_optout as flaky * fix comment * Revert "add pytest-rerunfailures; mark test_myplex_optout as flaky" This reverts commit 580e4c95a758c92329d757eb2f3fc3bf44b26f09. * restart plex container on failure * add conftest.wait_until() and used where some retries are required * add more wait_until() usage in test_sync * fix managed user search * fix updating managed users in myplex * allow to add new servers to existent users * add new server to a shared user while bootstrapping * add some docs on testing process * perform few attemps when unable to get the claim token * unlock websocket-client in requirements_dev * fix docblock in tools/plex-teardowntest * do not hardcode mediapart size in test_video * remove cache:pip from travis * Revert "unlock websocket-client in requirements_dev" This reverts commit 0d536bd06dbdc4a4b869a1686f8cd008898859fe. * remove debug from server.py * improve webhook tests * fix type() check to isinstance() * remove excessive `else` branch due to Hellowlol advice * add `unknown` as allowed `myPlexMappingState` in test_server
2018-09-14 18:03:23 +00:00
assert utils.is_int(part.size, gte=18184197)
assert part.exists
assert part.accessible
2021-01-24 23:03:23 +00:00
def test_video_Episode_mixins_tags(episode):
test_mixins.edit_director(episode)
test_mixins.edit_writer(episode)
2021-01-24 22:40:02 +00:00
def test_video_Season(show):
seasons = show.seasons()
Improvements in tests process (#297) * lets begin * skip plexpass tests if there is not plexpass on account * test new myplex attrubutes * bootstrap: proper photos organisation * fix rest of photos tests * fix myplex new attributes test * fix music bootstrap by setting agent to lastfm * fix sync tests * increase bootstrap timeout * remove timeout from .travis.yml * do not create playlist-style photoalbums in plex-bootstraptest.py * allow negative filtering in LibrarySection.search() * fix sync tests once again * use sendCrashReports in test_settings * fix test_settings * fix test_video * do not accept eula in bootstrap * fix PlexServer.isLatest() * add test against old version of PlexServer * fix MyPlexAccount.OutOut * add flag for one-time testing in Travis * fix test_library onDeck tests * fix more tests * use tqdm in plex-bootstraptest for media scanning progress * create sections one-by-one * update docs on AlertListener for timeline entries * fix plex-bootstraptest for server version 1.3.2 * display skip/xpass/xfail reasons * fix tests on 1.3 * wait for music to be fully processed in plex-bootstraptest * fix misplaced TEST_ACCOUNT_ONCE * fix test_myplex_users, not sure if in proper-way * add pytest-rerunfailures; mark test_myplex_optout as flaky * fix comment * Revert "add pytest-rerunfailures; mark test_myplex_optout as flaky" This reverts commit 580e4c95a758c92329d757eb2f3fc3bf44b26f09. * restart plex container on failure * add conftest.wait_until() and used where some retries are required * add more wait_until() usage in test_sync * fix managed user search * fix updating managed users in myplex * allow to add new servers to existent users * add new server to a shared user while bootstrapping * add some docs on testing process * perform few attemps when unable to get the claim token * unlock websocket-client in requirements_dev * fix docblock in tools/plex-teardowntest * do not hardcode mediapart size in test_video * remove cache:pip from travis * Revert "unlock websocket-client in requirements_dev" This reverts commit 0d536bd06dbdc4a4b869a1686f8cd008898859fe. * remove debug from server.py * improve webhook tests * fix type() check to isinstance() * remove excessive `else` branch due to Hellowlol advice * add `unknown` as allowed `myPlexMappingState` in test_server
2018-09-14 18:03:23 +00:00
assert len(seasons) == 2
2020-04-29 21:23:22 +00:00
assert ["Season 1", "Season 2"] == [s.title for s in seasons[:2]]
assert show.season("Season 1") == seasons[0]
def test_video_Season_history(show):
2020-04-29 21:23:22 +00:00
season = show.season("Season 1")
season.markWatched()
history = season.history()
assert len(history)
season.markUnwatched()
def test_video_Season_attrs(show):
2020-04-29 21:23:22 +00:00
season = show.season("Season 1")
assert utils.is_datetime(season.addedAt)
assert season.index == 1
assert utils.is_metadata(season._initpath)
assert utils.is_metadata(season.key)
2020-10-08 20:15:43 +00:00
assert utils.is_datetime(season.lastViewedAt)
assert utils.is_int(season.leafCount, gte=3)
2020-04-29 21:23:22 +00:00
assert season.listType == "video"
assert utils.is_metadata(season.parentKey)
assert utils.is_int(season.parentRatingKey)
2020-04-29 21:23:22 +00:00
assert season.parentTitle == "Game of Thrones"
assert utils.is_int(season.ratingKey)
assert season._server._baseurl == utils.SERVER_BASEURL
2020-04-29 21:23:22 +00:00
assert season.summary == ""
assert utils.is_metadata(season.thumb, contains="/thumb/")
assert season.title == "Season 1"
assert season.titleSort == "Season 1"
assert season.type == "season"
assert utils.is_datetime(season.updatedAt)
assert utils.is_int(season.viewCount, gte=0)
assert utils.is_int(season.viewedLeafCount, gte=0)
assert utils.is_int(season.seasonNumber)
def test_video_Season_show(show):
season = show.seasons()[0]
2020-04-29 21:23:22 +00:00
season_by_name = show.season("Season 1")
assert show.ratingKey == season.parentRatingKey and season_by_name.parentRatingKey
assert season.ratingKey == season_by_name.ratingKey
2020-12-24 07:03:08 +00:00
def test_video_Season_watched(show):
season = show.season("Season 1")
season.markWatched()
assert season.isWatched
2017-01-09 14:21:54 +00:00
2020-12-24 07:03:08 +00:00
def test_video_Season_unwatched(show):
season = show.season("Season 1")
season.markUnwatched()
assert not season.isWatched
2017-01-09 14:21:54 +00:00
def test_video_Season_get(show):
2020-12-24 07:03:08 +00:00
episode = show.season("Season 1").get("Winter Is Coming")
2020-04-29 21:23:22 +00:00
assert episode.title == "Winter Is Coming"
2017-01-09 14:21:54 +00:00
def test_video_Season_episode(show):
2020-12-24 07:12:50 +00:00
episode = show.season("Season 1").get("Winter Is Coming")
2020-04-29 21:23:22 +00:00
assert episode.title == "Winter Is Coming"
2017-01-09 14:21:54 +00:00
2019-09-02 18:34:51 +00:00
def test_video_Season_episode_by_index(show):
2020-12-24 17:21:02 +00:00
episode = show.season(season=1).episode(episode=1)
2019-09-02 18:34:51 +00:00
assert episode.index == 1
def test_video_Season_episodes(show):
2020-12-24 07:03:08 +00:00
episodes = show.season("Season 2").episodes()
assert len(episodes) >= 1
2017-01-30 00:27:07 +00:00
def test_that_reload_return_the_same_object(plex):
2017-01-30 00:27:07 +00:00
# we want to check this that all the urls are correct
2020-04-29 21:23:22 +00:00
movie_library_search = plex.library.section("Movies").search("Elephants Dream")[0]
movie_search = plex.search("Elephants Dream")[0]
movie_section_get = plex.library.section("Movies").get("Elephants Dream")
2017-01-30 00:27:07 +00:00
movie_library_search_key = movie_library_search.key
movie_search_key = movie_search.key
movie_section_get_key = movie_section_get.key
2020-04-29 21:23:22 +00:00
assert (
movie_library_search_key
== movie_library_search.reload().key
== movie_search_key
== movie_search.reload().key
== movie_section_get_key
== movie_section_get.reload().key
) # noqa
tvshow_library_search = plex.library.section("TV Shows").search("The 100")[0]
tvshow_search = plex.search("The 100")[0]
tvshow_section_get = plex.library.section("TV Shows").get("The 100")
2017-01-30 00:27:07 +00:00
tvshow_library_search_key = tvshow_library_search.key
tvshow_search_key = tvshow_search.key
tvshow_section_get_key = tvshow_section_get.key
2020-04-29 21:23:22 +00:00
assert (
tvshow_library_search_key
== tvshow_library_search.reload().key
== tvshow_search_key
== tvshow_search.reload().key
== tvshow_section_get_key
== tvshow_section_get.reload().key
) # noqa
2020-12-24 07:03:08 +00:00
season_library_search = tvshow_library_search.season("Season 1")
season_search = tvshow_search.season("Season 1")
season_section_get = tvshow_section_get.season("Season 1")
2017-01-30 00:27:07 +00:00
season_library_search_key = season_library_search.key
season_search_key = season_search.key
season_section_get_key = season_section_get.key
2020-04-29 21:23:22 +00:00
assert (
season_library_search_key
== season_library_search.reload().key
== season_search_key
== season_search.reload().key
== season_section_get_key
== season_section_get.reload().key
) # noqa
2017-01-30 00:27:07 +00:00
episode_library_search = tvshow_library_search.episode(season=1, episode=1)
episode_search = tvshow_search.episode(season=1, episode=1)
episode_section_get = tvshow_section_get.episode(season=1, episode=1)
episode_library_search_key = episode_library_search.key
episode_search_key = episode_search.key
episode_section_get_key = episode_section_get.key
2020-04-29 21:23:22 +00:00
assert (
episode_library_search_key
== episode_library_search.reload().key
== episode_search_key
== episode_search.reload().key
== episode_section_get_key
== episode_section_get.reload().key
) # noqa
def test_video_exists_accessible(movie, episode):
assert movie.media[0].parts[0].exists is None
assert movie.media[0].parts[0].accessible is None
movie.reload()
assert movie.media[0].parts[0].exists is True
assert movie.media[0].parts[0].accessible is True
assert episode.media[0].parts[0].exists is None
assert episode.media[0].parts[0].accessible is None
episode.reload()
assert episode.media[0].parts[0].exists is True
assert episode.media[0].parts[0].accessible is True
def test_video_edits_locked(movie, episode):
Update to MediaPartStream and inheriting classes (#590) * moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream) * removal of no longer present attribs in video, audio, subtitle streams * additional attribs to video and mediapart streams * removal of previously unique subtitleStream attribs. attribs are now common or no longer present. * docstring cleanup of video, audio, and subtitle stream; pass 1 * remove codecID checks as this attribute is now longer used. * adding key attrib to parent MediaPartStream. * add transient to SubtitleStream, found in uploaded subtitles * removing dialogNorm related assertion as this attrib has been removed. * update Media class based on PR comments optimizedVersion to be added, need SEARCHTYPES * update MediaPartStream class based on PR comments * update VideoStream class based on PR comments * update AudioStream class based on PR comments * update SubtitleStream class based on PR comments * add LyricStream class based on PR comments * add streamType int and LyricStream to MediaPartStream.parse method * add MediaPart.lyricStreams method * spelling correction * more movement based on PR comments * alpha ordering MediaPart * alpha sort VideoStream * docstring corrections * remove assert stream.dialogNorm from audio test as dialogNorm has been removed. * adding LyricStream to _buildStreams function * adding changes from @johnnywong16 https://github.com/JonnyWong16/python-plexapi/commit/e346f0b4dc92ab04a7b69d3ecb28734883a0e792 * moving unused imports down and together * Address docstring review comments * Change isChildOf for any kwargs * Add Media.isOptimizedVersion property * Add photo and track specific attributes * Remove dead MediaPartStream.parse method * Update media doc strings * Add optimized version doc string * Cast video stream codedHeight and codedWidth to int * Add required bandwidths to streams * Update video tests * Update audio tests * Fix video tests * Fix video tests * Fix video tests Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 20:21:56 +00:00
edits = {'titleSort.value': 'New Title Sort', 'titleSort.locked': 1}
movieTitleSort = movie.titleSort
movie.edit(**edits)
movie.reload()
for field in movie.fields:
if field.name == 'titleSort':
assert movie.titleSort == 'New Title Sort'
2020-11-22 01:09:24 +00:00
assert field.locked is True
movie.edit(**{'titleSort.value': movieTitleSort, 'titleSort.locked': 0})
episodeTitleSort = episode.titleSort
episode.edit(**edits)
episode.reload()
for field in episode.fields:
if field.name == 'titleSort':
assert episode.titleSort == 'New Title Sort'
2020-11-22 01:09:24 +00:00
assert field.locked is True
episode.edit(**{'titleSort.value': episodeTitleSort, 'titleSort.locked': 0})
2020-04-29 21:23:22 +00:00
@pytest.mark.skip(
reason="broken? assert len(plex.conversions()) == 1 may fail on some builds"
)
def test_video_optimize(movie, plex):
plex.optimizedItems(removeAll=True)
movie.optimize(targetTagID=1)
plex.conversions(pause=True)
sleep(1)
assert len(plex.optimizedItems()) == 1
assert len(plex.conversions()) == 1
conversion = plex.conversions()[0]
conversion.remove()
assert len(plex.conversions()) == 0
assert len(plex.optimizedItems()) == 1
optimized = plex.optimizedItems()[0]
video = plex.optimizedItem(optimizedID=optimized.id)
assert movie.key == video.key
plex.optimizedItems(removeAll=True)
2020-04-14 20:13:30 +00:00
assert len(plex.optimizedItems()) == 0