-
-
Notifications
You must be signed in to change notification settings - Fork 109
Architecture
The project uses an Adapter architecture to simplify the retrieval of torrents and movies. Movies and torrents are fetched independently. Providers are responsible for 'providing' torrents, movies, and other data. Generally, these are API's for a website. Providers 'provide' content to Adapters, which conform the data returned from the providers and return a single array of results.
Naming: The filename and object/class name of a provider precedes its appropriate suffix:
For example, a PirateBay
provider would be named PirateBayTorrentProvider
or. PBTorrentProvider
Suffixes include TorrentProvider
, MetadataProvider
, and others.
Methods:
A provider must return a promise in the expected format with a static method named provide
A torrent provider should have a 'static' method that should return an array of objects:
ExampleTorrentProvider.provide(imdbId)
// Returns array of availabe torrents
// Preferrably, these should be ordered by best quality.
//
// [
// {
// quality: <string>, 1080p || 720p,
// magnet: <string>
// seeders: <number>
// provder: <string>
// leechers: <number>
// },
// ...
// ]
Extensive details that are specific to a provider can be provided as a second argument in the form of an object:
ExampleTorrentProvider.provide(imdbId, {
searchQuery: 'harry potter and the half...', // Example of a custom query paramater
...otherCustomOptions
})
ExampleMetadataProvider.provide(imdbId)
// {
// title: <string>,
// year: <number>,
// imdbId: <string>,
// id: <string>, A general id that is not specific to movies. Reserved for future use
// summary: <string>,
// genres: <array>,
// runtime: {
// full: <number>,
// hours: <number>,
// minutes: <number>
// },
// trailer: <string>, A link to the trailer of the movie
// rating: <number>, 1 - 5, round to 1 decimal place || <string> n/a
// images: {
// fanart: {
// full: <string>
// medium: <string>
// thumb: <string>
// },
// poster: {
// full: <string>
// medium: <string>
// thumb: <string>
// },
// }
// }