mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-24 20:53:09 +00:00
Read all headers, logging, and core settings from config file; Add Show.refresh() method
This commit is contained in:
parent
c5eee64030
commit
43e99e94ef
3 changed files with 17 additions and 0 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -2,9 +2,13 @@ syntax: glob
|
|||
*.db
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
*.sublime-*
|
||||
*__pycache__*
|
||||
dist
|
||||
build
|
||||
*.egg-info
|
||||
.idea/
|
||||
lib/
|
||||
bin/
|
||||
include/
|
||||
|
|
|
@ -46,6 +46,9 @@ class Library(object):
|
|||
def get(self, title):
|
||||
return video.find_item(self.server, '/library/all', title)
|
||||
|
||||
def getByKey(self, key):
|
||||
return video.find_key(self.server, key)
|
||||
|
||||
def search(self, title, filter='all', vtype=None, **tags):
|
||||
""" Search all available content.
|
||||
title: Title to search (pass None to search all titles).
|
||||
|
|
|
@ -218,6 +218,16 @@ def build_item(server, elem, initpath):
|
|||
raise UnknownType('Unknown video type: %s' % vtype)
|
||||
|
||||
|
||||
def find_key(server, key):
|
||||
path = '/library/metadata/{0}'.format(key)
|
||||
try:
|
||||
# Video seems to be the first sub element
|
||||
elem = server.query(path)[0]
|
||||
return build_item(server, elem, path)
|
||||
except:
|
||||
raise NotFound('Unable to find key: %s' % key)
|
||||
|
||||
|
||||
def find_item(server, path, title):
|
||||
for elem in server.query(path):
|
||||
if elem.attrib.get('title').lower() == title.lower():
|
||||
|
|
Loading…
Reference in a new issue