-
Notifications
You must be signed in to change notification settings - Fork 3
Custom Providers
Prism allows you to install and develop custom provider modules, letting you connect to multiple online/offline services for source scraping. This page covers how to develop and package your own provider packages.
Important: Prism does not bundle, host, or distribute any provider packages. All packages are third-party and installed by users at their own discretion. Prism does not endorse or support any specific package.
Each provider package must supply a meta.json file and all entries must be present.
An example meta:
{
"remote_meta": "https://yourdomain.com/meta.json",
"version": "1.1.1",
"update_directory": "https://yourdomain.com/ftp/",
"name": "ExamplePackage",
"author": "Example"
}- version: Full-stop separated version number.
- name: Name of the provider package. This must match exactly in your folder structure and update directories.
- author: Author alias.
-
update_directory: Your update directory is the URL to the folder that contains your release versions. Prism will automatically generate the final file name based on your meta contents, e.g.
https://yourdomain.com/ftp/ExamplePackage-1.1.1.zip. Your release zip files must resemble this format, including the dash to separate the version number and package name. -
remote_meta: This remote file is used by Prism to identify the currently released version information and whether the
update_directoryhas been changed. This means Prism can still identify and install updates in the event you change your update location.
NOTE: Your
remote_metainformation is updated alongside a package update. This meansremote_metalocations will change according to the meta information in your release, so please be sure your remote meta file URL is correct with each release or you will break your users' updates.
Custom providers have very specific folder structures that must be maintained. The contents of the install zip file should follow this format exactly:
meta.json
providers
|
package name
|
language code
__init__.py
|
provider type
__init__.py
|
(provider.pys)
__init__.py
providerModules
|
package name
|
__init__.py
(extra modules for your providers)
The init file in each language folder your provider package supports must supply a list of provider file names for each applicable provider type.
An example init contents is provided below:
# -*- coding: utf-8 -*-
import hosters
import torrent
def get_hosters():
return hosters.__all__
def get_torrent():
return torrent.__all__All providers must return a list of dictionary objects as their final result.
import re
import requests
class sources:
def __init__(self):
self.domain = ""
self.base_link = ""
self.search_link = ""
def movie(self, title, year):
return torrent_list
def episode(self, simpleInfo, allInfo):
return torrent_listTorrent entry points should return a list of torrent dict objects.
Example torrent object:
{
'release_title': <string>,
'magnet': <string>,
**'hash': <string>,
**'quality': <string>,
**'info': <list of string values>,
'size': <int>, # Size of source in megabytes
'seeds': <int>,
'package': <string>, # Package Type (single, season, show)
}** Denotes optional return values. If these values are not present, Prism will attempt to generate the values based on the release title of the source.
Hoster providers will always start at their respective function and end at the sources function.
The sources function must return a list of dictionary objects:
class source:
def __init__(self):
self.priority = 1
self.language = ['en']
self.domains = ['']
self.base_link = ''
self.search_link = ''
def movie(self, imdb, title, localtitle, aliases, year):
return results
def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
return results
def episode(self, url, imdb, tvdb, title, premiered, season, episode):
return results
def sources(self, url, hostDict, hostprDict):
return sources
def resolve(self, url):
return urlExample dictionary object:
{
'source': <string>,
'quality': <string>,
'language': <string>, # Language Code
'url': <string>,
'direct': <boolean>,
'debridonly': <boolean>,
'info': <list of string values>,
}