more dosc.

This commit is contained in:
Hellowlol 2017-03-03 23:32:16 +01:00
parent 93a9ea3488
commit 70fce72f44
2 changed files with 90 additions and 0 deletions

View file

@ -153,6 +153,39 @@ class Library(PlexObject):
location (str): /path/to/files
language (str): Two letter language fx en
kwargs (dict): Advanced options should be passed as a dict. where the id is the key.
# Sooo this was a major fucking pain..
# Prefs for album
includeInGlobal (bool): Default value true
# Prefs for episode
includeInGlobal (bool): Default value true
# Prefs for artist
includeInGlobal (bool): Default value true
respectTags (bool): Default value false
albumSort (int): Default value -1 Possible option: 0:Newest first,1:Oldest first,2:By name
enableTrackOffsets (bool): Default value false
scanner (str): Plex Music Scanner, Plex Premium Music Scanner
# Prefs for track
includeInGlobal (bool): Default value true
# Prefs for movie
includeInGlobal (bool): Default value true
enableCinemaTrailers (bool): Default value true
enableBIFGeneration (bool): Default value true
scanner (str): Options: Plex Movie Scanner, Plex Video Files Scanner
# Prefs for show
includeInGlobal (bool): Default value true
enableBIFGeneration (bool): Default value true
flattenSeasons (int): Default value 0 Possible option: 0:Show,1:Hide
episodeSort (int): Default value -1 Possible option: 0:Oldest first,1:Newest first
# Prefs for season
includeInGlobal (bool): Default value true
"""
# Should this function be here or in server??
@ -163,6 +196,10 @@ class Library(PlexObject):
part += urlencode(kwargs)
return self._server.query(part, method=self._server._session.post)
def share(self, user, *args, **kwargs):
"""Share this library with the user."""
pass
class LibrarySection(PlexObject):
""" Base class for a single library section.

53
tools/atter_doc_string.py Normal file
View file

@ -0,0 +1,53 @@
from collections import OrderedDict
import re
def type_finder(s):
type_string = str(type(s))
x = re.search("'(.+)'", type_string)
if x:
return x.group(1)
return ''
class AttDS(object):
"""Helper that prints docstring attrs"""
def __init__(self, o, keys=None, style='google'):
self.__o = o
if not isinstance(o, dict):
self.o = o.__dict__.items()
self._as_dict = o.__dict__
else:
self.o = o.items()
self._as_dict = o
if keys is None:
self.keys = self._as_dict.keys()
else:
self.keys = keys
if style == 'google':
self.template = '%s (%s): %s'
self.res_dict = OrderedDict()
self.parse()
def parse(self):
for k, v in sorted(self.o, key=lambda k: k[0]):
if self.keys:
ds = ''
for key in self.keys:
ds += '%s=%s ' % (key, self._as_dict.get(key, ''))
else:
ds = ''
self.res_dict[k] = self.template % (k, type_finder(v), ds)
def write(self):
for k, v in self.res_dict.items():
print v
#x = AttDS(dict or object).write()