Skip to content

Architecture

Amila Welihinda edited this page Jun 27, 2016 · 6 revisions

Adapter 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.

Torrents

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:

ExampleTorrentProvider.provide(imdbId, {
 searchQuery: 'harry potter and the half...',
 ...otherCustomOptions
})
Clone this wiki locally