@classmethod<EOL><INDENT>def _createSmart(cls, server, title, section, limit=None, **kwargs):<DEDENT>
if not isinstance(section, LibrarySection):<EOL><INDENT>section = server.library.section(section)<EOL><DEDENT>sectionType = utils.searchType(section.type)<EOL>sectionId = section.key<EOL>uuid = section.uuid<EOL>uri = '<STR_LIT>' % (uuid,<EOL>sectionId,<EOL>sectionType)<EOL>if limit:<EOL><INDENT>uri = uri + '<STR_LIT>' % str(limit)<EOL><DEDENT>for category, value in kwargs.items():<EOL><INDENT>sectionChoices = section.listChoices(category)<EOL>for choice in sectionChoices:<EOL><INDENT>if str(choice.title).lower() == str(value).lower():<EOL><INDENT>uri = uri + '<STR_LIT>' % (category.lower(), str(choice.key))<EOL><DEDENT><DEDENT><DEDENT>uri = uri + '<STR_LIT>' % sectionType<EOL>key = '<STR_LIT>' % utils.joinArgs({<EOL>'<STR_LIT>': uri,<EOL>'<STR_LIT:type>': section.CONTENT_TYPE,<EOL>'<STR_LIT:title>': title,<EOL>'<STR_LIT>': <NUM_LIT:1>,<EOL>})<EOL>data = server.query(key, method=server._session.post)[<NUM_LIT:0>]<EOL>return cls(server, data, initpath=key)<EOL>
Create a Smart playlist.