Skip to content

Commit

Permalink
Update isFullObject() check
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyWong16 committed Aug 3, 2024
1 parent bbca27e commit e206055
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 8 additions & 5 deletions plexapi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import TYPE_CHECKING, Generic, Iterable, List, Optional, TypeVar, Union
import weakref
from functools import cached_property
from urllib.parse import urlencode
from urllib.parse import parse_qsl, urlencode, urlparse
from xml.etree import ElementTree
from xml.etree.ElementTree import Element

Expand Down Expand Up @@ -391,10 +391,9 @@ def reload(self, key=None, **kwargs):
Parameters:
key (string, optional): Override the key to reload.
**kwargs (dict): A dictionary of XML include parameters to exclude or override.
All parameters are included by default with the option to override each parameter
or disable each parameter individually by setting it to False or 0.
**kwargs (dict): A dictionary of XML include parameters to include/exclude or override.
See :class:`~plexapi.base.PlexPartialObject` for all the available include parameters.
Set parameter to True to include and False to exclude.
Example:
Expand Down Expand Up @@ -600,7 +599,11 @@ def isFullObject(self):
search result for a movie often only contain a portion of the attributes a full
object (main url) for that movie would contain.
"""
return not self.key or (self._details_key or self.key) == self._initpath
parsed_key = urlparse(self._details_key or self.key)
parsed_initpath = urlparse(self._initpath)
query_key = set(parse_qsl(parsed_key.query))
query_init = set(parse_qsl(parsed_initpath.query))
return not self.key or (parsed_key.path == parsed_initpath.path and query_key <= query_init)

def isPartialObject(self):
""" Returns True if this is not a full object. """
Expand Down
4 changes: 3 additions & 1 deletion tests/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,12 @@ def test_video_Movie_getStreamURL(movie, account):
def test_video_Movie_isFullObject_and_reload(plex):
movie = plex.library.section("Movies").get("Sita Sings the Blues")
assert movie.isFullObject() is False
movie.reload(checkFiles=False)
movie.reload(includeChapters=False)
assert movie.isFullObject() is False
movie.reload()
assert movie.isFullObject() is True
movie.reload(includeExtras=True)
assert movie.isFullObject() is True
movie_via_search = plex.library.search(movie.title)[0]
assert movie_via_search.isFullObject() is False
movie_via_search.reload()
Expand Down

0 comments on commit e206055

Please sign in to comment.