mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 05:01:14 -07:00
Update plexapi==4.15.11
This commit is contained in:
parent
653a6d5c12
commit
85519b1b45
8 changed files with 173 additions and 16 deletions
|
@ -1,5 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from typing import Any, TYPE_CHECKING
|
||||
import warnings
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
|
@ -17,6 +20,10 @@ from plexapi.settings import Setting
|
|||
from plexapi.utils import deprecated
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from plexapi.audio import Track
|
||||
|
||||
|
||||
class Library(PlexObject):
|
||||
""" Represents a PlexServer library. This contains all sections of media defined
|
||||
in your Plex server including video, shows and audio.
|
||||
|
@ -376,7 +383,8 @@ class Library(PlexObject):
|
|||
part = (f'/library/sections?name={quote_plus(name)}&type={type}&agent={agent}'
|
||||
f'&scanner={quote_plus(scanner)}&language={language}&{urlencode(locations, doseq=True)}')
|
||||
if kwargs:
|
||||
part += urlencode(kwargs)
|
||||
prefs_params = {f'prefs[{k}]': v for k, v in kwargs.items()}
|
||||
part += f'&{urlencode(prefs_params)}'
|
||||
return self._server.query(part, method=self._server._session.post)
|
||||
|
||||
def history(self, maxresults=None, mindate=None):
|
||||
|
@ -655,7 +663,7 @@ class LibrarySection(PlexObject):
|
|||
guidLookup = {}
|
||||
for item in library.all():
|
||||
guidLookup[item.guid] = item
|
||||
guidLookup.update({guid.id: item for guid in item.guids}}
|
||||
guidLookup.update({guid.id: item for guid in item.guids})
|
||||
|
||||
result1 = guidLookup['plex://show/5d9c086c46115600200aa2fe']
|
||||
result2 = guidLookup['imdb://tt0944947']
|
||||
|
@ -2033,6 +2041,31 @@ class MusicSection(LibrarySection, ArtistEditMixins, AlbumEditMixins, TrackEditM
|
|||
kwargs['policy'] = Policy.create(limit)
|
||||
return super(MusicSection, self).sync(**kwargs)
|
||||
|
||||
def sonicAdventure(
|
||||
self,
|
||||
start: Track | int,
|
||||
end: Track | int,
|
||||
**kwargs: Any,
|
||||
) -> list[Track]:
|
||||
""" Returns a list of tracks from this library section that are part of a sonic adventure.
|
||||
ID's should be of a track, other ID's will return an empty list or items itself or an error.
|
||||
|
||||
Parameters:
|
||||
start (Track | int): The :class:`~plexapi.audio.Track` or ID of the first track in the sonic adventure.
|
||||
end (Track | int): The :class:`~plexapi.audio.Track` or ID of the last track in the sonic adventure.
|
||||
kwargs: Additional parameters to pass to :func:`~plexapi.base.PlexObject.fetchItems`.
|
||||
|
||||
Returns:
|
||||
List[:class:`~plexapi.audio.Track`]: a list of tracks from this library section
|
||||
that are part of a sonic adventure.
|
||||
"""
|
||||
# can not use Track due to circular import
|
||||
startID = start if isinstance(start, int) else start.ratingKey
|
||||
endID = end if isinstance(end, int) else end.ratingKey
|
||||
|
||||
key = f"/library/sections/{self.key}/computePath?startID={startID}&endID={endID}"
|
||||
return self.fetchItems(key, **kwargs)
|
||||
|
||||
|
||||
class PhotoSection(LibrarySection, PhotoalbumEditMixins, PhotoEditMixins):
|
||||
""" Represents a :class:`~plexapi.library.LibrarySection` section containing photos.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue