mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Bump plexapi from 4.15.4 to 4.15.10 (#2251)
* Bump plexapi from 4.15.4 to 4.15.10 Bumps [plexapi](https://github.com/pkkid/python-plexapi) from 4.15.4 to 4.15.10. - [Release notes](https://github.com/pkkid/python-plexapi/releases) - [Commits](https://github.com/pkkid/python-plexapi/compare/4.15.4...4.15.10) --- updated-dependencies: - dependency-name: plexapi dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Update plexapi==4.15.10 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
040972bcba
commit
b1c0972077
16 changed files with 413 additions and 189 deletions
|
@ -1,5 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import warnings
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
from functools import cached_property
|
||||
from urllib.parse import parse_qs, quote_plus, urlencode, urlparse
|
||||
|
@ -41,14 +43,22 @@ class Library(PlexObject):
|
|||
def _loadSections(self):
|
||||
""" Loads and caches all the library sections. """
|
||||
key = '/library/sections'
|
||||
self._sectionsByID = {}
|
||||
self._sectionsByTitle = {}
|
||||
sectionsByID = {}
|
||||
sectionsByTitle = defaultdict(list)
|
||||
libcls = {
|
||||
'movie': MovieSection,
|
||||
'show': ShowSection,
|
||||
'artist': MusicSection,
|
||||
'photo': PhotoSection,
|
||||
}
|
||||
|
||||
for elem in self._server.query(key):
|
||||
for cls in (MovieSection, ShowSection, MusicSection, PhotoSection):
|
||||
if elem.attrib.get('type') == cls.TYPE:
|
||||
section = cls(self._server, elem, key)
|
||||
self._sectionsByID[section.key] = section
|
||||
self._sectionsByTitle[section.title.lower().strip()] = section
|
||||
section = libcls.get(elem.attrib.get('type'), LibrarySection)(self._server, elem, initpath=key)
|
||||
sectionsByID[section.key] = section
|
||||
sectionsByTitle[section.title.lower().strip()].append(section)
|
||||
|
||||
self._sectionsByID = sectionsByID
|
||||
self._sectionsByTitle = dict(sectionsByTitle)
|
||||
|
||||
def sections(self):
|
||||
""" Returns a list of all media sections in this library. Library sections may be any of
|
||||
|
@ -60,18 +70,30 @@ class Library(PlexObject):
|
|||
|
||||
def section(self, title):
|
||||
""" Returns the :class:`~plexapi.library.LibrarySection` that matches the specified title.
|
||||
Note: Multiple library sections with the same title is ambiguous.
|
||||
Use :func:`~plexapi.library.Library.sectionByID` instead for an exact match.
|
||||
|
||||
Parameters:
|
||||
title (str): Title of the section to return.
|
||||
|
||||
Raises:
|
||||
:exc:`~plexapi.exceptions.NotFound`: The library section title is not found on the server.
|
||||
"""
|
||||
normalized_title = title.lower().strip()
|
||||
if not self._sectionsByTitle or normalized_title not in self._sectionsByTitle:
|
||||
self._loadSections()
|
||||
try:
|
||||
return self._sectionsByTitle[normalized_title]
|
||||
sections = self._sectionsByTitle[normalized_title]
|
||||
except KeyError:
|
||||
raise NotFound(f'Invalid library section: {title}') from None
|
||||
|
||||
if len(sections) > 1:
|
||||
warnings.warn(
|
||||
'Multiple library sections with the same title found, use "sectionByID" instead. '
|
||||
'Returning the last section.'
|
||||
)
|
||||
return sections[-1]
|
||||
|
||||
def sectionByID(self, sectionID):
|
||||
""" Returns the :class:`~plexapi.library.LibrarySection` that matches the specified sectionID.
|
||||
|
||||
|
@ -2727,7 +2749,9 @@ class FilteringType(PlexObject):
|
|||
('id', 'integer', 'Rating Key'),
|
||||
('index', 'integer', f'{self.type.capitalize()} Number'),
|
||||
('lastRatedAt', 'date', f'{self.type.capitalize()} Last Rated'),
|
||||
('updatedAt', 'date', 'Date Updated')
|
||||
('updatedAt', 'date', 'Date Updated'),
|
||||
('group', 'string', 'SQL Group By Statement'),
|
||||
('having', 'string', 'SQL Having Clause')
|
||||
]
|
||||
|
||||
if self.type == 'movie':
|
||||
|
@ -2778,11 +2802,14 @@ class FilteringType(PlexObject):
|
|||
|
||||
manualFields = []
|
||||
for field, fieldType, fieldTitle in additionalFields:
|
||||
if field not in {'group', 'having'}:
|
||||
field = f"{prefix}{field}"
|
||||
fieldXML = (
|
||||
f'<Field key="{prefix}{field}" '
|
||||
f'<Field key="{field}" '
|
||||
f'title="{fieldTitle}" '
|
||||
f'type="{fieldType}"/>'
|
||||
)
|
||||
|
||||
manualFields.append(self._manuallyLoadXML(fieldXML, FilteringField))
|
||||
|
||||
return manualFields
|
||||
|
@ -2922,6 +2949,10 @@ class FilterChoice(PlexObject):
|
|||
self.title = data.attrib.get('title')
|
||||
self.type = data.attrib.get('type')
|
||||
|
||||
def items(self):
|
||||
""" Returns a list of items for this filter choice. """
|
||||
return self.fetchItems(self.fastKey)
|
||||
|
||||
|
||||
class ManagedHub(PlexObject):
|
||||
""" Represents a Managed Hub (recommendation) inside a library.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue