Skip to content

Commit

Permalink
Started work on better documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pkkid committed Jan 22, 2017
1 parent 976ab02 commit c684552
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 50 deletions.
18 changes: 8 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
syntax: glob
*.db
*.egg-info
*.log
*.pyc
*.swp
*.sublime-*
*.swp
*__pycache__*
dist
build
*.egg-info
.idea/
lib/
bin/
include/
.cache/
.idea/
.Python
bin/
build
dist
docs/_build/

include/
lib/
pip-selfcheck.json

pyvenv.cfg
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ are permitted provided that the following conditions are met:
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
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
specific prior written permission.

Expand Down
20 changes: 7 additions & 13 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@

Welcome to Python PlexAPI's documentation!
==========================================

Python PlexAPI
==============
.. include:: toc.rst

.. 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>`_.
4 changes: 2 additions & 2 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PlexAPI Introduction
====================
Introduction
============

.. |br| raw:: html

Expand Down
1 change: 0 additions & 1 deletion docs/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ MyPlex (plexapi.myplex)
-----------------------
.. automodule:: plexapi.myplex
:members:
:undoc-members:
:show-inheritance:

Photo (plexapi.photo)
Expand Down
3 changes: 2 additions & 1 deletion docs/toc.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.. toctree::
:maxdepth: 1
:maxdepth: 2
:caption: Table of Contents

self
introduction
modules
8 changes: 7 additions & 1 deletion plexapi/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Python 2/3 compatability
Always try Py3 first
"""
import sys

try:
from urllib.parse import urlencode
Expand All @@ -20,8 +21,13 @@
except ImportError:
from urllib import unquote


try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser

try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree import ElementTree

29 changes: 9 additions & 20 deletions plexapi/myplex.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
# -*- coding: utf-8 -*-
import sys

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
import plexapi, requests
from plexapi import TIMEOUT, log, utils
from plexapi.exceptions import BadRequest, NotFound, Unauthorized
from plexapi.client import PlexClient
from plexapi.compat import ElementTree
from plexapi.server import PlexServer
from requests.status_codes import _codes as codes


class MyPlexAccount(object):
Expand Down Expand Up @@ -90,17 +78,18 @@ def __init__(self, data, initpath=None):
def __repr__(self):
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):
""" 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)

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):
"""Resources.
Expand Down
1 change: 0 additions & 1 deletion plexapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from plexapi.compat import quote, urlencode
from plexapi.exceptions import NotFound, UnknownType, Unsupported
from threading import Thread
from plexapi import log

# Search Types - Plex uses these to filter specific media types when searching.
SEARCHTYPES = {'movie': 1, 'show': 2, 'season': 3,
Expand Down

0 comments on commit c684552

Please sign in to comment.