Skip to content

Intro marker question #504

@amazingr4b

Description

@amazingr4b

Describe the issue
"AttributeError: 'NoneType' object has no attribute 'split'" when getting the intro markers for an episode with intro details.
Not sure if this is a problem with how I am getting these values, or if this is a bug.

Code snipppets

shows = plex.library.section(getshowsection())
theshow = shows.get(show).episodes()
for ep in theshow:
	if ((int(ep.seasonNumber) == int(Ssn)) and (int(ep.index) == int(Epnum))):
                for m in ep.markers:
		    if m.type == "intro":
				start = m.start
				end = m.end
				dur = end - start
				start = start / 1000
				end = end / 1000
				dur = dur / 1000

throws error:
File "C:\Users\amazi\Desktop\TBN-Plex v517\ToBePosted\plexapi\media.py", line 718, in _loadData
_tag, _id = self.filter.split('=')
AttributeError: 'NoneType' object has no attribute 'split'

Expected behavior
No attribute error.

I changed the _loadData function in the media.py file to be:

 def _loadData(self, data):
	self._data = data
	self.filter = data.attrib.get('filter')
	self.type = data.attrib.get('type')
	if (self.type != "intro"):
		_tag, _id = self.filter.split('=')
		self.tag = self.type + _tag.capitalize()
		self.id = _id
	self.start = cast(int, data.attrib.get('startTimeOffset'))
	self.end = cast(int, data.attrib.get('endTimeOffset'))

I no longer get that attribute error, and I get the into details as expected. Not sure if that change would affect anything else, though for the past week and a half I have not encountered any other issues related to this change.

Enviroment (please complete the following information):

  • OS: [ Linux, Windows]
  • Plex version [1.19.4.2865]
  • Python Version [Python 3.8.0]
  • PlexAPI version [4.0.0]

Additional context
Add any other context about the issue here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions