Package: nxtools
nxtoolsnxtools is a set of various tools and helpers used byNebulaand other software.Installationpip install nxtoolsOptional dependenciesunidecodefor full unicode transliterationcoloramafor colored log output even on WindowsExamplesPodcasts downloaderReferenceCasparCGCasparCG client objectCasparResponseCaspar query response objectFileObjectAn object representing a file on the filesystem.The class provides a number of utility methods and properties
for easy access to file metadata.critical_errorLog an error message and exit program.datestr2tsConvert aYYYY-MM-DDstring to an unix timestamp.By default, start of the day (midnight) is returned.Args:
    datestr (str):
        `YYYY-MM-DD` string

    hh (int):
        Hour (default: 0)

    mm (int):
        Minute (default: 0)

    ss (int):
        Second (default: 0)

Returns:
    int:
        Parsed unix timestampf2tcConvert frames to an SMPTE timecodeArgs:
    frames (int):
        Frame count

    base (float):
        Frame rate (default: 25)

Returns:
    str:
        SMPTE timecode (`HH:MM:SS:FF`)ffmpegFFMpeg wrapper with progress and error handlingArgs:
    *args (list[any]): 
        List of ffmpeg command line arguments.
        Each argument is converted to a string.

    progress_handler (function):
        Function to be called with the current position (seconds) as argument.

    stdin (file):
        File object to be used as stdin.
        Default is subprocess.PIPE

    stdout (file):
        File object to be used as stdout.
        Default is None

    stderr (file):
        File object to be used as stderr.
        Default is subprocess.PIPE (used to compute progress).

    debug (bool):
        Enable debug mode (write ffmpeg output to stderr).

Returns:
    boolean: indicate if the process was successfulffprobeExtract metadata from a media file using ffprobe
and returns a dictionary object with the resultArgs:
    input_file (str): 
        Path to the media file

    verbose (bool): 
        Log the ffprobe command. Default is False

Returns:
    dict: metadatafile_to_titleAttempt to un-slugify a file namefilter_arcAspect ratio convertor. you must specify output size and source aspect ratio (as float)filter_deinterlaceYadif deinterlacefind_binaryAttempt to find a given executable and return its pathArgs:
    file_name (str): The name of the executable to find

Returns:
    str: The path to the executableformat_filesizeReturn a human readable filesize for a given byte countformat_timeFormat an Unix timestamp as a local or GMT timeArgs:
    timestamp (int):
        input unix timestamp

    time_format (str):
        strftime specification
        (default: "%Y-%m-%d %H:%M:%S" - the correct one)

    never_placeholder (str):
        text used when timestamp is not specified (default: "never")

    gmt (bool):
        Use GMT time instead of local time (default: False)

Returns:
    str:
        Formatted timeget_base_nameStrip a directory and extension from a given path./etc/foo/bar.bazbecomesbarArgs:
    file_name (str): path-like object, string or FileObject

Returns:
    strget_filesCrawl a given directoryFor each file found inbase_pathyield a FileObject object.Args:
    base_path (str):
        Path to the directory to be crawled

    recursive (bool):
        Crawl recursively (default: False)

    hidden (bool):
        Yield hidden (dot)files too (default: False)

    exts (list):
        If specified, yields only files matching given extensions

    case_sensitive_exts (bool):
        Do not ignore cases when `exts` list is used (default: False)get_guidReturn a GUIDReturns:
str: GUIDget_path_pairsFor each file found ininput_dirand yield a tuple of (input_path, output_path)This function is useful for batch conversion, when you need to process files
frominput_dirand output the result tooutput_dir.Most arguments are the same as forget_files. You can also specify a target extension,
and use a slugifier for the output path.Args:
    target_ext (str):
    target_slugify (bool): (default: False)get_tempReturn a path to a temporary fileArgs:
    extension (str)
    root (str)indentIndent a multi-line textjoin_filtersJoins multiple filterslog_tracebackLog the current exception tracebacks2tcConvert seconds to an SMPTE timecodeArgs:
    secs (float):
        Number of seconds

    base (float):
        Frame rate (default: 25)

Returns:
    str:
        SMPTE timecode (`HH:MM:SS:FF`)s2timeConvert seconds to timeArgs:
    secs (float):

    show_secs (bool):
        Show seconds (default: True)

    show_fracs (bool):
        Show centiseconds (default: True)

Returns:
    str:
        `HH:MM` / `HH:MM:SS` / `HH:MM:SS.CS` strings2wordsCreate a textual (english) representation of given number of seconds.This function is useful for showing estimated time of a process.Args:
    secs (int):
        Number of seconds

Returns:
    str:
        Textual informationslugifySlugify a text stringThis function removes transliterates input string to ASCII, removes special characters
and use join resulting elemets using specified separator.Args:
    input_string (str):
        Input string to slugify

    separator (str): 
        A string used to separate returned elements (default: "-")

    lower (bool): 
        Convert to lower-case (default: True)

    make_set (bool):
        Return "set" object instead of string

    min_length (int): 
        Minimal length of an element (word)

    slug_whitelist (str): 
        Characters allowed in the output
        (default: ascii letters, digits and the separator)

    split_chars (str): 
        Set of characters used for word splitting (there is a sane default)string2colorGenerate more or less unique color for a given stringtc2sConvert an SMPTE timecode (HH:MM:SS:FF) to number of secondsArgs:
    tc (str):
        Source timecode

    base (float):
        Frame rate (default: 25)

Returns:
    float:
        Resulting value in secondsunaccentRemove accents and/or transliterate non-ascii charactersxmlParse an XML string using ElementTreeArgs:
    data (str): The XML document to parse

Returns:
    ElementTree.Element: The root element of the parsed XML string