Skip to content

Commit

Permalink
Documentation fixes (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc authored Nov 30, 2022
2 parents ac47b56 + 6f98c1c commit db97e2c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 36 deletions.
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ BUILDDIR = _build

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from https://sphinx-doc.org/)
endif

# Internal variables.
Expand Down
11 changes: 5 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ trakt: Python interface to Trakt.tv
===================================
Release v\ |version|.

This module is designed to be a Pythonic interface to the `Trakt.tv <http://trakt.tv>`_.
REST API. The official documentation for which can be found `here <http://trakt.tv/api-docs/>`_.
This module is designed to be a Pythonic interface to the `Trakt.tv <https://trakt.tv>`_.
REST API. The official documentation for which can be found `here <https://trakt.docs.apiary.io>`_.
trakt contains interfaces to all of the Trakt.tv functionality in an, ideally, easily
scriptable fashion.

Expand All @@ -22,9 +22,9 @@ There are two ways through which you can install trakt

Install Via Pip
^^^^^^^^^^^^^^^
To install with `pip <http://www.pip-installer.org/>`_, just run this in your terminal::
To install with `pip <https://pip.pypa.io/>`_, just run this in your terminal::

$ pip install trakt
$ pip install pytrakt

Get the code
^^^^^^^^^^^^
Expand All @@ -36,7 +36,7 @@ You can either clone the public repository::

Download the `tarball <https://github.com/glensc/python-pytrakt/tarball/main>`_::

$ curl -OL https://github.com/glensc/python-pytrakt/tarball/master
$ curl -OL https://github.com/glensc/python-pytrakt/tarball/main

Or, download the `zipball <https://github.com/glensc/python-pytrakt/zipball/main>`_::

Expand All @@ -62,7 +62,6 @@ including example usages.
people.rst
tv.rst
users.rst
sync.rst
core.rst
sync.rst

Expand Down
25 changes: 8 additions & 17 deletions docs/movies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ block the specified movie from being shown in your recommended movies.
::

>>> from trakt.movies import dismiss_recommendation
>>> dismiss_recommendation(imdb_id='tt3139072', title='Son of Batman',
... year=2014)
>>> dismiss_recommendation('Son of Batman')


This code snippet would prevent Son of Batman from appearing in your recommended
Expand All @@ -28,24 +27,16 @@ the currently authenticated user.
>>> from trakt.movies import get_recommended_movies
>>> all_movies = get_recommended_movies()
>>> all_movies
[<Movie>: b'The Dark Knight', <Movie>: b'WALLE', <Movie>: b'Up', <Movie>: b'Toy Story',...


There's also a function to quickly rate a list of movies as the currently
authenticated user.
::

>>> from trakt.movies import Movie, rate_movies
>>> rate_movies(all_movies, 'love')
[<Movie>: 'The Dark Knight', <Movie>: 'WALLE', <Movie>: 'Up', <Movie>: 'Toy Story',...

There are a few properties that belong to the trakt.movies module as well.
::

>>> from trakt import movies
>>> movies.genres
>>> movies.genres()
[Genre(name='Action', slug='action'), Genre(name='Adventure', slug='adventure'),...
>>> movies.trending_movies
[<Movie>: b'The LEGO Movie', <Movie>: b'Non-Stop', <Movie>: b'Frozen', <Movie>: b'RoboCop',...
>>> movies.trending_movies()
[<Movie>: 'The LEGO Movie', <Movie>: 'Non-Stop', <Movie>: 'Frozen', <Movie>: 'RoboCop',...
>>> movies.updated_movies()
[]

Expand All @@ -54,11 +45,11 @@ optional year, and you will be returned an interface to that Movie on trakt.tv.
::

>>> from trakt.movies import Movie
>>> batman = Movie('Son of Batman')
>>> batman = Movie('Son of Batman', 2014)
>>> batman.overview
'Batman learns that he has a violent, unruly pre-teen son with Talia al Ghul named Damian Wayne who is secretly being...
>>> batman.released_iso
'2014-04-20T07:00:00'
>>> batman.released
'2014-04-22'
>>> batman.genres
[Genre(name='Action', slug='action'), Genre(name='Adventure', slug='adventure'), Genre(name='Animation', slug='animation')]
>>> batman.add_to_library()
Expand Down
2 changes: 1 addition & 1 deletion docs/people.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ about them
>>> heyy.birthplace
'Uvalde, Texas, USA'
>>> heyy.biography
'\u200bFrom Wikipedia, the free encyclopedia. \xa0\n\nMatthew David McConaughey (born November 4, 1969) is an American actor.\n...'
"Matthew David McConaughey (born November 4, 1969) is an American actor..."
>>> heyy.images
{'headshot': 'http://slurm.trakt.us/images/poster-dark.jpg'}

Expand Down
6 changes: 3 additions & 3 deletions docs/tv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ object
[<TVEpisode>: The IT Crowd S1E1 Yesterday's Jam, <TVEpisode>: The IT Crowd S1E2 Calamity Jen,
<TVEpisode>: The IT Crowd S2E1 The Work Outing, <TVEpisode>: The IT Crowd S1E4 The Red Door,...
>>> it_crowd.top_watchers
[<User>: b'Vaelek', <User>: b'Governa', <User>: b'shanos404', <User>: b'b_jammin666',
<User>: b'pavvoc', <User>: b'heartbraden', <User>: b'tressal', <User>: b'hherrera',...
[<User>: 'Vaelek', <User>: 'Governa', <User>: 'shanos404', <User>: 'b_jammin666',
<User>: 'pavvoc', <User>: 'heartbraden', <User>: 'tressal', <User>: 'hherrera',...
>>> it_crowd.genres
[Genre(name='Comedy', slug='comedy')]

Expand All @@ -57,7 +57,7 @@ information on the show's seasons and episodes
<TVEpisode>: The IT Crowd S1E-1 The Haunting of Bill Crouse, <TVEpisode>: The IT Crowd S1E-1 Aunt Irma Visits]
>>> pilot = s1.episodes[0]
>>> pilot.title
'Yesterday's Jam'
"Yesterday's Jam"
>>> pilot.overview
'Jen is hired as the manager Reynholm Industries although she doesn't know the first thing about computers.'

6 changes: 1 addition & 5 deletions docs/users.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ Good, now we have a hold of the :class:`User` object. Now we can get all of the
available from this trakt.tv :class:`User`.
::

>>> my.gender
'male'
>>> my.location
'Newmarket NH'
>>> my.movie_collection
[<Movie>: b'2 Fast 2 Furious', <Movie>: b'A Beautiful Mind', <Movie>: b'A Bronx Tale', <Movie>: b"A Bug's Life", <Movie>: b'A Christmas Carol',...
[<Movie>: '2 Fast 2 Furious', <Movie>: 'A Beautiful Mind', <Movie>: 'A Bronx Tale', <Movie>: "A Bug's Life", <Movie>: 'A Christmas Carol',...


4 changes: 2 additions & 2 deletions trakt/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ def search(query, search_type='movie', year=None, slugify_query=False):
'movie', 'show', 'episode', or 'person'
:param year: This parameter is ignored as it is no longer a part of the
official API. It is left here as a valid arg for backwards
compatability.
compatibility.
:param slugify_query: A boolean indicating whether or not the provided
query should be slugified or not prior to executing the query.
"""
# the new get_search_results expects a list of types, so handle this
# conversion to maintain backwards compatability
# conversion to maintain backwards compatibility
if isinstance(search_type, str):
search_type = [search_type]
results = get_search_results(query, search_type, slugify_query)
Expand Down
2 changes: 1 addition & 1 deletion trakt/tv.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ def __init__(self, show, season, number=-1, **kwargs):
self._build(kwargs)
else:
self._get()
self.episode = self.number # Backwards compatability
self.episode = self.number # Backwards compatibility

@get
def _get(self):
Expand Down

0 comments on commit db97e2c

Please sign in to comment.