Utils

subliminal.utils.hash_opensubtitles(video_path)[source]

Compute a hash using OpenSubtitles’ algorithm.

Parameters:video_path (str) – path of the video.
Returns:the hash.
Return type:str
subliminal.utils.hash_thesubdb(video_path)[source]

Compute a hash using TheSubDB’s algorithm.

Parameters:video_path (str) – path of the video.
Returns:the hash.
Return type:str
subliminal.utils.hash_napiprojekt(video_path)[source]

Compute a hash using NapiProjekt’s algorithm.

Parameters:video_path (str) – path of the video.
Returns:the hash.
Return type:str
subliminal.utils.hash_shooter(video_path)[source]

Compute a hash using Shooter’s algorithm

Parameters:video_path (string) – path of the video
Returns:the hash
Return type:string
subliminal.utils.sanitize(string, ignore_characters=None)[source]

Sanitize a string to strip special characters.

Parameters:
  • string (str) – the string to sanitize.
  • ignore_characters (set) – characters to ignore.
Returns:

the sanitized string.

Return type:

str

subliminal.utils.sanitize_release_group(string)[source]

Sanitize a release_group string to remove content in square brackets.

Parameters:string (str) – the release group to sanitize.
Returns:the sanitized release group.
Return type:str
subliminal.utils.timestamp(date)[source]

Get the timestamp of the date, python2/3 compatible

Parameters:date (datetime.datetime) – the utc date.
Returns:the timestamp of the date.
Return type:float