File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,10 @@ def _loadData(self, data):
7878 self .similar = self .findItems (data , media .Similar )
7979 self .collections = self .findItems (data , media .Collection )
8080
81+ def __iter__ (self ):
82+ for album in self .albums ():
83+ yield album
84+
8185 def album (self , title ):
8286 """ Returns the :class:`~plexapi.audio.Album` that matches the specified title.
8387
@@ -151,6 +155,10 @@ class Album(Audio):
151155 TAG = 'Directory'
152156 TYPE = 'album'
153157
158+ def __iter__ (self ):
159+ for track in self .tracks :
160+ yield track
161+
154162 def _loadData (self , data ):
155163 """ Load attribute values from Plex XML response. """
156164 Audio ._loadData (self , data )
Original file line number Diff line number Diff line change @@ -272,6 +272,9 @@ def __eq__(self, other):
272272 def __hash__ (self ):
273273 return hash (repr (self ))
274274
275+ def __iter__ (self ):
276+ yield self
277+
275278 def __getattribute__ (self , attr ):
276279 # Dragons inside.. :-/
277280 value = utils .getattributeOrNone (PlexPartialObject , self , attr )
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ class Video(PlexPartialObject):
2424 updatedAt (datatime): Datetime this item was updated.
2525 viewCount (int): Count of times this item was accessed.
2626 """
27+
2728 def _loadData (self , data ):
2829 """ Load attribute values from Plex XML response. """
2930 self ._data = data
@@ -214,6 +215,10 @@ class Show(Video):
214215 TAG = 'Directory'
215216 TYPE = 'show'
216217
218+ def __iter__ (self ):
219+ for season in self .seasons ():
220+ yield season
221+
217222 def _loadData (self , data ):
218223 """ Load attribute values from Plex XML response. """
219224 Video ._loadData (self , data )
@@ -335,6 +340,10 @@ class Season(Video):
335340 TAG = 'Directory'
336341 TYPE = 'season'
337342
343+ def __iter__ (self ):
344+ for episode in self .episodes ():
345+ yield episode
346+
338347 def _loadData (self , data ):
339348 """ Load attribute values from Plex XML response. """
340349 Video ._loadData (self , data )
You can’t perform that action at this time.
0 commit comments