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
|
2020-02-13 20:04:03 +00:00
|
|
|
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
|
2022-07-21 03:07:39 +00:00
|
|
|
from plexapi.sync import VIDEO_QUALITY_3_MBPS_720p
|
2020-04-14 20:13:30 +00:00
|
|
|
|
2017-04-23 05:18:53 +00:00
|
|
|
from . import conftest as utils
|
2021-05-09 22:05:06 +00:00
|
|
|
from . import test_media, test_mixins
|
2017-01-29 21:22:48 +00:00
|
|
|
|
2017-01-09 14:21:54 +00:00
|
|
|
|
2017-05-02 03:26:27 +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
|
2017-02-10 23:16:23 +00:00
|
|
|
|
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(
|
2022-08-28 05:56:01 +00:00
|
|
|
f"/library/sections/{movies.key}/all", title__ne="Sintel"
|
2020-04-29 21:23:22 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
== 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()
|
|
|
|
|
2017-02-10 23:16:23 +00:00
|
|
|
|
2020-05-01 21:06:29 +00:00
|
|
|
def test_video_Movie_merge(movie, patched_http_call):
|
|
|
|
movie.merge(1337)
|
|
|
|
|
|
|
|
|
2017-04-23 05:18:53 +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
|
2017-04-23 05:18:53 +00:00
|
|
|
assert len(movie.locations[0]) >= 10
|
|
|
|
assert utils.is_datetime(movie.addedAt)
|
2021-02-15 01:10:11 +00:00
|
|
|
if movie.art:
|
|
|
|
assert utils.is_art(movie.art)
|
2021-05-10 04:23:48 +00:00
|
|
|
assert utils.is_float(movie.rating)
|
2021-01-25 02:03:58 +00:00
|
|
|
assert movie.ratingImage == 'rottentomatoes://image.rating.ripe'
|
2021-05-10 04:23:48 +00:00
|
|
|
assert utils.is_float(movie.audienceRating)
|
2021-01-25 02:03:58 +00:00
|
|
|
assert movie.audienceRatingImage == 'rottentomatoes://image.rating.upright'
|
2022-12-21 19:43:52 +00:00
|
|
|
if movie.ratings:
|
|
|
|
assert "imdb://image.rating" in [i.image for i in movie.ratings]
|
2017-04-23 05:18:53 +00:00
|
|
|
movie.reload() # RELOAD
|
2017-05-02 03:26:27 +00:00
|
|
|
assert movie.chapterSource is None
|
2021-01-25 02:03:58 +00:00
|
|
|
assert not movie.collections
|
2017-05-02 03:26:27 +00:00
|
|
|
assert movie.contentRating in utils.CONTENTRATINGS
|
2022-08-27 13:17:33 +00:00
|
|
|
assert movie.editionTitle is None
|
2023-03-09 21:32:17 +00:00
|
|
|
assert movie.enableCreditsMarkerGeneration == -1
|
2021-01-25 02:03:58 +00:00
|
|
|
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]
|
2021-05-10 04:23:48 +00:00
|
|
|
assert movie.actors == movie.roles
|
2021-01-25 02:03:58 +00:00
|
|
|
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
|
2021-01-25 02:03:58 +00:00
|
|
|
assert not movie.fields
|
2019-10-12 18:49:18 +00:00
|
|
|
assert movie.posters()
|
2021-01-25 02:03:58 +00:00
|
|
|
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"
|
2021-05-11 01:13:47 +00:00
|
|
|
assert movie.hasPreviewThumbnails is False
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(movie._initpath)
|
|
|
|
assert utils.is_metadata(movie.key)
|
2021-03-11 17:20:28 +00:00
|
|
|
assert movie.languageOverride is None
|
2021-05-16 05:38:54 +00:00
|
|
|
assert utils.is_datetime(movie.lastRatedAt)
|
2020-10-08 20:15:43 +00:00
|
|
|
assert utils.is_datetime(movie.lastViewedAt)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert int(movie.librarySectionID) >= 1
|
2020-04-29 21:23:22 +00:00
|
|
|
assert movie.listType == "video"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert movie.originalTitle is None
|
2020-04-14 20:13:30 +00:00
|
|
|
assert utils.is_datetime(movie.originallyAvailableAt)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert movie.playlistItemID is None
|
2017-05-13 03:25:57 +00:00
|
|
|
if movie.primaryExtraKey:
|
|
|
|
assert utils.is_metadata(movie.primaryExtraKey)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert movie.ratingKey >= 1
|
|
|
|
assert movie._server._baseurl == utils.SERVER_BASEURL
|
2020-04-29 21:23:22 +00:00
|
|
|
assert movie.studio == "Nina Paley"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_string(movie.summary, gte=100)
|
2022-04-07 16:58:06 +00:00
|
|
|
assert movie.tagline == "The Greatest Break-Up Story Ever Told."
|
2022-02-27 05:05:43 +00:00
|
|
|
assert movie.theme is None
|
2021-02-15 01:10:11 +00:00
|
|
|
if movie.thumb:
|
|
|
|
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"
|
|
|
|
assert movie.type == "movie"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert movie.updatedAt > datetime(2017, 1, 1)
|
2021-03-11 17:20:28 +00:00
|
|
|
assert movie.useOriginalTitle == -1
|
2017-04-23 05:18:53 +00:00
|
|
|
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)
|
2022-06-20 16:01:27 +00:00
|
|
|
assert movie.year == 2009
|
2017-04-23 05:18:53 +00:00
|
|
|
# Audio
|
2017-05-13 20:17:06 +00:00
|
|
|
audio = movie.media[0].parts[0].audioStreams()[0]
|
2017-05-02 03:26:27 +00:00
|
|
|
if audio.audioChannelLayout:
|
|
|
|
assert audio.audioChannelLayout in utils.AUDIOLAYOUTS
|
2017-04-23 05:18:53 +00:00
|
|
|
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
|
2021-01-24 20:21:56 +00:00
|
|
|
assert audio.default is True
|
|
|
|
assert audio.displayTitle == "Unknown (AAC Stereo)"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert audio.duration is None
|
2021-01-24 20:21:56 +00:00
|
|
|
assert audio.extendedDisplayTitle == "Unknown (AAC Stereo)"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert audio.id >= 1
|
|
|
|
assert audio.index == 1
|
|
|
|
assert utils.is_metadata(audio._initpath)
|
2018-09-14 18:03:23 +00:00
|
|
|
assert audio.language is None
|
|
|
|
assert audio.languageCode is None
|
2022-07-21 02:06:06 +00:00
|
|
|
assert audio.languageTag is None
|
2021-01-24 20:21:56 +00:00
|
|
|
assert audio.profile == "lc"
|
|
|
|
assert audio.requiredBandwidths is None or audio.requiredBandwidths
|
2018-09-14 18:03:23 +00:00
|
|
|
assert audio.samplingRate == 44100
|
2017-04-23 05:18:53 +00:00
|
|
|
assert audio.selected is True
|
2021-01-24 20:21:56 +00:00
|
|
|
assert audio.streamIdentifier == 2
|
2017-04-23 05:18:53 +00:00
|
|
|
assert audio.streamType == 2
|
2021-01-24 20:21:56 +00:00
|
|
|
assert audio._server._baseurl == utils.SERVER_BASEURL
|
2017-04-23 05:18:53 +00:00
|
|
|
assert audio.title is None
|
|
|
|
assert audio.type == 2
|
2021-01-24 20:21:56 +00:00
|
|
|
with pytest.raises(AttributeError):
|
|
|
|
assert audio.albumGain is None # Check track only attributes are not available
|
2017-04-23 05:18:53 +00:00
|
|
|
# Media
|
|
|
|
media = movie.media[0]
|
2017-04-29 05:47:21 +00:00
|
|
|
assert media.aspectRatio >= 1.3
|
2017-04-23 05:18:53 +00:00
|
|
|
assert media.audioChannels in utils.AUDIOCHANNELS
|
|
|
|
assert media.audioCodec in utils.CODECS
|
2021-01-24 20:21:56 +00:00
|
|
|
assert media.audioProfile == "lc"
|
2017-04-23 05:18:53 +00:00
|
|
|
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)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(media.height)
|
|
|
|
assert utils.is_int(media.id)
|
|
|
|
assert utils.is_metadata(media._initpath)
|
2021-01-24 20:21:56 +00:00
|
|
|
assert media.has64bitOffsets is False
|
2017-05-02 03:26:27 +00:00
|
|
|
assert media.optimizedForStreaming in [None, False, True]
|
2021-01-24 20:21:56 +00:00
|
|
|
assert media.proxyType is None
|
2017-04-23 05:18:53 +00:00
|
|
|
assert media._server._baseurl == utils.SERVER_BASEURL
|
2021-01-24 20:21:56 +00:00
|
|
|
assert media.target is None
|
|
|
|
assert media.title is None
|
2017-04-23 05:18:53 +00:00
|
|
|
assert media.videoCodec in utils.CODECS
|
|
|
|
assert media.videoFrameRate in utils.FRAMERATES
|
2021-01-24 20:21:56 +00:00
|
|
|
assert media.videoProfile == "main"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert media.videoResolution in utils.RESOLUTIONS
|
|
|
|
assert utils.is_int(media.width, gte=200)
|
2021-01-24 20:21:56 +00:00
|
|
|
with pytest.raises(AttributeError):
|
|
|
|
assert media.aperture is None # Check photo only attributes are not available
|
2017-04-23 05:18:53 +00:00
|
|
|
# Video
|
2017-05-13 20:17:06 +00:00
|
|
|
video = movie.media[0].parts[0].videoStreams()[0]
|
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
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(video.bitrate)
|
|
|
|
assert video.cabac is None
|
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)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert video.codec in utils.CODECS
|
|
|
|
assert video.codecID is None
|
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
|
2018-09-14 18:03:23 +00:00
|
|
|
assert video.colorSpace is None
|
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
|
2017-04-23 05:18:53 +00:00
|
|
|
assert video.duration is None
|
2021-01-24 20:21:56 +00:00
|
|
|
assert video.extendedDisplayTitle == "1080p (H.264)"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_float(video.frameRate, gte=20.0)
|
|
|
|
assert video.frameRateMode is None
|
2022-02-27 03:26:08 +00:00
|
|
|
assert video.hasScalingMatrix is False
|
2017-04-29 05:47:21 +00:00
|
|
|
assert utils.is_int(video.height, gte=250)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(video.id)
|
|
|
|
assert utils.is_int(video.index, gte=0)
|
|
|
|
assert utils.is_metadata(video._initpath)
|
2018-09-14 18:03:23 +00:00
|
|
|
assert video.language is None
|
|
|
|
assert video.languageCode is None
|
2022-07-21 02:06:06 +00:00
|
|
|
assert video.languageTag is None
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(video.level)
|
|
|
|
assert video.profile in utils.PROFILES
|
2021-01-24 20:21:56 +00:00
|
|
|
assert video.pixelAspectRatio is None
|
|
|
|
assert video.pixelFormat is None
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(video.refFrames)
|
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)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert video.selected is False
|
2021-01-24 20:21:56 +00:00
|
|
|
assert video.streamType == 1
|
|
|
|
assert video.streamIdentifier == 1
|
2017-04-23 05:18:53 +00:00
|
|
|
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]
|
2021-01-24 20:21:56 +00:00
|
|
|
assert part.accessible
|
|
|
|
assert part.audioProfile == "lc"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert part.container in utils.CONTAINERS
|
2021-01-24 20:21:56 +00:00
|
|
|
assert part.decision is None
|
|
|
|
assert part.deepAnalysisVersion is None or utils.is_int(part.deepAnalysisVersion)
|
2021-01-25 02:03:58 +00:00
|
|
|
assert utils.is_int(part.duration, gte=160000)
|
2021-01-24 20:21:56 +00:00
|
|
|
assert part.exists
|
2017-04-23 05:18:53 +00:00
|
|
|
assert len(part.file) >= 10
|
2021-01-24 20:21:56 +00:00
|
|
|
assert part.has64bitOffsets is False
|
2021-05-11 01:13:47 +00:00
|
|
|
assert part.hasPreviewThumbnails is False
|
2021-01-24 20:21:56 +00:00
|
|
|
assert part.hasThumbnail is None
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(part.id)
|
2021-01-24 20:21:56 +00:00
|
|
|
assert part.indexes is None
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(part._initpath)
|
|
|
|
assert len(part.key) >= 10
|
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
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(part.size, gte=1000000)
|
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"
|
2017-04-23 05:18:53 +00:00
|
|
|
# Stream 1
|
|
|
|
stream1 = part.streams[0]
|
2018-09-14 18:03:23 +00:00
|
|
|
assert stream1.bitDepth in (8, None)
|
2017-04-23 05:18:53 +00:00
|
|
|
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)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert stream1.codec in utils.CODECS
|
2018-09-14 18:03:23 +00:00
|
|
|
assert stream1.colorSpace is None
|
2017-04-23 05:18:53 +00:00
|
|
|
assert stream1.duration is None
|
|
|
|
assert utils.is_float(stream1.frameRate, gte=20.0)
|
|
|
|
assert stream1.frameRateMode is None
|
2022-02-27 03:26:08 +00:00
|
|
|
assert stream1.hasScalingMatrix is False
|
2017-04-29 05:47:21 +00:00
|
|
|
assert utils.is_int(stream1.height, gte=250)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(stream1.id)
|
|
|
|
assert utils.is_int(stream1.index, gte=0)
|
|
|
|
assert utils.is_metadata(stream1._initpath)
|
2018-09-14 18:03:23 +00:00
|
|
|
assert stream1.language is None
|
|
|
|
assert stream1.languageCode is None
|
2022-07-21 02:06:06 +00:00
|
|
|
assert stream1.languageTag is None
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(stream1.level)
|
|
|
|
assert stream1.profile in utils.PROFILES
|
2017-05-02 03:26:27 +00:00
|
|
|
assert utils.is_int(stream1.refFrames)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert stream1.scanType in ("progressive", None)
|
2017-04-23 05:18:53 +00:00
|
|
|
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]
|
2017-05-02 03:26:27 +00:00
|
|
|
if stream2.audioChannelLayout:
|
|
|
|
assert stream2.audioChannelLayout in utils.AUDIOLAYOUTS
|
2017-04-23 05:18:53 +00:00
|
|
|
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)
|
2018-09-14 18:03:23 +00:00
|
|
|
assert stream2.language is None
|
|
|
|
assert stream2.languageCode is None
|
2022-07-21 02:06:06 +00:00
|
|
|
assert stream2.languageTag is None
|
2017-04-23 05:18:53 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2022-02-27 05:05:43 +00:00
|
|
|
def test_video_Movie_media_tags_Exception(movie):
|
|
|
|
with pytest.raises(BadRequest):
|
|
|
|
movie.genres[0].items()
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_media_tags_collection(movie, collection):
|
|
|
|
movie.reload()
|
|
|
|
collection_tag = next(c for c in movie.collections if c.tag == "Test Collection")
|
|
|
|
assert collection == collection_tag.collection()
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_getStreamURL(movie, account):
|
2023-03-09 23:48:51 +00:00
|
|
|
key = movie.key
|
|
|
|
|
|
|
|
url = movie.getStreamURL()
|
|
|
|
assert url.startswith(f"{utils.SERVER_BASEURL}/video/:/transcode/universal/start.m3u8")
|
|
|
|
assert account.authenticationToken in url
|
|
|
|
assert f"path={quote_plus(key)}" in url
|
|
|
|
assert "protocol" not in url
|
|
|
|
assert "videoResolution" not in url
|
|
|
|
|
|
|
|
url = movie.getStreamURL(videoResolution="800x600", protocol='dash')
|
|
|
|
assert url.startswith(f"{utils.SERVER_BASEURL}/video/:/transcode/universal/start.mpd")
|
|
|
|
assert "protocol=dash" in url
|
|
|
|
assert "videoResolution=800x600" in url
|
2022-02-27 05:05:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_isFullObject_and_reload(plex):
|
|
|
|
movie = plex.library.section("Movies").get("Sita Sings the Blues")
|
|
|
|
assert movie.isFullObject() is False
|
|
|
|
movie.reload(checkFiles=False)
|
|
|
|
assert movie.isFullObject() is False
|
|
|
|
movie.reload()
|
|
|
|
assert movie.isFullObject() is True
|
|
|
|
movie_via_search = plex.library.search(movie.title)[0]
|
|
|
|
assert movie_via_search.isFullObject() is False
|
|
|
|
movie_via_search.reload()
|
|
|
|
assert movie_via_search.isFullObject() is True
|
|
|
|
movie_via_section_search = plex.library.section("Movies").search(movie.title)[0]
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2022-08-26 19:14:24 +00:00
|
|
|
def test_video_movie_watched(movie):
|
|
|
|
movie.markUnplayed()
|
|
|
|
movie.markPlayed()
|
|
|
|
movie.reload()
|
|
|
|
assert movie.viewCount == 1
|
|
|
|
movie.markUnplayed()
|
|
|
|
movie.reload()
|
|
|
|
assert movie.viewCount == 0
|
|
|
|
|
2023-12-22 20:48:56 +00:00
|
|
|
movie.markWatched()
|
|
|
|
movie.reload()
|
|
|
|
assert movie.viewCount == 1
|
|
|
|
movie.markUnwatched()
|
|
|
|
movie.reload()
|
|
|
|
assert movie.viewCount == 0
|
|
|
|
|
2022-08-26 19:14:24 +00:00
|
|
|
|
2022-02-27 05:05:43 +00:00
|
|
|
def test_video_Movie_isPartialObject(movie):
|
|
|
|
assert movie.isPartialObject()
|
2022-05-17 03:03:06 +00:00
|
|
|
movie._autoReload = False
|
|
|
|
assert movie.originalTitle is None
|
|
|
|
assert movie.isPartialObject()
|
|
|
|
movie._autoReload = True
|
2022-02-27 05:05:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_media_delete(movie, patched_http_call):
|
|
|
|
for media in movie.media:
|
|
|
|
media.delete()
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_iterParts(movie):
|
|
|
|
assert len(list(movie.iterParts())) >= 1
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_download(monkeydownload, tmpdir, movie):
|
|
|
|
filepaths = movie.download(savepath=str(tmpdir))
|
|
|
|
assert len(filepaths) == 1
|
|
|
|
with_resolution = movie.download(
|
|
|
|
savepath=str(tmpdir), keep_original_filename=True, videoResolution="500x300"
|
|
|
|
)
|
|
|
|
assert len(with_resolution) == 1
|
|
|
|
filename = os.path.basename(movie.media[0].parts[0].file)
|
|
|
|
assert filename in with_resolution[0]
|
|
|
|
|
|
|
|
|
2023-03-09 22:21:20 +00:00
|
|
|
def test_video_Movie_videoStreams(movie):
|
|
|
|
assert movie.videoStreams()
|
|
|
|
|
2023-08-29 03:29:39 +00:00
|
|
|
|
2022-02-27 06:24:43 +00:00
|
|
|
def test_video_Movie_audioStreams(movie):
|
|
|
|
assert movie.audioStreams()
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_subtitleStreams(movie):
|
2022-02-27 05:05:43 +00:00
|
|
|
assert not movie.subtitleStreams()
|
|
|
|
|
|
|
|
|
2022-02-27 06:24:43 +00:00
|
|
|
def test_video_Episode_subtitleStreams(episode):
|
2022-02-27 05:05:43 +00:00
|
|
|
assert not episode.subtitleStreams()
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_upload_select_remove_subtitle(movie, subtitle):
|
|
|
|
|
|
|
|
filepath = os.path.realpath(subtitle.name)
|
|
|
|
|
|
|
|
movie.uploadSubtitles(filepath)
|
|
|
|
subtitles = [sub.title for sub in movie.subtitleStreams()]
|
|
|
|
subname = subtitle.name.rsplit(".", 1)[0]
|
|
|
|
assert subname in subtitles
|
|
|
|
|
2023-08-27 19:41:37 +00:00
|
|
|
movie.subtitleStreams()[0].setSelected()
|
2022-02-27 05:05:43 +00:00
|
|
|
movie.reload()
|
|
|
|
|
|
|
|
subtitleSelection = movie.subtitleStreams()[0]
|
|
|
|
assert subtitleSelection.selected
|
|
|
|
|
|
|
|
movie.removeSubtitles(streamTitle=subname)
|
|
|
|
movie.reload()
|
|
|
|
subtitles = [sub.title for sub in movie.subtitleStreams()]
|
|
|
|
assert subname not in subtitles
|
|
|
|
|
|
|
|
try:
|
|
|
|
os.remove(filepath)
|
2023-08-29 03:29:39 +00:00
|
|
|
except OSError:
|
2022-02-27 05:05:43 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2021-01-24 20:29:44 +00:00
|
|
|
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
|
|
|
|
|
2021-01-24 19:47:15 +00:00
|
|
|
|
2021-06-07 00:19:26 +00:00
|
|
|
@pytest.mark.authenticated
|
2021-06-07 01:39:45 +00:00
|
|
|
@pytest.mark.xfail(reason="Test account is missing online media sources?")
|
2021-06-07 00:19:26 +00:00
|
|
|
def test_video_Movie_augmentation(movie, account):
|
|
|
|
onlineMediaSources = account.onlineMediaSources()
|
|
|
|
tidalOptOut = next(
|
|
|
|
optOut for optOut in onlineMediaSources
|
|
|
|
if optOut.key == 'tv.plex.provider.music'
|
|
|
|
)
|
|
|
|
optOutValue = tidalOptOut.value
|
|
|
|
|
|
|
|
tidalOptOut.optOut()
|
|
|
|
with pytest.raises(BadRequest):
|
|
|
|
movie.augmentation()
|
|
|
|
|
|
|
|
tidalOptOut.optIn()
|
|
|
|
augmentations = movie.augmentation()
|
|
|
|
assert augmentations or augmentations == []
|
|
|
|
|
|
|
|
# Reset original Tidal opt out value
|
|
|
|
tidalOptOut._updateOptOut(optOutValue)
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_reviews(movies):
|
|
|
|
movie = movies.get("Sita Sings The Blues")
|
|
|
|
reviews = movie.reviews()
|
|
|
|
assert reviews
|
|
|
|
review = next(r for r in reviews if r.link)
|
|
|
|
assert review.filter
|
|
|
|
assert utils.is_int(review.id)
|
|
|
|
assert review.image.startswith("rottentomatoes://")
|
|
|
|
assert review.link.startswith("http")
|
|
|
|
assert review.source
|
|
|
|
assert review.tag
|
|
|
|
assert review.text
|
|
|
|
|
|
|
|
|
2022-08-27 13:17:33 +00:00
|
|
|
def test_video_Movie_editions(movie):
|
|
|
|
assert len(movie.editions()) == 0
|
|
|
|
|
|
|
|
|
2021-06-07 00:33:08 +00:00
|
|
|
@pytest.mark.authenticated
|
2023-08-27 21:24:54 +00:00
|
|
|
def test_video_Movie_extras(account_plexpass, movies):
|
2021-06-07 00:19:26 +00:00
|
|
|
movie = movies.get("Sita Sings The Blues")
|
|
|
|
extras = movie.extras()
|
|
|
|
assert extras
|
|
|
|
extra = extras[0]
|
|
|
|
assert extra.type == 'clip'
|
|
|
|
assert extra.section() == movies
|
|
|
|
|
2022-02-27 05:05:43 +00:00
|
|
|
|
2022-02-27 05:40:51 +00:00
|
|
|
def test_video_Movie_batchEdits(movie):
|
|
|
|
title = movie.title
|
|
|
|
summary = movie.summary
|
|
|
|
tagline = movie.tagline
|
|
|
|
studio = movie.studio
|
|
|
|
|
|
|
|
assert movie._edits is None
|
|
|
|
movie.batchEdits()
|
|
|
|
assert movie._edits == {}
|
|
|
|
|
|
|
|
new_title = "New title"
|
|
|
|
new_summary = "New summary"
|
|
|
|
new_tagline = "New tagline"
|
|
|
|
new_studio = "New studio"
|
|
|
|
movie.editTitle(new_title) \
|
|
|
|
.editSummary(new_summary) \
|
|
|
|
.editTagline(new_tagline) \
|
|
|
|
.editStudio(new_studio)
|
|
|
|
assert movie._edits != {}
|
2023-09-17 23:01:15 +00:00
|
|
|
movie.saveEdits().reload()
|
2022-02-27 05:40:51 +00:00
|
|
|
assert movie._edits is None
|
|
|
|
assert movie.title == new_title
|
|
|
|
assert movie.summary == new_summary
|
|
|
|
assert movie.tagline == new_tagline
|
|
|
|
assert movie.studio == new_studio
|
|
|
|
|
|
|
|
movie.batchEdits() \
|
|
|
|
.editTitle(title, locked=False) \
|
|
|
|
.editSummary(summary, locked=False) \
|
|
|
|
.editTagline(tagline, locked=False) \
|
|
|
|
.editStudio(studio, locked=False) \
|
2023-09-17 23:01:15 +00:00
|
|
|
.saveEdits().reload()
|
2022-02-27 05:40:51 +00:00
|
|
|
assert movie.title == title
|
|
|
|
assert movie.summary == summary
|
|
|
|
assert movie.tagline == tagline
|
|
|
|
assert movie.studio == studio
|
|
|
|
assert not movie.fields
|
2023-08-29 03:29:39 +00:00
|
|
|
|
2022-02-27 05:40:51 +00:00
|
|
|
with pytest.raises(BadRequest):
|
|
|
|
movie.saveEdits()
|
|
|
|
|
|
|
|
|
2022-02-27 05:05:43 +00:00
|
|
|
def test_video_Movie_mixins_edit_advanced_settings(movie):
|
|
|
|
test_mixins.edit_advanced_settings(movie)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.xfail(reason="Changing images fails randomly")
|
|
|
|
def test_video_Movie_mixins_images(movie):
|
|
|
|
test_mixins.lock_art(movie)
|
|
|
|
test_mixins.lock_poster(movie)
|
|
|
|
test_mixins.edit_art(movie)
|
|
|
|
test_mixins.edit_poster(movie)
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_mixins_themes(movie):
|
|
|
|
test_mixins.edit_theme(movie)
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_mixins_rating(movie):
|
|
|
|
test_mixins.edit_rating(movie)
|
|
|
|
|
|
|
|
|
2022-02-27 05:40:51 +00:00
|
|
|
def test_video_Movie_mixins_fields(movie):
|
2023-03-09 23:22:56 +00:00
|
|
|
test_mixins.edit_added_at(movie)
|
2022-02-27 05:40:51 +00:00
|
|
|
test_mixins.edit_content_rating(movie)
|
|
|
|
test_mixins.edit_originally_available(movie)
|
|
|
|
test_mixins.edit_original_title(movie)
|
|
|
|
test_mixins.edit_sort_title(movie)
|
|
|
|
test_mixins.edit_studio(movie)
|
|
|
|
test_mixins.edit_summary(movie)
|
|
|
|
test_mixins.edit_tagline(movie)
|
|
|
|
test_mixins.edit_title(movie)
|
2023-07-27 21:45:23 +00:00
|
|
|
test_mixins.edit_user_rating(movie)
|
2023-07-28 00:44:09 +00:00
|
|
|
|
|
|
|
|
2023-07-28 01:02:23 +00:00
|
|
|
@pytest.mark.anonymously
|
2023-07-28 00:44:09 +00:00
|
|
|
def test_video_Movie_mixins_fields_edition(movie):
|
2022-08-27 13:17:33 +00:00
|
|
|
with pytest.raises(BadRequest):
|
|
|
|
test_mixins.edit_edition_title(movie)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.authenticated
|
2023-08-27 21:24:54 +00:00
|
|
|
def test_video_Movie_mixins_fields_edition_authenticated(account_plexpass, movie):
|
2022-08-27 13:17:33 +00:00
|
|
|
test_mixins.edit_edition_title(movie)
|
2022-02-27 05:40:51 +00:00
|
|
|
|
|
|
|
|
2022-02-27 05:05:43 +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)
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_media_tags(movie):
|
|
|
|
movie.reload()
|
|
|
|
test_media.tag_collection(movie)
|
|
|
|
test_media.tag_country(movie)
|
|
|
|
test_media.tag_director(movie)
|
|
|
|
test_media.tag_genre(movie)
|
|
|
|
test_media.tag_label(movie)
|
|
|
|
test_media.tag_producer(movie)
|
|
|
|
test_media.tag_role(movie)
|
|
|
|
test_media.tag_similar(movie)
|
|
|
|
test_media.tag_writer(movie)
|
|
|
|
|
|
|
|
|
2021-08-04 21:02:01 +00:00
|
|
|
def test_video_Movie_PlexWebURL(plex, movie):
|
|
|
|
url = movie.getWebURL()
|
|
|
|
assert url.startswith('https://app.plex.tv/desktop')
|
|
|
|
assert plex.machineIdentifier in url
|
|
|
|
assert 'details' in url
|
|
|
|
assert quote_plus(movie.key) in url
|
|
|
|
# Test a different base
|
|
|
|
base = 'https://doesnotexist.com/plex'
|
|
|
|
url = movie.getWebURL(base=base)
|
|
|
|
assert url.startswith(base)
|
|
|
|
|
2021-06-07 00:19:26 +00:00
|
|
|
|
2023-05-24 19:03:28 +00:00
|
|
|
def test_video_Movie_continueWatching(plex, movies, movie):
|
|
|
|
assert movie not in plex.continueWatching()
|
|
|
|
assert movie not in movies.continueWatching()
|
|
|
|
movie.updateProgress(90000)
|
|
|
|
assert movie in plex.continueWatching()
|
|
|
|
assert movie in movies.continueWatching()
|
|
|
|
movie.markUnplayed()
|
|
|
|
assert movie not in plex.continueWatching()
|
|
|
|
assert movie not in movies.continueWatching()
|
|
|
|
|
|
|
|
|
2017-04-23 05:18:53 +00:00
|
|
|
def test_video_Show_attrs(show):
|
2017-04-29 05:47:21 +00:00
|
|
|
assert utils.is_datetime(show.addedAt)
|
2021-02-15 01:10:11 +00:00
|
|
|
if show.art:
|
|
|
|
assert utils.is_art(show.art)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(show.childCount)
|
|
|
|
assert show.contentRating in utils.CONTENTRATINGS
|
|
|
|
assert utils.is_int(show.duration, gte=1600000)
|
2017-02-08 07:00:43 +00:00
|
|
|
# Check reloading the show loads the full list of genres
|
2017-04-23 05:18:53 +00:00
|
|
|
show.reload()
|
2021-05-10 04:23:48 +00:00
|
|
|
assert utils.is_float(show.audienceRating)
|
2021-05-10 05:05:41 +00:00
|
|
|
assert show.audienceRatingImage == "themoviedb://image.rating"
|
2023-03-09 23:34:49 +00:00
|
|
|
assert show.audioLanguage == ''
|
2021-03-11 17:19:54 +00:00
|
|
|
assert show.autoDeletionItemPolicyUnwatchedLibrary == 0
|
|
|
|
assert show.autoDeletionItemPolicyWatchedLibrary == 0
|
2023-03-09 21:32:17 +00:00
|
|
|
assert show.enableCreditsMarkerGeneration == -1
|
2021-03-11 17:19:54 +00:00
|
|
|
assert show.episodeSort == -1
|
|
|
|
assert show.flattenSeasons == -1
|
2021-05-10 04:23:48 +00:00
|
|
|
assert "Drama" in [i.tag for i in show.genres]
|
|
|
|
assert show.guid == "plex://show/5d9c086c46115600200aa2fe"
|
|
|
|
assert "tvdb://121361" in [i.id for i in show.guids]
|
2017-01-09 14:21:54 +00:00
|
|
|
# So the initkey should have changed because of the reload
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(show._initpath)
|
|
|
|
assert utils.is_int(show.index)
|
|
|
|
assert utils.is_metadata(show.key)
|
2021-03-11 17:19:54 +00:00
|
|
|
assert show.languageOverride is None
|
2021-05-16 05:38:54 +00:00
|
|
|
assert utils.is_datetime(show.lastRatedAt)
|
2020-10-08 20:15:43 +00:00
|
|
|
assert utils.is_datetime(show.lastViewedAt)
|
2017-04-23 05:18:53 +00:00
|
|
|
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
|
2017-04-23 05:18:53 +00:00
|
|
|
assert len(show.locations[0]) >= 10
|
2021-03-11 17:19:54 +00:00
|
|
|
assert show.network is None
|
2020-04-14 20:13:30 +00:00
|
|
|
assert utils.is_datetime(show.originallyAvailableAt)
|
2021-02-14 22:28:54 +00:00
|
|
|
assert show.originalTitle is None
|
2021-05-10 04:23:48 +00:00
|
|
|
assert show.rating is None
|
2022-12-21 19:43:52 +00:00
|
|
|
if show.ratings:
|
|
|
|
assert "themoviedb://image.rating" in [i.image for i in show.ratings]
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(show.ratingKey)
|
2021-05-10 04:23:48 +00:00
|
|
|
if show.roles:
|
|
|
|
assert "Emilia Clarke" in [i.tag for i in show.roles]
|
|
|
|
assert show.actors == show.roles
|
2017-04-23 05:18:53 +00:00
|
|
|
assert show._server._baseurl == utils.SERVER_BASEURL
|
2023-03-09 21:18:59 +00:00
|
|
|
assert utils.is_int(show.seasonCount)
|
2021-03-11 17:19:54 +00:00
|
|
|
assert show.showOrdering in (None, 'aired')
|
2023-03-09 21:18:59 +00:00
|
|
|
assert show.studio == "Revolution Sun Studios"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_string(show.summary, gte=100)
|
2023-03-09 23:34:49 +00:00
|
|
|
assert show.subtitleLanguage == ''
|
|
|
|
assert show.subtitleMode == -1
|
2021-05-10 04:23:48 +00:00
|
|
|
assert show.tagline == "Winter is coming."
|
2020-04-29 21:23:22 +00:00
|
|
|
assert utils.is_metadata(show.theme, contains="/theme/")
|
2021-02-15 01:10:11 +00:00
|
|
|
if show.thumb:
|
|
|
|
assert utils.is_thumb(show.thumb)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert show.title == "Game of Thrones"
|
|
|
|
assert show.titleSort == "Game of Thrones"
|
|
|
|
assert show.type == "show"
|
2021-03-11 17:19:54 +00:00
|
|
|
assert show.useOriginalTitle == -1
|
|
|
|
assert show.userRating is None
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_datetime(show.updatedAt)
|
|
|
|
assert utils.is_int(show.viewCount, gte=0)
|
|
|
|
assert utils.is_int(show.viewedLeafCount, gte=0)
|
2021-05-10 04:23:48 +00:00
|
|
|
assert show.year == 2011
|
2017-11-08 21:01:53 +00:00
|
|
|
assert show.url(None) is None
|
2017-04-23 05:18:53 +00:00
|
|
|
|
|
|
|
|
2022-05-17 02:52:16 +00:00
|
|
|
def test_video_Show_episode(show):
|
|
|
|
episode = show.episode("Winter Is Coming")
|
|
|
|
assert episode == show.episode(season=1, episode=1)
|
|
|
|
with pytest.raises(BadRequest):
|
|
|
|
show.episode()
|
|
|
|
with pytest.raises(NotFound):
|
|
|
|
show.episode(season=1337, episode=1337)
|
|
|
|
|
|
|
|
|
2017-05-02 03:26:27 +00:00
|
|
|
def test_video_Show_watched(tvshows):
|
2020-04-29 21:23:22 +00:00
|
|
|
show = tvshows.get("The 100")
|
2021-03-02 01:54:43 +00:00
|
|
|
episode = show.episodes()[0]
|
2022-08-26 19:14:24 +00:00
|
|
|
episode.markPlayed()
|
2017-04-23 05:18:53 +00:00
|
|
|
watched = show.watched()
|
2020-04-29 21:23:22 +00:00
|
|
|
assert len(watched) == 1 and watched[0].title == "Pilot"
|
2022-08-26 19:14:24 +00:00
|
|
|
episode.markUnplayed()
|
2017-01-29 21:22:48 +00:00
|
|
|
|
2017-02-02 04:47:22 +00:00
|
|
|
|
2017-05-02 03:26:27 +00:00
|
|
|
def test_video_Show_unwatched(tvshows):
|
2020-04-29 21:23:22 +00:00
|
|
|
show = tvshows.get("The 100")
|
2017-04-23 05:18:53 +00:00
|
|
|
episodes = show.episodes()
|
2021-03-02 01:54:43 +00:00
|
|
|
episode = episodes[0]
|
2022-08-26 19:14:24 +00:00
|
|
|
episode.markPlayed()
|
2017-04-23 05:18:53 +00:00
|
|
|
unwatched = show.unwatched()
|
|
|
|
assert len(unwatched) == len(episodes) - 1
|
2022-08-26 19:14:24 +00:00
|
|
|
episode.markUnplayed()
|
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
|
|
|
|
|
|
|
|
|
2017-04-23 05:18:53 +00:00
|
|
|
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/")
|
2017-04-23 05:18:53 +00:00
|
|
|
assert len(show.roles) == 3
|
|
|
|
show.reload()
|
2020-04-29 21:23:22 +00:00
|
|
|
assert utils.is_metadata(show._initpath, prefix="/library/metadata/")
|
2017-04-23 05:18:53 +00:00
|
|
|
assert len(show.roles) > 3
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2017-05-02 03:26:27 +00:00
|
|
|
def test_video_Show_episodes(tvshows):
|
2020-04-29 21:23:22 +00:00
|
|
|
show = tvshows.get("The 100")
|
2017-04-23 05:18:53 +00:00
|
|
|
episodes = show.episodes()
|
2022-08-26 19:14:24 +00:00
|
|
|
episodes[0].markPlayed()
|
2017-04-23 05:18:53 +00:00
|
|
|
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
|
|
|
|
2017-04-23 05:18:53 +00:00
|
|
|
def test_video_Show_download(monkeydownload, tmpdir, show):
|
2021-11-20 22:16:58 +00:00
|
|
|
total = len(show.episodes())
|
2017-04-23 05:18:53 +00:00
|
|
|
filepaths = show.download(savepath=str(tmpdir))
|
2021-11-20 22:16:58 +00:00
|
|
|
assert len(filepaths) == total
|
|
|
|
subfolders = show.download(savepath=str(tmpdir), subfolders=True)
|
|
|
|
assert len(subfolders) == total
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2017-04-23 05:18:53 +00:00
|
|
|
def test_video_Season_download(monkeydownload, tmpdir, show):
|
2021-11-20 22:16:58 +00:00
|
|
|
season = show.season(1)
|
|
|
|
total = len(season.episodes())
|
2017-04-23 05:18:53 +00:00
|
|
|
filepaths = season.download(savepath=str(tmpdir))
|
2021-11-20 22:16:58 +00:00
|
|
|
assert len(filepaths) == total
|
2017-02-02 04:47:22 +00:00
|
|
|
|
2017-04-23 05:18:53 +00:00
|
|
|
|
|
|
|
def test_video_Episode_download(monkeydownload, tmpdir, episode):
|
2021-11-20 22:16:58 +00:00
|
|
|
filepaths = episode.download(savepath=str(tmpdir))
|
|
|
|
assert len(filepaths) == 1
|
|
|
|
with_resolution = episode.download(savepath=str(tmpdir), videoResolution="500x300")
|
|
|
|
assert len(with_resolution) == 1
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2017-05-02 03:34:43 +00:00
|
|
|
# Analyze seems to fail intermittently
|
2017-05-02 03:33:26 +00:00
|
|
|
@pytest.mark.xfail
|
2017-04-23 05:18:53 +00:00
|
|
|
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
|
|
|
|
2022-08-26 19:14:24 +00:00
|
|
|
def test_video_Show_markPlayed(show):
|
|
|
|
show.markPlayed()
|
2021-05-30 23:07:59 +00:00
|
|
|
show.reload()
|
2022-08-26 19:14:24 +00:00
|
|
|
assert show.isPlayed
|
2023-12-22 20:48:56 +00:00
|
|
|
assert show.isWatched
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2022-08-26 19:14:24 +00:00
|
|
|
def test_video_Show_markUnplayed(show):
|
|
|
|
show.markUnplayed()
|
2021-05-30 23:07:59 +00:00
|
|
|
show.reload()
|
2022-08-26 19:14:24 +00:00
|
|
|
assert not show.isPlayed
|
2023-12-22 20:48:56 +00:00
|
|
|
assert not show.isWatched
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2017-05-02 03:26:27 +00:00
|
|
|
def test_video_Show_refresh(show):
|
2017-01-09 14:21:54 +00:00
|
|
|
show.refresh()
|
|
|
|
|
|
|
|
|
2017-04-23 05:18:53 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
2022-08-26 19:14:24 +00:00
|
|
|
def test_video_Show_isPlayed(show):
|
|
|
|
assert not show.isPlayed
|
2017-01-09 14:21:54 +00:00
|
|
|
|
|
|
|
|
2017-04-23 05:18:53 +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-04-05 20:44:49 +00:00
|
|
|
def test_video_Show_mixins_edit_advanced_settings(show):
|
|
|
|
test_mixins.edit_advanced_settings(show)
|
|
|
|
|
|
|
|
|
2021-11-21 01:14:34 +00:00
|
|
|
@pytest.mark.xfail(reason="Changing images fails randomly")
|
2021-02-14 23:59:57 +00:00
|
|
|
def test_video_Show_mixins_images(show):
|
2021-09-13 00:56:21 +00:00
|
|
|
test_mixins.lock_art(show)
|
|
|
|
test_mixins.lock_poster(show)
|
2021-02-14 23:59:57 +00:00
|
|
|
test_mixins.edit_art(show)
|
|
|
|
test_mixins.edit_poster(show)
|
2021-02-15 05:19:42 +00:00
|
|
|
test_mixins.attr_artUrl(show)
|
|
|
|
test_mixins.attr_posterUrl(show)
|
2021-02-14 23:59:57 +00:00
|
|
|
|
|
|
|
|
2022-02-27 05:05:43 +00:00
|
|
|
def test_video_Show_mixins_themes(show):
|
|
|
|
test_mixins.edit_theme(show)
|
|
|
|
|
|
|
|
|
2021-05-30 22:49:28 +00:00
|
|
|
def test_video_Show_mixins_rating(show):
|
|
|
|
test_mixins.edit_rating(show)
|
|
|
|
|
|
|
|
|
2022-02-27 05:40:51 +00:00
|
|
|
def test_video_Show_mixins_fields(show):
|
2023-03-09 23:22:56 +00:00
|
|
|
test_mixins.edit_added_at(show)
|
2022-02-27 05:40:51 +00:00
|
|
|
test_mixins.edit_content_rating(show)
|
|
|
|
test_mixins.edit_originally_available(show)
|
|
|
|
test_mixins.edit_original_title(show)
|
|
|
|
test_mixins.edit_sort_title(show)
|
|
|
|
test_mixins.edit_studio(show)
|
|
|
|
test_mixins.edit_summary(show)
|
|
|
|
test_mixins.edit_tagline(show)
|
|
|
|
test_mixins.edit_title(show)
|
2023-07-27 21:45:23 +00:00
|
|
|
test_mixins.edit_user_rating(show)
|
2022-02-27 05:40:51 +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
|
|
|
|
|
|
|
|
2021-05-09 22:05:06 +00:00
|
|
|
def test_video_Show_media_tags(show):
|
|
|
|
show.reload()
|
|
|
|
test_media.tag_collection(show)
|
|
|
|
test_media.tag_genre(show)
|
|
|
|
test_media.tag_label(show)
|
|
|
|
test_media.tag_role(show)
|
|
|
|
test_media.tag_similar(show)
|
|
|
|
|
|
|
|
|
2021-08-04 21:02:01 +00:00
|
|
|
def test_video_Show_PlexWebURL(plex, show):
|
|
|
|
url = show.getWebURL()
|
|
|
|
assert url.startswith('https://app.plex.tv/desktop')
|
|
|
|
assert plex.machineIdentifier in url
|
|
|
|
assert 'details' in url
|
|
|
|
assert quote_plus(show.key) in url
|
|
|
|
|
|
|
|
|
2022-05-18 18:04:18 +00:00
|
|
|
@pytest.mark.authenticated
|
|
|
|
def test_video_Show_streamingServices(show):
|
|
|
|
assert show.streamingServices()
|
|
|
|
|
|
|
|
|
2021-05-10 04:23:48 +00:00
|
|
|
def test_video_Season(show):
|
|
|
|
seasons = show.seasons()
|
|
|
|
assert len(seasons) == 2
|
|
|
|
assert ["Season 1", "Season 2"] == [s.title for s in seasons[:2]]
|
|
|
|
assert show.season("Season 1") == seasons[0]
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Season_attrs(show):
|
|
|
|
season = show.season("Season 1")
|
|
|
|
assert utils.is_datetime(season.addedAt)
|
|
|
|
if season.art:
|
|
|
|
assert utils.is_art(season.art)
|
2023-03-09 23:34:49 +00:00
|
|
|
assert season.audioLanguage == ''
|
2021-05-10 05:05:41 +00:00
|
|
|
assert season.guid == "plex://season/602e67d31d3358002c411c39"
|
2021-05-10 04:23:48 +00:00
|
|
|
assert "tvdb://364731" in [i.id for i in season.guids]
|
|
|
|
assert season.index == 1
|
|
|
|
assert utils.is_metadata(season._initpath)
|
|
|
|
assert utils.is_metadata(season.key)
|
2021-05-24 03:39:08 +00:00
|
|
|
assert utils.is_datetime(season.lastRatedAt)
|
2021-05-10 04:23:48 +00:00
|
|
|
assert utils.is_datetime(season.lastViewedAt)
|
|
|
|
assert utils.is_int(season.leafCount, gte=3)
|
|
|
|
assert season.listType == "video"
|
|
|
|
assert season.parentGuid == "plex://show/5d9c086c46115600200aa2fe"
|
|
|
|
assert season.parentIndex == 1
|
|
|
|
assert utils.is_metadata(season.parentKey)
|
|
|
|
assert utils.is_int(season.parentRatingKey)
|
2023-03-09 21:18:59 +00:00
|
|
|
assert season.parentStudio == "Revolution Sun Studios"
|
2022-02-27 05:05:43 +00:00
|
|
|
assert utils.is_metadata(season.parentTheme)
|
2021-05-10 04:23:48 +00:00
|
|
|
if season.parentThumb:
|
|
|
|
assert utils.is_thumb(season.parentThumb)
|
|
|
|
assert season.parentTitle == "Game of Thrones"
|
2022-12-21 19:43:52 +00:00
|
|
|
if show.ratings:
|
|
|
|
assert "themoviedb://image.rating" in [i.image for i in show.ratings]
|
2021-05-10 04:23:48 +00:00
|
|
|
assert utils.is_int(season.ratingKey)
|
|
|
|
assert season._server._baseurl == utils.SERVER_BASEURL
|
2021-05-10 05:05:41 +00:00
|
|
|
assert utils.is_string(season.summary, gte=100)
|
2023-03-09 23:34:49 +00:00
|
|
|
assert season.subtitleLanguage == ''
|
|
|
|
assert season.subtitleMode == -1
|
2021-05-10 04:23:48 +00:00
|
|
|
if season.thumb:
|
|
|
|
assert utils.is_thumb(season.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)
|
2023-03-09 21:18:59 +00:00
|
|
|
assert season.year in (None, 2011)
|
2021-05-10 04:23:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_video_Season_show(show):
|
|
|
|
season = show.seasons()[0]
|
|
|
|
season_by_name = show.season("Season 1")
|
|
|
|
assert show.ratingKey == season.parentRatingKey and season_by_name.parentRatingKey
|
|
|
|
assert season.ratingKey == season_by_name.ratingKey
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Season_watched(show):
|
|
|
|
season = show.season("Season 1")
|
2022-08-26 19:14:24 +00:00
|
|
|
season.markPlayed()
|
2021-05-30 23:07:59 +00:00
|
|
|
season.reload()
|
2022-08-26 19:14:24 +00:00
|
|
|
assert season.isPlayed
|
2021-05-10 04:23:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_video_Season_unwatched(show):
|
|
|
|
season = show.season("Season 1")
|
2022-08-26 19:14:24 +00:00
|
|
|
season.markUnplayed()
|
2021-05-30 23:07:59 +00:00
|
|
|
season.reload()
|
2022-08-26 19:14:24 +00:00
|
|
|
assert not season.isPlayed
|
2021-05-10 04:23:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_video_Season_get(show):
|
|
|
|
episode = show.season("Season 1").get("Winter Is Coming")
|
|
|
|
assert episode.title == "Winter Is Coming"
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Season_episode(show):
|
2022-05-17 02:52:16 +00:00
|
|
|
season = show.season("Season 1")
|
|
|
|
episode = season.get("Winter Is Coming")
|
2021-05-10 04:23:48 +00:00
|
|
|
assert episode.title == "Winter Is Coming"
|
2022-05-17 02:52:16 +00:00
|
|
|
episode = season.episode(episode=1)
|
|
|
|
assert episode.index == 1
|
|
|
|
episode = season.episode(1)
|
2021-05-10 04:23:48 +00:00
|
|
|
assert episode.index == 1
|
2022-05-17 02:52:16 +00:00
|
|
|
with pytest.raises(BadRequest):
|
|
|
|
season.episode()
|
2021-05-10 04:23:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_video_Season_episodes(show):
|
|
|
|
episodes = show.season("Season 2").episodes()
|
|
|
|
assert len(episodes) >= 1
|
|
|
|
|
|
|
|
|
2021-11-21 01:14:34 +00:00
|
|
|
@pytest.mark.xfail(reason="Changing images fails randomly")
|
2021-05-10 04:23:48 +00:00
|
|
|
def test_video_Season_mixins_images(show):
|
|
|
|
season = show.season(season=1)
|
2021-09-13 00:56:21 +00:00
|
|
|
test_mixins.lock_art(season)
|
|
|
|
test_mixins.lock_poster(season)
|
2021-05-10 04:23:48 +00:00
|
|
|
test_mixins.edit_art(season)
|
|
|
|
test_mixins.edit_poster(season)
|
|
|
|
test_mixins.attr_artUrl(season)
|
|
|
|
test_mixins.attr_posterUrl(season)
|
|
|
|
|
|
|
|
|
2022-02-27 05:05:43 +00:00
|
|
|
def test_video_Season_mixins_themes(show):
|
|
|
|
season = show.season(season=1)
|
|
|
|
test_mixins.attr_themeUrl(season)
|
|
|
|
|
|
|
|
|
2021-05-30 22:49:28 +00:00
|
|
|
def test_video_Season_mixins_rating(show):
|
|
|
|
season = show.season(season=1)
|
|
|
|
test_mixins.edit_rating(season)
|
|
|
|
|
|
|
|
|
2022-02-27 05:40:51 +00:00
|
|
|
def test_video_Season_mixins_fields(show):
|
|
|
|
season = show.season(season=1)
|
2023-03-09 23:22:56 +00:00
|
|
|
test_mixins.edit_added_at(season)
|
2022-02-27 05:40:51 +00:00
|
|
|
test_mixins.edit_summary(season)
|
|
|
|
test_mixins.edit_title(season)
|
2023-07-27 21:45:23 +00:00
|
|
|
test_mixins.edit_user_rating(season)
|
2022-02-27 05:40:51 +00:00
|
|
|
|
|
|
|
|
2021-05-10 04:23:48 +00:00
|
|
|
def test_video_Season_mixins_tags(show):
|
|
|
|
season = show.season(season=1)
|
|
|
|
test_mixins.edit_collection(season)
|
2022-02-27 01:32:18 +00:00
|
|
|
test_mixins.edit_label(season)
|
2021-05-10 04:23:48 +00:00
|
|
|
|
|
|
|
|
2021-08-04 21:02:01 +00:00
|
|
|
def test_video_Season_PlexWebURL(plex, season):
|
|
|
|
url = season.getWebURL()
|
|
|
|
assert url.startswith('https://app.plex.tv/desktop')
|
|
|
|
assert plex.machineIdentifier in url
|
|
|
|
assert 'details' in url
|
|
|
|
assert quote_plus(season.key) in url
|
|
|
|
|
|
|
|
|
2021-05-10 04:23:48 +00:00
|
|
|
def test_video_Episode_updateProgress(episode, patched_http_call):
|
2021-07-05 04:32:58 +00:00
|
|
|
episode.updateProgress(2 * 60 * 1000) # 2 minutes.
|
2021-05-10 04:23:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_video_Episode_updateTimeline(episode, patched_http_call):
|
|
|
|
episode.updateTimeline(
|
2021-07-05 04:32:58 +00:00
|
|
|
2 * 60 * 1000, state="playing", duration=episode.duration
|
|
|
|
) # 2 minutes.
|
2021-05-10 04:23:48 +00:00
|
|
|
|
|
|
|
|
2022-07-21 03:03:20 +00:00
|
|
|
def test_video_Episode(show):
|
|
|
|
episode = show.episode("Winter Is Coming")
|
|
|
|
assert episode == show.episode(season=1, episode=1)
|
|
|
|
with pytest.raises(BadRequest):
|
|
|
|
show.episode()
|
|
|
|
with pytest.raises(NotFound):
|
|
|
|
show.episode(season=1337, episode=1337)
|
2021-05-10 04:23:48 +00:00
|
|
|
|
|
|
|
|
2021-02-05 03:03:29 +00:00
|
|
|
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()
|
|
|
|
|
|
|
|
|
2021-02-05 02:16:53 +00:00
|
|
|
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
|
2017-04-23 05:18:53 +00:00
|
|
|
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)
|
2017-04-23 05:18:53 +00:00
|
|
|
episode.analyze()
|
|
|
|
|
|
|
|
|
|
|
|
def test_video_Episode_attrs(episode):
|
|
|
|
assert utils.is_datetime(episode.addedAt)
|
2021-02-15 01:10:11 +00:00
|
|
|
if episode.art:
|
|
|
|
assert utils.is_art(episode.art)
|
2021-05-10 04:23:48 +00:00
|
|
|
assert utils.is_float(episode.audienceRating)
|
2021-05-10 05:05:41 +00:00
|
|
|
assert episode.audienceRatingImage == "themoviedb://image.rating"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert episode.contentRating in utils.CONTENTRATINGS
|
2021-05-10 04:23:48 +00:00
|
|
|
if episode.directors:
|
|
|
|
assert "Timothy Van Patten" in [i.tag for i in episode.directors]
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(episode.duration, gte=120000)
|
2021-02-15 03:03:19 +00:00
|
|
|
if episode.grandparentArt:
|
|
|
|
assert utils.is_art(episode.grandparentArt)
|
2021-05-10 04:23:48 +00:00
|
|
|
assert episode.grandparentGuid == "plex://show/5d9c086c46115600200aa2fe"
|
|
|
|
assert utils.is_metadata(episode.grandparentKey)
|
|
|
|
assert utils.is_int(episode.grandparentRatingKey)
|
|
|
|
assert utils.is_metadata(episode.grandparentTheme)
|
2021-02-15 03:03:19 +00:00
|
|
|
if episode.grandparentThumb:
|
|
|
|
assert utils.is_thumb(episode.grandparentThumb)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert episode.grandparentTitle == "Game of Thrones"
|
2021-05-10 05:05:41 +00:00
|
|
|
assert episode.guid == "plex://episode/5d9c1275e98e47001eb84029"
|
2021-05-10 04:23:48 +00:00
|
|
|
assert "tvdb://3254641" in [i.id for i in episode.guids]
|
2021-05-11 01:13:47 +00:00
|
|
|
assert episode.hasPreviewThumbnails is False
|
2017-04-23 05:18:53 +00:00
|
|
|
assert episode.index == 1
|
2021-05-11 01:13:31 +00:00
|
|
|
assert episode.episodeNumber == episode.index
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(episode._initpath)
|
|
|
|
assert utils.is_metadata(episode.key)
|
2021-05-16 05:38:54 +00:00
|
|
|
assert utils.is_datetime(episode.lastRatedAt)
|
|
|
|
assert utils.is_datetime(episode.lastViewedAt)
|
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)
|
2021-05-10 05:05:41 +00:00
|
|
|
assert episode.parentGuid == "plex://season/602e67d31d3358002c411c39"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(episode.parentIndex)
|
2021-05-11 01:13:31 +00:00
|
|
|
assert episode.seasonNumber == episode.parentIndex
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_metadata(episode.parentKey)
|
|
|
|
assert utils.is_int(episode.parentRatingKey)
|
2021-02-15 03:03:19 +00:00
|
|
|
if episode.parentThumb:
|
|
|
|
assert utils.is_thumb(episode.parentThumb)
|
2021-05-10 04:23:48 +00:00
|
|
|
assert episode.parentTitle == "Season 1"
|
2021-05-10 05:05:41 +00:00
|
|
|
assert episode.parentYear is None
|
2021-07-27 01:36:54 +00:00
|
|
|
if episode.producers:
|
|
|
|
assert episode.producers # Test episode doesn't have producers
|
2021-05-10 04:23:48 +00:00
|
|
|
assert episode.rating is None
|
2022-12-21 19:43:52 +00:00
|
|
|
if episode.ratings:
|
|
|
|
assert "themoviedb://image.rating" in [i.image for i in episode.ratings]
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(episode.ratingKey)
|
2021-07-27 01:36:54 +00:00
|
|
|
if episode.roles:
|
|
|
|
assert "Jason Momoa" in [i.tag for i in episode.roles]
|
|
|
|
assert episode.actors == episode.roles
|
2017-04-23 05:18:53 +00:00
|
|
|
assert episode._server._baseurl == utils.SERVER_BASEURL
|
2021-02-05 03:03:29 +00:00
|
|
|
assert episode.skipParent is False
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_string(episode.summary, gte=100)
|
2021-02-15 01:10:11 +00:00
|
|
|
if episode.thumb:
|
|
|
|
assert utils.is_thumb(episode.thumb)
|
2020-04-29 21:23:22 +00:00
|
|
|
assert episode.title == "Winter Is Coming"
|
|
|
|
assert episode.titleSort == "Winter Is Coming"
|
|
|
|
assert episode.type == "episode"
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_datetime(episode.updatedAt)
|
2021-05-10 04:23:48 +00:00
|
|
|
assert episode.userRating is None
|
2017-05-02 03:26:27 +00:00
|
|
|
assert utils.is_int(episode.viewCount, gte=0)
|
2017-04-23 05:18:53 +00:00
|
|
|
assert episode.viewOffset == 0
|
2021-05-10 04:23:48 +00:00
|
|
|
if episode.writers:
|
2022-05-16 18:45:27 +00:00
|
|
|
assert "David Benioff" in [i.tag for i in episode.writers]
|
2023-02-03 07:23:13 +00:00
|
|
|
assert episode.year == 2011
|
2022-08-26 19:14:24 +00:00
|
|
|
assert episode.isPlayed in [True, False]
|
2020-12-24 07:03:08 +00:00
|
|
|
assert len(episode.locations) == 1
|
|
|
|
assert len(episode.locations[0]) >= 10
|
2021-05-11 01:13:31 +00:00
|
|
|
assert episode.seasonEpisode == "s01e01"
|
2017-04-23 05:18:53 +00:00
|
|
|
# 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)
|
2017-04-23 05:18:53 +00:00
|
|
|
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
|
2021-05-11 01:13:47 +00:00
|
|
|
assert part.hasPreviewThumbnails is False
|
2017-04-23 05:18:53 +00:00
|
|
|
assert utils.is_int(part.id)
|
|
|
|
assert utils.is_metadata(part._initpath)
|
|
|
|
assert len(part.key) >= 10
|
|
|
|
assert part._server._baseurl == utils.SERVER_BASEURL
|
2018-09-14 18:03:23 +00:00
|
|
|
assert utils.is_int(part.size, gte=18184197)
|
2019-10-01 01:25:10 +00:00
|
|
|
assert part.exists
|
|
|
|
assert part.accessible
|
2017-04-23 05:18:53 +00:00
|
|
|
|
|
|
|
|
2021-04-24 18:26:31 +00:00
|
|
|
def test_video_Episode_watched(tvshows):
|
|
|
|
season = tvshows.get("The 100").season(1)
|
|
|
|
episode = season.episode(1)
|
2022-08-26 19:14:24 +00:00
|
|
|
episode.markPlayed()
|
2021-04-24 18:26:31 +00:00
|
|
|
watched = season.watched()
|
|
|
|
assert len(watched) == 1 and watched[0].title == "Pilot"
|
2022-08-26 19:14:24 +00:00
|
|
|
episode.markUnplayed()
|
2021-04-24 18:26:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_video_Episode_unwatched(tvshows):
|
|
|
|
season = tvshows.get("The 100").season(1)
|
|
|
|
episodes = season.episodes()
|
|
|
|
episode = episodes[0]
|
2022-08-26 19:14:24 +00:00
|
|
|
episode.markPlayed()
|
2021-04-24 18:26:31 +00:00
|
|
|
unwatched = season.unwatched()
|
|
|
|
assert len(unwatched) == len(episodes) - 1
|
2022-08-26 19:14:24 +00:00
|
|
|
episode.markUnplayed()
|
2021-04-24 18:26:31 +00:00
|
|
|
|
|
|
|
|
2021-11-21 01:14:34 +00:00
|
|
|
@pytest.mark.xfail(reason="Changing images fails randomly")
|
2021-02-14 23:59:57 +00:00
|
|
|
def test_video_Episode_mixins_images(episode):
|
2021-09-13 00:56:21 +00:00
|
|
|
test_mixins.lock_art(episode)
|
|
|
|
test_mixins.lock_poster(episode)
|
|
|
|
# test_mixins.edit_art(episode) # Uploading episode artwork is broken in Plex
|
2021-02-14 23:59:57 +00:00
|
|
|
test_mixins.edit_poster(episode)
|
2021-02-15 05:19:42 +00:00
|
|
|
test_mixins.attr_artUrl(episode)
|
|
|
|
test_mixins.attr_posterUrl(episode)
|
2021-02-14 23:59:57 +00:00
|
|
|
|
|
|
|
|
2022-02-27 05:05:43 +00:00
|
|
|
def test_video_Episode_mixins_themes(episode):
|
|
|
|
test_mixins.attr_themeUrl(episode)
|
|
|
|
|
|
|
|
|
2021-05-30 22:49:28 +00:00
|
|
|
def test_video_Episode_mixins_rating(episode):
|
|
|
|
test_mixins.edit_rating(episode)
|
|
|
|
|
|
|
|
|
2022-02-27 05:40:51 +00:00
|
|
|
def test_video_Episode_mixins_fields(episode):
|
2023-03-09 23:22:56 +00:00
|
|
|
test_mixins.edit_added_at(episode)
|
2022-02-27 05:40:51 +00:00
|
|
|
test_mixins.edit_content_rating(episode)
|
|
|
|
test_mixins.edit_originally_available(episode)
|
|
|
|
test_mixins.edit_sort_title(episode)
|
|
|
|
test_mixins.edit_summary(episode)
|
|
|
|
test_mixins.edit_title(episode)
|
2023-07-27 21:45:23 +00:00
|
|
|
test_mixins.edit_user_rating(episode)
|
2022-02-27 05:40:51 +00:00
|
|
|
|
|
|
|
|
2021-01-24 23:03:23 +00:00
|
|
|
def test_video_Episode_mixins_tags(episode):
|
2021-05-09 19:27:38 +00:00
|
|
|
test_mixins.edit_collection(episode)
|
2021-01-24 23:03:23 +00:00
|
|
|
test_mixins.edit_director(episode)
|
|
|
|
test_mixins.edit_writer(episode)
|
2022-02-27 01:32:18 +00:00
|
|
|
test_mixins.edit_label(episode)
|
2021-01-24 22:40:02 +00:00
|
|
|
|
|
|
|
|
2021-05-09 22:05:06 +00:00
|
|
|
def test_video_Episode_media_tags(episode):
|
|
|
|
episode.reload()
|
|
|
|
test_media.tag_collection(episode)
|
|
|
|
test_media.tag_director(episode)
|
|
|
|
test_media.tag_writer(episode)
|
2021-05-09 19:27:38 +00:00
|
|
|
|
|
|
|
|
2021-08-04 21:02:01 +00:00
|
|
|
def test_video_Episode_PlexWebURL(plex, episode):
|
|
|
|
url = episode.getWebURL()
|
|
|
|
assert url.startswith('https://app.plex.tv/desktop')
|
|
|
|
assert plex.machineIdentifier in url
|
|
|
|
assert 'details' in url
|
|
|
|
assert quote_plus(episode.key) in url
|
|
|
|
|
|
|
|
|
2023-05-24 19:03:28 +00:00
|
|
|
def test_video_Episode_continueWatching(plex, tvshows, episode):
|
|
|
|
assert episode not in plex.continueWatching()
|
|
|
|
assert episode not in tvshows.continueWatching()
|
|
|
|
episode.updateProgress(90000)
|
|
|
|
assert episode in plex.continueWatching()
|
|
|
|
assert episode in tvshows.continueWatching()
|
|
|
|
episode.markUnplayed()
|
|
|
|
assert episode not in plex.continueWatching()
|
|
|
|
assert episode not in tvshows.continueWatching()
|
|
|
|
|
|
|
|
|
2017-04-23 05:18:53 +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
|
2017-07-26 22:55:31 +00:00
|
|
|
|
2019-10-01 01:27:13 +00:00
|
|
|
|
|
|
|
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
|
2020-02-13 20:04:03 +00:00
|
|
|
|
|
|
|
|
2020-06-12 18:15:53 +00:00
|
|
|
def test_video_edits_locked(movie, episode):
|
2021-01-24 20:21:56 +00:00
|
|
|
edits = {'titleSort.value': 'New Title Sort', 'titleSort.locked': 1}
|
2020-06-12 18:15:53 +00:00
|
|
|
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
|
2023-11-13 18:56:30 +00:00
|
|
|
assert movie.isLocked(field=field.name)
|
2020-06-12 18:15:53 +00:00
|
|
|
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
|
2023-11-13 18:56:30 +00:00
|
|
|
assert episode.isLocked(field=field.name)
|
2020-06-12 18:15:53 +00:00
|
|
|
episode.edit(**{'titleSort.value': episodeTitleSort, 'titleSort.locked': 0})
|
|
|
|
|
|
|
|
|
2022-07-21 03:07:39 +00:00
|
|
|
@pytest.mark.xfail(
|
2020-04-29 21:23:22 +00:00
|
|
|
reason="broken? assert len(plex.conversions()) == 1 may fail on some builds"
|
|
|
|
)
|
2022-07-21 03:07:39 +00:00
|
|
|
def test_video_optimize(plex, movie, tvshows, show):
|
2020-02-13 20:04:03 +00:00
|
|
|
plex.optimizedItems(removeAll=True)
|
2022-07-21 03:07:39 +00:00
|
|
|
movie.optimize(target="mobile")
|
2020-02-17 22:35:07 +00:00
|
|
|
plex.conversions(pause=True)
|
2020-02-13 20:04:03 +00:00
|
|
|
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]
|
2021-05-14 23:29:44 +00:00
|
|
|
videos = optimized.items()
|
|
|
|
assert movie in videos
|
2020-02-13 20:04:03 +00:00
|
|
|
plex.optimizedItems(removeAll=True)
|
2020-04-14 20:13:30 +00:00
|
|
|
assert len(plex.optimizedItems()) == 0
|
2022-07-21 03:07:39 +00:00
|
|
|
|
|
|
|
locations = tvshows._locations()
|
|
|
|
show.optimize(
|
|
|
|
deviceProfile="Universal TV",
|
|
|
|
videoQuality=VIDEO_QUALITY_3_MBPS_720p,
|
|
|
|
locationID=locations[0].id,
|
|
|
|
limit=1,
|
|
|
|
unwatched=True
|
|
|
|
)
|
|
|
|
assert len(plex.optimizedItems()) == 1
|
|
|
|
plex.optimizedItems(removeAll=True)
|
|
|
|
assert len(plex.optimizedItems()) == 0
|
|
|
|
|
|
|
|
with pytest.raises(BadRequest):
|
|
|
|
movie.optimize()
|
|
|
|
with pytest.raises(BadRequest):
|
|
|
|
movie.optimize(target="mobile", locationID=-100)
|
2023-08-27 19:59:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_video_Movie_matadataDirectory(movie):
|
|
|
|
assert os.path.exists(os.path.join(utils.BOOTSTRAP_DATA_PATH, movie.metadataDirectory))
|
|
|
|
|
|
|
|
for poster in movie.posters():
|
|
|
|
if not poster.ratingKey.startswith('http'):
|
|
|
|
assert os.path.exists(os.path.join(utils.BOOTSTRAP_DATA_PATH, poster.resourceFilepath))
|
|
|
|
|
|
|
|
for art in movie.arts():
|
|
|
|
if not art.ratingKey.startswith('http'):
|
|
|
|
assert os.path.exists(os.path.join(utils.BOOTSTRAP_DATA_PATH, art.resourceFilepath))
|