Giter Club home page Giter Club logo

mapi's People

Contributors

jkwill87 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mapi's Issues

Add default id override

Overview

TVDb and TMDb both allow users to query using IMDb ids in addition to their own respective ids. For the sake of simplicity and providing a uniform interface, all classes extending from Provider should have a parameter that defaults to their primary id.

Acceptance Criteria

  • Add id_key as a parameter to Provider
  • Implement it in all classes that inherit from Provider

Raise MapiNetworkException instead of AssertionError

Background

When mapi fails because of a network or API provider related error it can result in an AssertionError or in raising one of request's exceptions. While during development it might have made sense to presuppose that these services would always be up, in reality this is not a guarantee (looking at you TVDb). In order to handle these situations more gracefully mapi should restrict itself to raising a single exception type, MapiNetworkException.

Acceptance Criteria

  • Raise MapiNetworkException on unsuccessful query
  • Raise MapiNetworkException on network failure

Fix MetadataTelevision._str_pad_episode() method

There is a small problem with the substitution regex, it only checks for an 'x' sandwiched between digits, itself wrapped in whitespace. This should also be written to account for an EOL character.

Handle cache incompatibilities

Background

  • mapi makes use of requests-cache to cache API provider responses to reduce the number of API calls and increase performance
  • request-cache essentially just serializes request binary objects and stores them in a sqlite database
  • the format of these objects vary between versions of python so an effort is made to separate py2 and py3 databases so that they can coexist
  • unfortunately there are even incompatibilities between different versions of python packages which can surface when a user updates mapi's dependencies :(

Acceptance Criteria

  • Invalidate or delete cache on error
  • Retry request

Notes

Search by year range

Instead of, or in addition to filtering using the year_delta kwarg parameter, it would probably be useful to just search by year range.

i.e.:

from mapi.providers import IMDb
client = IMDb()
client.search(title='The Goonies', year='1980-1990')  # yields results between 1980 and 1990
client.search(title='The Goonies', year='1980-')      # yields results from 1980 to present
client.search(title='The Goonies', year='-1980')      # yields results from prior to 1980

Ensure extension is prefixed with a dot

Background

Currently Metadata and its derived classes allow adding an extension as a string. This can make formatting inconsistent because its not really obvious whether this should include the dot or not.

Acceptance Criteria

  • Ensure that the extension string is prefixed with a dot regardless of whether it is stored with one

Make request caching optional

Background

mapi uses requests_cache to cache the response of requests to API providers. This

Acceptance Criteria

  • Add a boolean cache parameter to endpoint functions which signals to enable/ disable caching
  • Add a boolean cache parameter to the Provider classes which in turn passes this flag to the endpoint functions it calls
  • Disable caching for failure checking endpoint tests and unskip them

IMDb API Broken

Sometime in the last month the IMDb made changes to their unofficial API. This completely breaks the IMDb provider. When I have time I might decompile their Android APK to map the new endpoints. In the mean time I've removed all references to their API.

Add OMDb Support

OMDb support was removed after the service went paid-only. The OMDb recently opened up free API keys again so it could probably be supported again.

Fix readme.md rendering on pypi.org

Background

  • markdown readme still isn't rendering correctly on pypi warehouse
  • related to #15

Acceptance Criteria

  • explicitly set long_description_content_type in order to process markdown w/ setuptools

episode padding not working

Simple test case -

from mapi.metadata import MetadataTelevision

meta = MetadataTelevision(
    media='television',
    series='adventure time',
    season=5,
    episode=3,
    title='Five More Short Graybles'
)

print(meta.format('<$series>-<S$season><E$episode>-<$title>'))

Result - Adventure Time-S05E3-Five More Short Graybles

Expected result - Adventure Time-S05E03-Five More Short Graybles

Fix package requirements

Overview

  • Development requirements are unnecessarily being downloaded and installed by default
  • Want to add minimum package requirements to prevent bugs like jkwill87/mnamer#2

Acceptance Criteria

  • Use concrete version numbers (e.g. requests==2.17.3)
  • Add development dependencies to extras_require section

Skip test_invalid_token tests

Background

  • These tests make sense for the sake of comprehensiveness and coverage so they should probably be kept around.
  • That being said they are incompatible with request_cache which speeds up testing a ton.

Acceptance Criteria

  • @skip test_invalid_token tests

Setup

  • add setup.py for installation support

Add Metadata class

  • Extend MutableMapping so that it can be treated like a dict
  • Allow implicit and explicit formatting
  • Enforce relevant fields, i.e. so you can't add 'year' to television metadata or 'season' to movie metadata accidentally

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.