mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-22 11:43:13 +00:00
Add reverseSearchType util
This commit is contained in:
parent
a5dfbe6eb7
commit
2562334ad4
1 changed files with 19 additions and 0 deletions
|
@ -148,6 +148,7 @@ def searchType(libtype):
|
||||||
Parameters:
|
Parameters:
|
||||||
libtype (str): LibType to lookup (movie, show, season, episode, artist, album, track,
|
libtype (str): LibType to lookup (movie, show, season, episode, artist, album, track,
|
||||||
collection)
|
collection)
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:exc:`~plexapi.exceptions.NotFound`: Unknown libtype
|
:exc:`~plexapi.exceptions.NotFound`: Unknown libtype
|
||||||
"""
|
"""
|
||||||
|
@ -159,6 +160,24 @@ def searchType(libtype):
|
||||||
raise NotFound('Unknown libtype: %s' % libtype)
|
raise NotFound('Unknown libtype: %s' % libtype)
|
||||||
|
|
||||||
|
|
||||||
|
def reverseSearchType(libtype):
|
||||||
|
""" Returns the string value of the library type.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
libtype (int): Integer value of the library type.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
:exc:`~plexapi.exceptions.NotFound`: Unknown libtype
|
||||||
|
"""
|
||||||
|
if libtype in SEARCHTYPES:
|
||||||
|
return libtype
|
||||||
|
libtype = int(libtype)
|
||||||
|
for k, v in SEARCHTYPES.items():
|
||||||
|
if libtype == v:
|
||||||
|
return k
|
||||||
|
raise NotFound('Unknown libtype: %s' % libtype)
|
||||||
|
|
||||||
|
|
||||||
def threaded(callback, listargs):
|
def threaded(callback, listargs):
|
||||||
""" Returns the result of <callback> for each set of `*args` in listargs. Each call
|
""" Returns the result of <callback> for each set of `*args` in listargs. Each call
|
||||||
to <callback> is called concurrently in their own separate threads.
|
to <callback> is called concurrently in their own separate threads.
|
||||||
|
|
Loading…
Reference in a new issue