Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion plexapi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ def fetchItems(self, ekey, cls=None, **kwargs):
on how this is used.
"""
data = self._server.query(ekey)
return self.findItems(data, cls, ekey, **kwargs)
items = self.findItems(data, cls, ekey, **kwargs)
librarySectionID = data.attrib.get('librarySectionID')
if librarySectionID:
for item in items:
item.librarySectionID = librarySectionID
return items

def findItems(self, data, cls=None, initpath=None, **kwargs):
""" Load the specified data to find and build all items with the specified tag
Expand Down
8 changes: 7 additions & 1 deletion plexapi/photo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from plexapi import media, utils
from plexapi.base import PlexPartialObject
from plexapi.exceptions import NotFound, BadRequest
from plexapi.exceptions import NotFound
from plexapi.compat import quote_plus

Expand Down Expand Up @@ -124,7 +125,12 @@ def photoalbum(self):

def section(self):
""" Returns the :class:`~plexapi.library.LibrarySection` this item belongs to. """
return self._server.library.sectionByID(self.photoalbum().librarySectionID)
if hasattr(self, 'librarySectionID'):
return self._server.library.sectionByID(self.librarySectionID)
elif self.parentKey:
return self._server.library.sectionByID(self.photoalbum().librarySectionID)
else:
raise BadRequest('Unable to get section for photo, can`t find librarySectionID')

def sync(self, resolution, client=None, clientId=None, limit=None, title=None):
""" Add current photo as sync item for specified device.
Expand Down