Skip to content

Commit f92d9d5

Browse files
authored
Fix myplex share section ID cast to int (#708)
* Fix myplex share section ID cast to int * Fix typo in search doc string
1 parent 1beee64 commit f92d9d5

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

plexapi/library.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ def search(self, title=None, sort=None, maxresults=None,
972972
If you want to filter using episode view count then you must specify ``episode.viewCount`` explicitly.
973973
In addition, if the filter does not exist for the default library type it will fallback to the most
974974
specific ``libtype`` available. For example, ``show.unwatched`` does not exists so it will fallback to
975-
``episode.unwatched.`` The ``libtype`` prefix cannot be included directly in the function parameters so
975+
``episode.unwatched``. The ``libtype`` prefix cannot be included directly in the function parameters so
976976
the ``**kwargs`` must be provided as a dictionary.
977977
978978
Examples:

plexapi/myplex.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,15 +499,18 @@ def _getSectionIds(self, server, sections):
499499
url = self.PLEXSERVERS.replace('{machineId}', machineIdentifier)
500500
data = self.query(url, self._session.get)
501501
for elem in data[0]:
502-
allSectionIds[elem.attrib.get('id', '').lower()] = elem.attrib.get('id')
503-
allSectionIds[elem.attrib.get('title', '').lower()] = elem.attrib.get('id')
504-
allSectionIds[elem.attrib.get('key', '').lower()] = elem.attrib.get('id')
502+
_id = utils.cast(int, elem.attrib.get('id'))
503+
_key = utils.cast(int, elem.attrib.get('key'))
504+
_title = elem.attrib.get('title', '').lower()
505+
allSectionIds[_id] = _id
506+
allSectionIds[_key] = _id
507+
allSectionIds[_title] = _id
505508
log.debug(allSectionIds)
506509
# Convert passed in section items to section ids from above lookup
507510
sectionIds = []
508511
for section in sections:
509-
sectionKey = section.key if isinstance(section, LibrarySection) else section
510-
sectionIds.append(allSectionIds[sectionKey.lower()])
512+
sectionKey = section.key if isinstance(section, LibrarySection) else section.lower()
513+
sectionIds.append(allSectionIds[sectionKey])
511514
return sectionIds
512515

513516
def _filterDictToStr(self, filterDict):

0 commit comments

Comments
 (0)