@@ -442,11 +442,24 @@ def get_token(self, machineIdentifier):
442442
443443
444444class Section (PlexObject ):
445- """ This referes to a shared section. """
445+ """ This refers to a shared section. The raw xml for the data presented here
446+ can be found at: https://plex.tv/api/servers/{machineId}/shared_servers/{serverId}
447+
448+ Attributes:
449+ TAG (str): section
450+ id (int): shared section id
451+ sectionKey (str): what key we use for this section
452+ title (str): Title of the section
453+ sectionId (str): shared section id
454+ type (str): movie, tvshow, artist
455+ shared (bool): If this section is shared with the user
456+
457+ """
446458 TAG = 'Section'
447459
448460 def _loadData (self , data ):
449461 self ._data = data
462+ # self.id = utils.cast(int, data.attrib.get('id')) # Havnt decided if this should be changed.
450463 self .sectionKey = data .attrib .get ('key' )
451464 self .title = data .attrib .get ('title' )
452465 self .sectionId = data .attrib .get ('id' )
@@ -455,7 +468,20 @@ def _loadData(self, data):
455468
456469
457470class MyPlexServerShare (PlexObject ):
458- """ Represents a single user's server reference. Used for library sharing. """
471+ """ Represents a single user's server reference. Used for library sharing.
472+
473+ Attributes:
474+ id (int): id for this share
475+ serverId (str): what id plex uses for this.
476+ machineIdentifier (str): The servers machineIdentifier
477+ name (str): The servers name
478+ lastSeenAt (datetime): Last connected to the server?
479+ numLibraries (int): Total number of libraries
480+ allLibraries (bool): True if all libraries is shared with this user.
481+ owned (bool): 1 if the server is owned by the user
482+ pending (bool): True if the invite is pending.
483+
484+ """
459485 TAG = 'Server'
460486
461487 def _loadData (self , data ):
@@ -467,17 +493,19 @@ def _loadData(self, data):
467493 self .name = data .attrib .get ('name' )
468494 self .lastSeenAt = utils .toDatetime (data .attrib .get ('lastSeenAt' ))
469495 self .numLibraries = utils .cast (int , data .attrib .get ('numLibraries' ))
470- self .allLibraries = utils .cast (int , data .attrib .get ('allLibraries' ))
471- self .owned = utils .cast (int , data .attrib .get ('owned' ))
472- self .pending = utils .cast (int , data .attrib .get ('pending' ))
496+ self .allLibraries = utils .cast (bool , data .attrib .get ('allLibraries' ))
497+ self .owned = utils .cast (bool , data .attrib .get ('owned' ))
498+ self .pending = utils .cast (bool , data .attrib .get ('pending' ))
473499
474500 def sections (self ):
475501 url = MyPlexAccount .FRIENDSERVERS .format (machineId = self .machineIdentifier , serverId = self .id )
476502 data = self ._server .query (url )
477503 sections = []
504+
478505 for section in data .iter ('Section' ):
479- if section :
506+ if isinstance ( section , ElementTree . Element ) :
480507 sections .append (Section (self , section , url ))
508+
481509 return sections
482510
483511
0 commit comments