ytdl-sub/src/ytdl_sub/config/defaults.py
dependabot[bot] d3e978e517
[DEV] Bump pylint from 3.3.8 to 4.0.1 (#1361)
* Bump pylint from 3.3.8 to 4.0.1

Bumps [pylint](https://github.com/pylint-dev/pylint) from 3.3.8 to 4.0.1.
- [Release notes](https://github.com/pylint-dev/pylint/releases)
- [Commits](https://github.com/pylint-dev/pylint/compare/v3.3.8...v4.0.1)

---
updated-dependencies:
- dependency-name: pylint
  dependency-version: 4.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* update fixes

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jesse Bannon <jbann1994@gmail.com>
2025-10-26 23:57:35 -07:00

39 lines
1.1 KiB
Python

import os
from ytdl_sub.utils.system import IS_WINDOWS
# pylint: disable=invalid-name
def _existing_path(*paths: str) -> str:
"""
Tries to search multiple paths for a file, returns a
path if it exists. If none are valid files, returns
the first one
"""
for path in paths:
if os.path.isfile(path):
return path
return paths[0]
if IS_WINDOWS:
DEFAULT_LOCK_DIRECTORY = "" # Not supported in Windows
DEFAULT_FFMPEG_PATH = ".\\ffmpeg.exe"
DEFAULT_FFPROBE_PATH = ".\\ffprobe.exe"
MAX_FILE_NAME_BYTES = 255
else:
DEFAULT_LOCK_DIRECTORY = ".ytdl-sub-lock"
DEFAULT_FFMPEG_PATH = os.getenv(
"YTDL_SUB_FFMPEG_PATH", _existing_path("/usr/bin/ffmpeg", "/usr/local/bin/ffmpeg")
)
DEFAULT_FFPROBE_PATH = os.getenv(
"YTDL_SUB_FFPROBE_PATH", _existing_path("/usr/bin/ffprobe", "/usr/local/bin/ffmpeg")
)
MAX_FILE_NAME_BYTES = os.pathconf("/", "PC_NAME_MAX")
# Historically was hardcoded to this value. Use this as the default
# if download_archive_path is not specified
DEFAULT_DOWNLOAD_ARCHIVE_NAME = ".ytdl-sub-{subscription_name}-download-archive.json"