Closed ianweatherburn closed 2 years ago
Can you provide the full Plex XML data for that episode?
https://support.plex.tv/articles/201998867-investigate-media-information-and-formats/
<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="2" librarySectionTitle="Series" librarySectionUUID="b8840128-82a9-4ba6-b7d0-b3a67c2ce508" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1652169221">
<Video ratingKey="103520" key="/library/metadata/103520" parentRatingKey="103519" grandparentRatingKey="103397" guid="plex://episode/5d9c10fcec357c001f9cb0ba" parentGuid="plex://season/61a1429327dbcb4678009aee" grandparentGuid="plex://show/5d9c08524eefaa001f5da593" type="episode" title="Pilot" grandparentKey="/library/metadata/103397" parentKey="/library/metadata/103519" librarySectionTitle="Series" librarySectionID="2" librarySectionKey="/library/sections/2" grandparentTitle="Fear the Walking Dead" parentTitle="Season 1" contentRating="TV-MA" summary="A highly dysfunctional blended family is forced together when they realize a reported virus is actually the onset of the undead apocalypse." index="1" parentIndex="1" audienceRating="6.9" thumb="/library/metadata/103520/thumb/1653574965" art="/library/metadata/103397/art/1653574947" parentThumb="/library/metadata/103519/thumb/1653574965" grandparentThumb="/library/metadata/103397/thumb/1653574947" grandparentArt="/library/metadata/103397/art/1653574947" grandparentTheme="/library/metadata/103397/theme/1653574947" duration="3822752" originallyAvailableAt="2015-08-23" addedAt="1653574963" updatedAt="1653574965" audienceRatingImage="themoviedb://image.rating">
<Media id="144108" duration="3822752" bitrate="3685" width="1280" height="720" aspectRatio="1.78" audioChannels="6" audioCodec="ac3" videoCodec="h264" videoResolution="720" container="mkv" videoFrameRate="24p" videoProfile="high">
<Part accessible="1" exists="1" id="145178" key="/library/parts/145178/1653629851/file.mkv" duration="3822752" file="/mnt/Videos/Series/Fear the Walking Dead/Season 1/Fear the Walking Dead S01E01 - Pilot.mkv" size="1761070441" container="mkv" videoProfile="high">
<Stream id="490284" streamType="1" default="1" codec="h264" index="0" bitrate="3301" language="English" languageTag="en" languageCode="eng" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="720" codedWidth="1280" colorRange="tv" colorSpace="bt709" frameRate="23.976" hasScalingMatrix="0" height="720" level="41" profile="high" refFrames="5" scanType="progressive" width="1280" displayTitle="720p (H.264)" extendedDisplayTitle="720p (H.264)"> </Stream>
<Stream id="490285" streamType="2" selected="1" default="1" codec="ac3" index="1" channels="6" bitrate="384" audioChannelLayout="5.1(side)" samplingRate="48000" displayTitle="Unknown (AC3 5.1)" extendedDisplayTitle="Unknown (AC3 5.1)"> </Stream>
<Stream id="490316" key="/library/streams/490316" streamType="3" selected="1" codec="srt" language="English" languageTag="en" languageCode="eng" format="srt" displayTitle="English (SRT External)" extendedDisplayTitle="English (SRT External)"> </Stream>
</Part>
</Media>
<Director id="62030" filter="director=62030" tag="Adam Davidson"/>
<Writer id="75790" filter="writer=75790" tag="Robert Kirkman"/>
<Writer id="148174" filter="writer=148174" tag="Dave Erickson"/>
<Guid id="imdb://tt4417020"/>
<Guid id="tmdb://1091692"/>
<Guid id="tvdb://5105118"/>
<Rating image="themoviedb://image.rating" value="6.9" type="audience"/>
<Role id="170796" filter="actor=170796" tag="Maestro Harrell" role="Matt Sale" thumb="https://metadata-static.plex.tv/people/5d7768337e9a3c0020c6c3b2.jpg"/>
<Role id="22128" filter="actor=22128" tag="Scott Lawrence" role="Art Costa" thumb="https://metadata-static.plex.tv/people/5d77683154c0f0001f303001.jpg"/>
<Role id="15972" filter="actor=15972" tag="Keith Powers" role="Calvin" thumb="https://metadata-static.plex.tv/people/5d776af07a53e9001e71437c.jpg"/>
<Role id="198257" filter="actor=198257" tag="Lincoln A. Castellanos" role="Tobias" thumb="https://metadata-static.plex.tv/e/people/e8a80e4784ce9dfeaeb20a3b1afaea51.jpg"/>
<Role id="90809" filter="actor=90809" tag="Lynn Chen" role="Nurse" thumb="https://metadata-static.plex.tv/people/5d7768445af944001f1fd04b.jpg"/>
<Role id="198258" filter="actor=198258" tag="Leon G. Thomas III" role="Russell" thumb="https://metadata-static.plex.tv/people/5d77682f54c0f0001f302ca6.jpg"/>
<Role id="198259" filter="actor=198259" tag="Casey Larios" role="Junkie (uncredited)" thumb="https://metadata-static.plex.tv/8/people/84f5a334bad5353fb53b24922e51afd0.jpg"/>
<Role id="102991" filter="actor=102991" tag="Andrew Patrick Ralston" role="Lab Coat" thumb="https://metadata-static.plex.tv/a/people/ab23786d6a3510d25fc6a26c55b315d4.jpg"/>
<Role id="198260" filter="actor=198260" tag="Sean Quezada" role="Zombie"/>
<Role id="198261" filter="actor=198261" tag="Chaize Macklin" role="Student" thumb="https://metadata-static.plex.tv/1/people/10af9015477ce34b598abf6eabd7b2ac.jpg"/>
<Role id="14849" filter="actor=14849" tag="Lexi Johnson" role="Gloria" thumb="https://metadata-static.plex.tv/a/people/a3489d796ccb7789793f103cb2aeece5.jpg"/>
<Role id="116907" filter="actor=116907" tag="Donald Agnelli" role="Driver" thumb="https://metadata-static.plex.tv/a/people/a5f82c6775522762604dcbf1ef1f9184.jpg"/>
<Role id="81886" filter="actor=81886" tag="Carlos E. Campos" role="Faculty Member" thumb="https://metadata-static.plex.tv/people/5d776c6c96b655001fe301dd.jpg"/>
<Role id="20007" filter="actor=20007" tag="Angelyna Martinez" role="Professeur de Physique" thumb="https://metadata-static.plex.tv/people/5d776a51ad5437001f779b97.jpg"/>
<Extras size="0"> </Extras>
<Related> </Related>
</Video>
</MediaContainer>
There are also specials in that Series (not sure if that is causing an issue?)
<Video ratingKey="103414" key="/library/metadata/103414" parentRatingKey="103413" grandparentRatingKey="103397" guid="plex://episode/5d9c10fcffd9ef001e9eff77" parentGuid="plex://season/61a1429327dbcb4678009aeb" grandparentGuid="plex://show/5d9c08524eefaa001f5da593" type="episode" title="Flight 462: Part 1" grandparentKey="/library/metadata/103397" parentKey="/library/metadata/103413" librarySectionTitle="Series" librarySectionID="2" librarySectionKey="/library/sections/2" grandparentTitle="Fear the Walking Dead" parentTitle="Specials" contentRating="TV-MA" summary="A routine flight takeoff is interrupted by an anxious passenger, a woman who knows more than she’s saying, and a distant scream on the other end of the phone. The pilot episode has been available online since October 4, 2015." index="1" parentIndex="0" audienceRating="4.5" thumb="/library/metadata/103414/thumb/1653574953" art="/library/metadata/103397/art/1653574947" parentThumb="/library/metadata/103413/thumb/1653574952" grandparentThumb="/library/metadata/103397/thumb/1653574947" grandparentArt="/library/metadata/103397/art/1653574947" grandparentTheme="/library/metadata/103397/theme/1653574947" duration="869036" originallyAvailableAt="2015-10-04" addedAt="1653574946" updatedAt="1653574953" audienceRatingImage="themoviedb://image.rating">
<Media id="144004" duration="869036" bitrate="2661" width="1280" height="720" aspectRatio="1.78" audioChannels="2" audioCodec="aac" videoCodec="mpeg4" videoResolution="720" container="mp4" videoFrameRate="NTSC" optimizedForStreaming="0" audioProfile="lc" has64bitOffsets="0" videoProfile="simple">
<Part accessible="1" exists="1" id="145074" key="/library/parts/145074/1653631644/file.mp4" duration="869036" file="/mnt/Videos/Series/Fear the Walking Dead/Specials/Fear the Walking Dead S00E01 - Flight 462.mp4" size="289067632" audioProfile="lc" container="mp4" has64bitOffsets="0" optimizedForStreaming="0" videoProfile="simple">
<Stream id="489966" streamType="1" default="1" codec="mpeg4" index="0" bitrate="2502" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" codecID="mp4v" codedHeight="720" codedWidth="1280" frameRate="29.970" height="720" level="1" profile="simple" refFrames="1" streamIdentifier="1" width="1280" displayTitle="720p (MPEG4)" extendedDisplayTitle="720p (MPEG4)"> </Stream>
<Stream id="489967" streamType="2" selected="1" default="1" codec="aac" index="1" channels="2" bitrate="152" audioChannelLayout="stereo" profile="lc" samplingRate="44100" streamIdentifier="2" displayTitle="Unknown (AAC Stereo)" extendedDisplayTitle="Unknown (AAC Stereo)"> </Stream>
<Stream id="490026" key="/library/streams/490026" streamType="3" selected="1" codec="srt" language="English" languageTag="en" languageCode="eng" format="srt" displayTitle="English (SRT External)" extendedDisplayTitle="English (SRT External)"> </Stream>
</Part>
</Media>
<Director id="198158" filter="director=198158" tag="Michael McDonough"/>
<Writer id="70576" filter="writer=70576" tag=" Lauren Signorino"/>
<Writer id="198159" filter="writer=198159" tag="Michael Zunic"/>
<Guid id="imdb://tt5115444"/>
<Guid id="tmdb://1103541"/>
<Guid id="tvdb://5358933"/>
<Rating image="themoviedb://image.rating" value="4.5" type="audience"/>
<Role id="7658" filter="actor=7658" tag="Meeghan Holaway" role="Jake's Mom" thumb="https://metadata-static.plex.tv/1/people/15162262842f489c9ed5e592b57b6b38.jpg"/>
<Role id="62468" filter="actor=62468" tag="Sheila Shaw" role="Connie" thumb="https://metadata-static.plex.tv/4/people/48fcff5d73e68b613d6372f8cdef8d6e.jpg"/>
<Role id="46234" filter="actor=46234" tag="Kathleen Gati" role="Deirdre" thumb="https://metadata-static.plex.tv/people/5d776834961905001eb939db.jpg"/>
<Role id="64362" filter="actor=64362" tag="Brendan Meyer" role="Jake Powell" thumb="https://metadata-static.plex.tv/people/5d77684c7228e5001f1e18c0.jpg"/>
<Role id="81303" filter="actor=81303" tag="Brett Rickaby" role="Marcus" thumb="https://metadata-static.plex.tv/people/5d776828880197001ec90dd3.jpg"/>
<Role id="116430" filter="actor=116430" tag="Lisa Waltz" role="Suzanne" thumb="https://metadata-static.plex.tv/people/5d7768362ec6b5001f6bc21a.jpg"/>
<Role id="36660" filter="actor=36660" tag="Kevin Sizemore" role="Anthony" thumb="https://metadata-static.plex.tv/people/5d7768352e80df001ebde5a3.jpg"/>
<Role id="91996" filter="actor=91996" tag="Michelle Ang" role="Alex" thumb="https://metadata-static.plex.tv/2/people/28ca13b24ff6f407691395dd0f616a39.jpg"/>
<Role id="2271" filter="actor=2271" tag="Zack Whyel" role="Airplane Passenger" thumb="https://metadata-static.plex.tv/people/5d776d3c96b655001fe43746.jpg"/>
<Extras size="0"> </Extras>
<Related> </Related>
</Video>
</MediaContainer>
Are you sure those episodes are the ones causing an issue? They both have a parentKey
attribute.
Does the following code work?
from plexapi.server import PlexServer
plex = PlexServer("http://<SERVER_IP>:32400", token="<TOKEN>")
episode = plex.fetchItem(103520)
season = episode.season()
print(season)
episode = plex.fetchItem(103414)
season = episode.season()
print(season)
Here's the output for both episodes. Same result...
Traceback (most recent call last):
File "/home/ian/Downloads/plextest.py", line 4, in <module>
season = episode.season()
File "/home/ian/.local/lib/python3.9/site-packages/plexapi/video.py", line 900, in season
return self.fetchItem(self.parentKey)
File "/home/ian/.local/lib/python3.9/site-packages/plexapi/base.py", line 171, in fetchItem
raise BadRequest('ekey was not provided')
plexapi.exceptions.BadRequest: ekey was not provided
episode = plex.fetchItem(103520) # key="/library/metadata/103520" /Season 01/Fear the Walking Dead S01E01 - Pilot.mkv
episode = plex.fetchItem(103414) # key="/library/metadata/103414" /Specials/Fear the Walking Dead S00E01 - Flight 462.mp4
I have multiple other series that are not working as well with the same output. e.g.
episode = plex.fetchItem(96659) # Season 1/Below Deck S01E01
episode = plex.fetchItem(12523) # Specials/Below Deck S00E04
Then again, this PlexPy code returns the same error result for series' that ARE working in TitleCardMaker? confused
episode = plex.fetchItem(12648) # /Below Deck Sailing Yacht S01E01
season = episode.season()
print(season)
Traceback (most recent call last):
File "/home/ian/Downloads/plextest.py", line 7, in <module>
season = episode.season()
File "/home/ian/.local/lib/python3.9/site-packages/plexapi/video.py", line 900, in season
return self.fetchItem(self.parentKey)
File "/home/ian/.local/lib/python3.9/site-packages/plexapi/base.py", line 171, in fetchItem
raise BadRequest('ekey was not provided')
plexapi.exceptions.BadRequest: ekey was not provided
Some more testing:
episode = plex.fetchItem(103520)
print("Episode: ", episode) # <Episode:103520:Fear-the-Walking-Dea-s01e01>
print("Episode Number: ", episode.episodeNumber) # 1
print("Season Episode: ", episode.seasonEpisode) # s01e01
print("Parent Rating Key: ", episode.parentRatingKey) # 103519
show = episode.show()
print("Show: ", show) # <Episode:103520:Fear-the-Walking-Dea-s01e01>
print("Seasons:")
for season in show.seasons():
print(season)
# <Show:103397:Fear-the-Walking-Dea>
# <Season:103413:Fear-the-Walking-Dea-s0>
# <Season:103519:Fear-the-Walking-Dea-s1>
# <Season:103503:Fear-the-Walking-Dea-s2>
# <Season:103486:Fear-the-Walking-Dea-s3>
# <Season:103452:Fear-the-Walking-Dea-s4>
# <Season:103435:Fear-the-Walking-Dea-s5>
# <Season:103469:Fear-the-Walking-Dea-s6>
# <Season:103398:Fear-the-Walking-Dea-s7>
# Crash! ekey was not provided
season = episode.season()
print("Season: ", season)
What about the parentKey
and skipParent
?
episode = plex.fetchItem(103520)
print("Parent Key: ", episode.parentKey)
print("Seasons hidden?: ", episode.skipParent)
Episode: <Episode:103520:Fear-the-Walking-Dea-s01e01>
Episode Number: 1
Season Episode: s01e01
Parent Rating Key: 103519
Parent Key: None
Seasons hidden?: False
Show: <Show:103397:Fear-the-Walking-Dea>
Seasons:
<Season:103413:Fear-the-Walking-Dea-s0>
<Season:103519:Fear-the-Walking-Dea-s1>
<Season:103503:Fear-the-Walking-Dea-s2>
<Season:103486:Fear-the-Walking-Dea-s3>
<Season:103452:Fear-the-Walking-Dea-s4>
<Season:103435:Fear-the-Walking-Dea-s5>
<Season:103469:Fear-the-Walking-Dea-s6>
<Season:103398:Fear-the-Walking-Dea-s7>
Traceback (most recent call last):
File "/home/ian/Downloads/plextest.py", line 30, in <module>
season = episode.season()
File "/home/ian/.local/lib/python3.9/site-packages/plexapi/video.py", line 900, in season
return self.fetchItem(self.parentKey)
File "/home/ian/.local/lib/python3.9/site-packages/plexapi/base.py", line 171, in fetchItem
raise BadRequest('ekey was not provided')
plexapi.exceptions.BadRequest: ekey was not provided
I'm very confused. Do you mind sharing your server with my test account (TautulliTest
) so I can check it myself?
All yours Jonny.. You should get an invite, otherwise let me know. AFK for a bit if I don't respond...thanks for your help.
I cannot reproduce the problem at all. Everything is working.
>>> episode = plex.fetchItem(103520)
>>> episode
<Episode:103520:Fear-the-Walking-Dea-s01e01>
>>> episode.parentRatingKey
103519
>>> episode.parentKey
'/library/metadata/103519'
>>> season = episode.season()
>>> season
<Season:103519:Fear-the-Walking-Dea-s1>
>>> episode = plex.fetchItem(12648)
>>> episode
<Episode:12648:Below-Deck-Sailing-Y-s01e01>
>>> episode.parentRatingKey
12647
>>> episode.parentKey
'/library/metadata/12647'
>>> season = episode.season()
>>> season
<Season:12647:Below-Deck-Sailing-Y-s1>
Can you confirm 100% that you are using PlexAPI 4.11.1?
import plexapi
print(plexapi.VERSION)
Confirmed. 4.11.1 via plexapi.VERSION
>>> import plexapi
>>> print("Version: ", plexapi.VERSION)
Version: 4.11.1
>>> from plexapi.server import PlexServer
>>> plex = PlexServer("http://192.168.0.151:32400", token="xxx")
>>> episode = plex.fetchItem(103520)
>>> episode
<Episode:103520:Fear-the-Walking-Dea-s01e01>
>>> episode.parentRatingKey
103519
>>> episode.parentKey
>>> season = episode.season()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ian/.local/lib/python3.9/site-packages/plexapi/video.py", line 900, in season
return self.fetchItem(self.parentKey)
File "/home/ian/.local/lib/python3.9/site-packages/plexapi/base.py", line 171, in fetchItem
raise BadRequest('ekey was not provided')
plexapi.exceptions.BadRequest: ekey was not provided
>>>
Long shot, but are you using the same token from Plex Web? The same X-Plex-Token
from the XML page URL where you can see parentKey
in the XML data.
You hit the nail on the head Jonny. I was using an incorrect token (from goodness knows where and curious why it was working 95% of the time). But issue resolved. Thanks for your patience and your help.
Describe the Bug
Running into an issue with a single TV Series (Fear the Walking Dead) on my Plex, using the Title Card Maker docker. All other series correctly create title cards except for this one series.
TitleCardMaker: https://github.com/CollinHeist | https://github.com/CollinHeist/TitleCardMaker
Title Card Maker crashes with the following error when trying to create new episode title cards for "Fear the Walking Dead" only: File "/root/.local/share/virtualenvs/maker-_94ODGt-/lib/python3.9/site-packages/plexapi/base.py", line 171, in fetchItem raise BadRequest('ekey was not provided') plexapi.exceptions.BadRequest: ekey was not provided
Full trace:
Code Snippets
Expected Behavior
PlexAPI should not crash with eKey not provided There may be something corrupt in the plex database although all other titles are correctly updated?
Additional Context
Removing the series "Fear the Walking Dead", Empty Trash, add series back to server and re-scanned Plex. Re-ran TCM and the same behaviour was observed.
Operating System and Version
Ubuntu 21.10
Plex Media Server Version
1.26.2.5797
Python Version
3.9.7
PlexAPI Version
4.11.1