mirror of
https://github.com/darkzoul5/YoutubePlaylistSync.git
synced 2026-11-04 07:38:14 +02:00
Refactor Docker image paths for better compatibility with Docker environment
This commit is contained in:
1 parent
6524c173a6
commit
e1971c3928
3 files changed
+17
-5
No files matched your search
@@ -45,4 +45,3 @@ jobs:
|
|||||||
|
|
||||||
- name: Push Docker image
|
- name: Push Docker image
|
||||||
run: docker push ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
run: docker push ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||||
|
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
#Custom for this project
|
#Custom for this project
|
||||||
yt-playlist-config.json
|
yt-playlist-config.json
|
||||||
/bin/
|
/bin/
|
||||||
|
/config/
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|||||||
+16
-4
@@ -17,6 +17,10 @@ FAIL = "✘"
|
|||||||
WARN = "⚠"
|
WARN = "⚠"
|
||||||
INFO = "ℹ"
|
INFO = "ℹ"
|
||||||
STEP = "➜"
|
STEP = "➜"
|
||||||
|
|
||||||
|
def is_docker():
|
||||||
|
return os.path.exists("/.dockerenv") or os.getenv("RUNNING_IN_DOCKER") == "true"
|
||||||
|
|
||||||
def update_yt_dlp(yt_dlp_path: str):
|
def update_yt_dlp(yt_dlp_path: str):
|
||||||
try:
|
try:
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
@@ -43,14 +47,22 @@ class ConfigLoader:
|
|||||||
"archive": "archive.txt"
|
"archive": "archive.txt"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"yt_dlp_path": "./bin/yt-dlp.exe" if platform.system() == "Windows" else "./bin/yt-dlp",
|
"yt_dlp_path": "yt-dlp" if is_docker() else ("./bin/yt-dlp.exe" if platform.system() == "Windows" else "./bin/yt-dlp"),
|
||||||
"ffmpeg_path": "./bin/ffmpeg.exe" if platform.system() == "Windows" else "./bin/ffmpeg",
|
"ffmpeg_path": "ffmpeg" if is_docker() else ("./bin/ffmpeg.exe" if platform.system() == "Windows" else "./bin/ffmpeg"),
|
||||||
"aria2c_path": "./bin/aria2c.exe" if platform.system() == "Windows" else "./bin/aria2c",
|
"aria2c_path": "aria2c" if is_docker() else ("./bin/aria2c.exe" if platform.system() == "Windows" else "./bin/aria2c"),
|
||||||
"max_parallel_downloads": 10,
|
"max_parallel_downloads": 10,
|
||||||
"aria2c_connections": 8
|
"aria2c_connections": 8
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, config_path: str = "yt-playlist-config.json"):
|
def __init__(self, config_path=None):
|
||||||
|
config_dir = Path("./config")
|
||||||
|
config_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
if config_path is None:
|
||||||
|
config_path = config_dir / "yt-playlist-config.json"
|
||||||
|
else:
|
||||||
|
config_path = Path(config_path)
|
||||||
|
if not config_path.is_absolute():
|
||||||
|
config_path = config_dir / config_path
|
||||||
self.config_path = Path(config_path).resolve()
|
self.config_path = Path(config_path).resolve()
|
||||||
if not self.config_path.exists():
|
if not self.config_path.exists():
|
||||||
self._create_default_config()
|
self._create_default_config()
|
||||||
|
|||||||
Reference in new issue
Block a user