burst package

Submodules

burst.burst module

Burst processing thread

burst.burst.search(payload, method='general')[source]

Main search entrypoint

Parameters:
  • payload (dict) – Search payload from Elementum.
  • method (str) – Type of search, can be general, movie, show, season or anime
Returns:

All filtered results in the format Elementum expects

Return type:

list

burst.burst.got_results(provider, results)[source]

Results callback once a provider found all its results, or not

Parameters:
  • provider (str) – The provider ID
  • results (list) – The list of results
burst.burst.extract_torrents(provider, client)[source]

Main torrent extraction generator for non-API based providers

Parameters:
  • provider (str) – Provider ID
  • client (Client) – Client class instance
Yields:

tuple – A torrent result

burst.burst.extract_from_api(provider, client)[source]

Main API parsing generator for API-based providers

An almost clever API parser, mostly just for YTS, RARBG and T411

Parameters:
  • provider (str) – Provider ID
  • client (Client) – Client class instance
Yields:

tuple – A torrent result

burst.burst.extract_from_page(provider, content)[source]

Sub-page extraction method

Parameters:
  • provider (str) – Provider ID
  • content (str) – Page content from Client instance
Returns:

Torrent or magnet link extracted from sub-page

Return type:

str

burst.burst.run_provider(provider, payload, method)[source]

Provider thread entrypoint

Parameters:
  • provider (str) – Provider ID
  • payload (dict) – Search payload from Elementum
  • method (str) – Type of search, can be general, movie, show, season or anime

burst.client module

Burst web client

class burst.client.Client[source]

Web client class with automatic charset detection and decoding

cookies()[source]

Saved client cookies

Returns:A list of saved Cookie objects
Return type:list
open(url, language='en', post_data=None, get_data=None)[source]

Opens a connection to a webpage and saves its HTML content in self.content

Parameters:
  • url (str) – The URL to open
  • language (str) – The language code for the Content-Language header
  • post_data (dict) – POST data for the request
  • get_data (dict) – GET data for the request
login(url, data, fails_with)[source]

Login wrapper around open

Parameters:
  • url (str) – The URL to open
  • data (dict) – POST login data
  • fails_with (str) – String that must not be included in the response’s content
Returns:

Whether or not login was successful

Return type:

bool

burst.client.get_cloudhole_key()[source]

CloudHole API key fetcher

Returns:A CloudHole API key
Return type:str
burst.client.get_cloudhole_clearance(cloudhole_key)[source]

CloudHole clearance fetcher

Parameters:cloudhole_key (str) – The CloudHole API key saved in settings or from get_cloudhole_key directly
Returns:A CloudHole clearance cookie and user-agent string
Return type:tuple

burst.filtering module

Burst filtering class and methods

class burst.filtering.Filtering[source]

Filtering class

resolutions

OrderedDict – Ordered dictionary of resolution filters to be used depending on settings

resolutions_allow

list – List of resolutions to allow in search results

release_types

dict – Dictionary of release types to be used depending on settings

releases_allow

list – List of release types to allow in search results

releases_deny

list – List of release types to deny in search results

require_keywords

list – List of keywords to require in search results

min_size

float – Minimum required size

max_size

float – Maximum possible size

filter_title

bool – Whether or not this provider needs titles to be double-checked, typically used for providers that return too many results from their search engine when no results are found (ie. TorLock and TorrentZ)

queries

list – List of queries to be filtered

extras

list – List of extras to be filtered

info

dict – Payload from Elementum

kodi_language

str – Language code from Kodi if kodi_language setting is enabled

language_exceptions

list – List of providers for which not to apply kodi_language setting

url

str – URL of this filtering request

get_data

dict – GET data for client request

post_data

dict – POST data for client request

title

str – Result title to be used when matching with filter_title enabled

reason

str – Rejection reason when result does not match

results

list – Filtered, accepted results

use_general(provider, payload)[source]

Setup method to define general search parameters

Parameters:
  • provider (str) – Provider ID
  • payload (dict) – Elementum search payload
use_movie(provider, payload)[source]

Setup method to define movie search parameters

Parameters:
  • provider (str) – Provider ID
  • payload (dict) – Elementum search payload
use_episode(provider, payload)[source]

Setup method to define episode search parameters

Parameters:
  • provider (str) – Provider ID
  • payload (dict) – Elementum search payload
use_season(provider, info)[source]

Setup method to define season search parameters

Parameters:
  • provider (str) – Provider ID
  • payload (dict) – Elementum search payload
use_anime(provider, info)[source]

Setup method to define anime search parameters

Parameters:
  • provider (str) – Provider ID
  • payload (dict) – Elementum search payload
information(provider)[source]

Debugging method to print keywords and file sizes

check_sizes()[source]

Internal method to make sure size range settings are valid

read_keywords(keywords)[source]

Create list from keywords where the values are marked between curly brackets, ie. {title}

Parameters:keywords (str) – String with all the keywords, ie. ‘{title} {year} movie’
Returns:List of keywords, ie. [‘{title}’, ‘{year}’]
Return type:list
process_keywords(provider, text)[source]

Processes the query payload from a provider’s keyword definitions

Parameters:
  • provider (str) – Provider ID
  • text (str) – Keyword placeholders from definitions, ie. {title}
Returns:

Processed query keywords

Return type:

str

verify(provider, name, size)[source]

Main filtering method to match torrent names, resolutions, release types and size filters

Parameters:
  • provider (str) – Provider ID
  • name (str) – Torrent name
  • size (str) – Arbitrary torrent size to be parsed
Returns:

True if torrent name passed filtering, False otherwise.

Return type:

bool

in_size_range(size)[source]

Compares size ranges

Parameters:size (str) – File size string, ie. 1.21 GB
Returns:True if file size is within desired range, False otherwise
Return type:bool
determine_resolution(name)[source]

Determine torrent resolution from defined filters. Defaults to filter_480p.

Parameters:name (str) – Name of the torrent to determine the resolution for
Returns:The filter key of the determined resolution, see self.resolutions
Return type:str
normalize_name(value)[source]

Method to normalize strings

Replaces punctuation with spaces, unquotes and unescapes HTML characters.

Parameters:value (str) – File name or directory string to convert
Returns:Converted file name or directory string
Return type:str
included(value, keys, strict=False)[source]

Check if the keys are present in the string

Parameters:
  • value (str) – Name of the torrent to check
  • keys (list) – List of strings that must be included in value
  • strict (bool) – Boolean flag to accept or not partial results
Returns:

True if any (or all if strict) keys are included, False otherwise.

Return type:

bool

unescape(name)[source]
Unescapes all HTML entities from a string using
HTMLParser().unescape()
Parameters:name (str) – String to convert
Returns:Converted string
Return type:str
exception(title=None)[source]

Change the title to the standard name in torrent sites

Parameters:title (str) – Title to check
Returns:Standard title
Return type:str
burst.filtering.apply_filters(results_list)[source]

Applies final result de-duplicating, hashing and sorting

Parameters:results_list (list) – Formatted results in any order
Returns:Filtered and sorted results
Return type:list
burst.filtering.cleanup_results(results_list)[source]

Remove duplicate results, hash results without an info_hash, and sort by seeders

Parameters:results_list (list) – Results to clean-up
Returns:De-duplicated, hashed and sorted results
Return type:list

burst.ordereddict module

class burst.ordereddict.OrderedDict(*args, **kwds)[source]

Bases: dict, UserDict.DictMixin

Backport of collections.OrderedDict for Python 2.6 (Kodi 16)

clear()[source]
popitem(last=True)[source]
keys()[source]
setdefault(key, default=None)
update(other=None, **kwargs)
pop(key, *args)
values()
items()
iterkeys()
itervalues()
iteritems()
copy()[source]
classmethod fromkeys(iterable, value=None)[source]

burst.provider module

Provider thread methods

burst.provider.generate_payload(provider, generator, filtering, verify_name=True, verify_size=True)[source]

Payload formatter to format results the way Elementum expects them

Parameters:
  • provider (str) – Provider ID
  • generator (function) – Generator method, can be either extract_torrents or extract_from_api
  • filtering (Filtering) – Filtering class instance
  • verify_name (bool) – Whether to double-check the results’ names match the query or not
  • verify_size (bool) – Whether to check the results’ file sizes
Returns:

Formatted results

Return type:

list

burst.provider.process(provider, generator, filtering, verify_name=True, verify_size=True)[source]

Method for processing provider results using its generator and Filtering class instance

Parameters:
  • provider (str) – Provider ID
  • generator (function) – Generator method, can be either extract_torrents or extract_from_api
  • filtering (Filtering) – Filtering class instance
  • verify_name (bool) – Whether to double-check the results’ names match the query or not
  • verify_size (bool) – Whether to check the results’ file sizes

burst.utils module

Burst utilities

class burst.utils.Magnet(magnet)[source]

Magnet link parsing class

Parameters:magnet (str) – A magnet link string
info_hash

str – Info-hash from the magnet link

name

str – Name of torrent

trackers

list – List of trackers in magnet link

burst.utils.get_domain(url)[source]
burst.utils.get_alias(definition, alias)[source]
burst.utils.get_providers()[source]

Utility method to get all provider IDs available in the definitions

Returns:All available provider IDs
Return type:list
burst.utils.get_enabled_providers()[source]

Utility method to get all enabled provider IDs

Returns:All available enabled provider IDs
Return type:list
burst.utils.get_icon_path()[source]

Utility method to Burst’s icon path

Returns:Path to Burst’s icon
Return type:str
burst.utils.translation(id_value)[source]

Utility method to get translations

Parameters:id_value (int) – Code of translation to get
Returns:Translated string
Return type:str
burst.utils.get_int(string)[source]

Utility method to convert a number contained in a string to an integer

Parameters:string (str) – Number contained in a string
Returns:The number as an integer, or 0
Return type:int
burst.utils.get_float(string)[source]

Utility method to convert a number contained in a string to a float

Parameters:string (str) – Number contained in a string
Returns:The number as a float, or 0.0
Return type:float
burst.utils.size_int(size_txt)[source]

Utility method to convert a file size contained in a string to an integer of bytes

Parameters:string (str) – File size with suffix contained in a string, eg. 1.21 GB
Returns:The number of bytes as a float, or 0.0
Return type:float
burst.utils.clean_number(string)[source]

Utility method to clean up a number contained in a string to dot decimal format

Parameters:string (str) – Number contained in a string
Returns:The formatted number as a string
Return type:str
burst.utils.clean_size(string)[source]

Utility method to remove unnecessary information from a file size string, eg. ‘6.5 GBytes’ -> ‘6.5 GB’

Parameters:string (str) – File size string to clean up
Returns:Cleaned up file size
Return type:str
burst.utils.sizeof(num, suffix='B')[source]

Utility method to convert a file size in bytes to a human-readable format

Parameters:
  • num (int) – Number of bytes
  • suffix (str) – Suffix for ‘bytes’
Returns:

The formatted file size as a string, eg. 1.21 GB

Return type:

str

burst.utils.notify(message, image=None)[source]

Creates a notification dialog

Parameters:
  • message (str) – The message to show in the dialog
  • image (str) – Path to an icon for this dialog
burst.utils.clear_cache()[source]

Clears cookies from Burst’s cache

burst.utils.encode_dict(dict_in)[source]

Encodes dict values to UTF-8

Parameters:dict_in (dict) – Input dictionary with unicode values
Returns:Output dictionary with UTF-8 encoded values
Return type:dict
burst.utils.iri2uri(iri)[source]
burst.utils.encode(c)[source]