@@ -341,13 +341,15 @@ def _create(cls, server, title, items):
341341 return cls (server , data , initpath = key )
342342
343343 @classmethod
344- def _createSmart (cls , server , title , section , limit = None , sort = None , filters = None , ** kwargs ):
344+ def _createSmart (cls , server , title , section , limit = None , libtype = None , sort = None , filters = None , ** kwargs ):
345345 """ Create a smart playlist. """
346346 if not isinstance (section , LibrarySection ):
347347 section = server .library .section (section )
348348
349+ libtype = libtype or section .METADATA_TYPE
350+
349351 searchKey = section ._buildSearchKey (
350- sort = sort , libtype = section . METADATA_TYPE , limit = limit , filters = filters , ** kwargs )
352+ sort = sort , libtype = libtype , limit = limit , filters = filters , ** kwargs )
351353 uri = '%s%s' % (server ._uriRoot (), searchKey )
352354
353355 key = '/playlists%s' % utils .joinArgs ({
@@ -361,7 +363,7 @@ def _createSmart(cls, server, title, section, limit=None, sort=None, filters=Non
361363
362364 @classmethod
363365 def create (cls , server , title , section = None , items = None , smart = False , limit = None ,
364- sort = None , filters = None , ** kwargs ):
366+ libtype = None , sort = None , filters = None , ** kwargs ):
365367 """ Create a playlist.
366368
367369 Parameters:
@@ -373,6 +375,8 @@ def create(cls, server, title, section=None, items=None, smart=False, limit=None
373375 :class:`~plexapi.video.Video`, or :class:`~plexapi.photo.Photo` objects to be added to the playlist.
374376 smart (bool): True to create a smart playlist. Default False.
375377 limit (int): Smart playlists only, limit the number of items in the playlist.
378+ libtype (str): Smart playlists only, the specific type of content to filter
379+ (movie, show, season, episode, artist, album, track, photoalbum, photo).
376380 sort (str or list, optional): Smart playlists only, a string of comma separated sort fields
377381 or a list of sort fields in the format ``column:dir``.
378382 See :func:`~plexapi.library.LibrarySection.search` for more info.
@@ -389,7 +393,7 @@ def create(cls, server, title, section=None, items=None, smart=False, limit=None
389393 :class:`~plexapi.playlist.Playlist`: A new instance of the created Playlist.
390394 """
391395 if smart :
392- return cls ._createSmart (server , title , section , limit , sort , filters , ** kwargs )
396+ return cls ._createSmart (server , title , section , limit , libtype , sort , filters , ** kwargs )
393397 else :
394398 return cls ._create (server , title , items )
395399
0 commit comments