Started work on better documentation

This commit is contained in:
Michael Shepanski 2017-01-21 23:06:55 -05:00
parent 976ab0236f
commit c684552792
9 changed files with 36 additions and 50 deletions

18
.gitignore vendored
View file

@ -1,21 +1,19 @@
syntax: glob syntax: glob
*.db *.db
*.egg-info
*.log *.log
*.pyc *.pyc
*.swp
*.sublime-* *.sublime-*
*.swp
*__pycache__* *__pycache__*
dist
build
*.egg-info
.idea/
lib/
bin/
include/
.cache/ .cache/
.idea/
.Python .Python
bin/
build
dist
docs/_build/ docs/_build/
include/
lib/
pip-selfcheck.json pip-selfcheck.json
pyvenv.cfg pyvenv.cfg

View file

@ -9,7 +9,7 @@ are permitted provided that the following conditions are met:
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name conky-pkmeter nor the names of its contributors * Neither the name python-plexapi nor the names of its contributors
may be used to endorse or promote products derived from this software without may be used to endorse or promote products derived from this software without
specific prior written permission. specific prior written permission.

View file

@ -1,16 +1,10 @@
Python PlexAPI
Welcome to Python PlexAPI's documentation! ==============
==========================================
.. include:: toc.rst .. include:: toc.rst
.. automodule:: myplex .. automodule:: myplex
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Usage & Contributions
---------------------
* Source is available on the `Github Project Page <https://github.com/mjs7231/python-plexapi>`_.
* Contributors to python-plexapi own their own contributions and may distribute that code under
the `BSD license <https://github.com/mjs7231/python-plexapi/blob/master/LICENSE.txt>`_.

View file

@ -1,5 +1,5 @@
PlexAPI Introduction Introduction
==================== ============
.. |br| raw:: html .. |br| raw:: html

View file

@ -47,7 +47,6 @@ MyPlex (plexapi.myplex)
----------------------- -----------------------
.. automodule:: plexapi.myplex .. automodule:: plexapi.myplex
:members: :members:
:undoc-members:
:show-inheritance: :show-inheritance:
Photo (plexapi.photo) Photo (plexapi.photo)

View file

@ -1,6 +1,7 @@
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 2
:caption: Table of Contents :caption: Table of Contents
self
introduction introduction
modules modules

View file

@ -4,6 +4,7 @@
Python 2/3 compatability Python 2/3 compatability
Always try Py3 first Always try Py3 first
""" """
import sys
try: try:
from urllib.parse import urlencode from urllib.parse import urlencode
@ -20,8 +21,13 @@ try:
except ImportError: except ImportError:
from urllib import unquote from urllib import unquote
try: try:
from configparser import ConfigParser from configparser import ConfigParser
except ImportError: except ImportError:
from ConfigParser import ConfigParser from ConfigParser import ConfigParser
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree import ElementTree

View file

@ -1,23 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys import plexapi, requests
if sys.version_info <= (3, 3):
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree import ElementTree
else:
# py 3.3 and above selects the fastest automatically
from xml.etree import ElementTree
from requests.status_codes import _codes as codes
import plexapi
import requests
from plexapi import TIMEOUT, log, utils from plexapi import TIMEOUT, log, utils
from plexapi.exceptions import BadRequest, NotFound, Unauthorized from plexapi.exceptions import BadRequest, NotFound, Unauthorized
from plexapi.client import PlexClient from plexapi.client import PlexClient
from plexapi.compat import ElementTree
from plexapi.server import PlexServer from plexapi.server import PlexServer
from requests.status_codes import _codes as codes
class MyPlexAccount(object): class MyPlexAccount(object):
@ -90,17 +78,18 @@ class MyPlexAccount(object):
def __repr__(self): def __repr__(self):
return '<%s:%s:%s>' % (self.__class__.__name__, self.id, self.username.encode('utf8')) return '<%s:%s:%s>' % (self.__class__.__name__, self.id, self.username.encode('utf8'))
def devices(self):
""" Returns a list of all :class:`~myplex.MyPlexDevice` objects connected to the server. """
return _listItems(MyPlexDevice.BASEURL, self.authenticationToken, MyPlexDevice)
def device(self, name): def device(self, name):
""" Returns the :class:`~myplex.MyPlexDevice` that matched the name specified. """ Returns the :class:`~myplex.MyPlexDevice` that matched the name specified.
* **name**: (str) Name to match against. Attributes:
name (str): Name to match against.
""" """
return _findItem(self.devices(), name) return _findItem(self.devices(), name)
def devices(self):
""" Returns a list of all :class:`~myplex.MyPlexDevice` objects connected to the server. """
return _listItems(MyPlexDevice.BASEURL, self.authenticationToken, MyPlexDevice)
def resources(self): def resources(self):
"""Resources. """Resources.

View file

@ -5,7 +5,6 @@ from datetime import datetime
from plexapi.compat import quote, urlencode from plexapi.compat import quote, urlencode
from plexapi.exceptions import NotFound, UnknownType, Unsupported from plexapi.exceptions import NotFound, UnknownType, Unsupported
from threading import Thread from threading import Thread
from plexapi import log
# Search Types - Plex uses these to filter specific media types when searching. # Search Types - Plex uses these to filter specific media types when searching.
SEARCHTYPES = {'movie': 1, 'show': 2, 'season': 3, SEARCHTYPES = {'movie': 1, 'show': 2, 'season': 3,