jkwill87 / mapi Goto Github PK
View Code? Open in Web Editor NEWmedia metadata database library
License: MIT License
media metadata database library
License: MIT License
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.
id_key
as a parameter to Provider
Provider
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
.
MapiNetworkException
on unsuccessful queryMapiNetworkException
on network failureThere 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.
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
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.
mapi uses requests_cache to cache the response of requests to API providers. This
cache
parameter to endpoint functions which signals to enable/ disable cachingcache
parameter to the Provider
classes which in turn passes this flag to the endpoint functions it callsSometime 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.
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.
long_description_content_type
in order to process markdown w/ setuptoolsThis needs to be accounted for in endpoints.tvdb_episodes_id
, and when encountered must raise MapiNotFoundException
.
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
@skip
test_invalid_token testsA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.