mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
add .searchAudio method to PlexServer, to specifically search for audio
This commit is contained in:
parent
e437e857cd
commit
0229226448
1 changed files with 8 additions and 1 deletions
|
@ -4,7 +4,7 @@ PlexServer
|
|||
import requests
|
||||
from requests.status_codes import _codes as codes
|
||||
from plexapi import BASE_HEADERS, TIMEOUT
|
||||
from plexapi import log, video
|
||||
from plexapi import log, video, audio
|
||||
from plexapi.client import Client
|
||||
from plexapi.exceptions import BadRequest, NotFound
|
||||
from plexapi.library import Library
|
||||
|
@ -99,6 +99,13 @@ class PlexServer(object):
|
|||
return [item for item in items if item.type == mediatype]
|
||||
return items
|
||||
|
||||
def searchAudio(self, query, mediatype=None):
|
||||
query = quote(query)
|
||||
items = audio.list_items(self, '/search?query=%s' % query)
|
||||
if mediatype:
|
||||
return [item for item in items if item.type == mediatype]
|
||||
return items
|
||||
|
||||
def sessions(self):
|
||||
return video.list_items(self, '/status/sessions')
|
||||
|
||||
|
|
Loading…
Reference in a new issue