burst package¶
Subpackages¶
Submodules¶
burst.burst module¶
Burst processing thread
-
burst.burst.
search
(payload, method='general')[source]¶ Main search entrypoint
Parameters: 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: 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: Yields: tuple – A torrent result
burst.client module¶
Burst web client
-
class
burst.client.
Client
[source]¶ Web client class with automatic charset detection and decoding
Saved client cookies
Returns: A list of saved Cookie objects Return type: list
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:
-
use_episode
(provider, payload)[source]¶ Setup method to define episode search parameters
Parameters:
-
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: Returns: Processed query keywords
Return type:
-
verify
(provider, name, size)[source]¶ Main filtering method to match torrent names, resolutions, release types and size filters
Parameters: Returns: True
if torrent name passed filtering,False
otherwise.Return type:
-
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
otherwiseReturn 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: Returns: True if any (or all if
strict
) keys are included, False otherwise.Return type:
-
burst.ordereddict module¶
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
orextract_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
orextract_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_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: Returns: The formatted file size as a string, eg.
1.21 GB
Return type: