stash_vroom.slr module¶
This module helps to work with files downloaded from SLR and its network.
It helps to detect and extract important information from the download filenames.
- stash_vroom.slr.get_is_slr(filepath)[source]¶
Return True if the file is a SLR or related site download.
- Parameters:
filepath (str) – A filename or file path
- Returns:
True if the file is a SLR download, False otherwise.
- Return type:
bool
>>> from stash_vroom.slr import get_is_slr >>> filename = 'SLR_StudioName_Title_Original_1080p_12345_LR_180.mp4' >>> if get_is_slr(filename): ... print(f"Downloaded from SLR or related site: {filename}") Downloaded from SLR or related site: SLR_StudioName_Title_Original_1080p_12345_LR_180.mp4
- stash_vroom.slr.get_slr_info(filepath)[source]¶
Extract metadata from SLR-style filenames.
- Parameters:
filepath (str) – A filename or file path
- Returns:
A tuple containing site, studio, title, resolution, SLR ID, and projection.
- Return type:
tuple
>>> from stash_vroom.slr import get_slr_info >>> filename = 'SLR_StudioName_Title_Original_1080p_12345_LR_180.mp4' >>> site, studio, title, v_res, slr_id, projection = get_slr_info(filename) >>> print(f"To see "{title}" by {studio} at {projection}, search {site} for: {slr_id}") To see "Title_Original" by StudioName at LR_180, search SLR for: 12345
- stash_vroom.slr.get_slr_re(prefix='^', site='SLR|DeoVR|JillVR', studio=None, short=False)[source]¶
Generate a regular expression to match SLR-style filenames.
Returns a pattern as string because it can be useful both within Python and also submitting to Stash as a regex filter.
- Parameters:
prefix (str) – A string that specifies the prefix for the regex. Must be either ‘^’ (default, more useful for filenames) or ‘/’ (useful for file paths or URLs).
site (str) – A regex pattern for the site name. Defaults to ‘SLR|DeoVR|JillVR’.
studio (str, optional) – A regex pattern for the studio name. Defaults to None, which matches any studio.
short (bool) – If True, generates a shorter regex that excludes resolution and projection details. Defaults to False.
- Returns:
A regex pattern string.
- Return type:
str
Tip
This regex works as a Stash query.
>>> from stash_vroom.slr import get_slr_re >>> filepath_re = get_slr_re(prefix='/') >>> path_filter = {'modifier':'MATCHES_REGEX', 'value':filepath_re} >>> print(f'This filter will find SLR files in a Stash repo: {path_filter}') This filter will find SLR files in a Stash repo: {'modifier': 'MATCHES_REGEX', 'value': <regex pattern>}
See also
get_slr_info()
for extracting metadata from filenames using the regex generated by this function.