Read all headers, logging, and core settings from config file; Add Show.refresh() method

This commit is contained in:
Michael Shepanski 2015-06-01 22:28:50 -04:00
parent c5eee64030
commit 43e99e94ef
3 changed files with 17 additions and 0 deletions

4
.gitignore vendored
View file

@ -2,9 +2,13 @@ syntax: glob
*.db
*.log
*.pyc
*.swp
*.sublime-*
*__pycache__*
dist
build
*.egg-info
.idea/
lib/
bin/
include/

View file

@ -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).

View file

@ -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():