minor cleanup and updates
This commit is contained in:
parent
538b91acec
commit
429511f96e
2
app.py
2
app.py
@ -4,9 +4,9 @@ REST API for YouTube CLI application
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import subprocess
|
||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from flask import Flask, jsonify, request
|
from flask import Flask, jsonify, request
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ name = "youtube-cli"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "A command-line interface for browsing and downloading YouTube videos"
|
description = "A command-line interface for browsing and downloading YouTube videos"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.7"
|
requires-python = ">=3.10"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Your Name", email = "your.email@example.com"},
|
{name = "Your Name", email = "your.email@example.com"},
|
||||||
]
|
]
|
||||||
@ -24,9 +24,7 @@ classifiers = [
|
|||||||
"Operating System :: MacOS",
|
"Operating System :: MacOS",
|
||||||
"Operating System :: POSIX :: Linux",
|
"Operating System :: POSIX :: Linux",
|
||||||
"Programming Language :: Python :: 3 :: Only",
|
"Programming Language :: Python :: 3 :: Only",
|
||||||
"Programming Language :: Python :: 3.7",
|
|
||||||
"Programming Language :: Python :: 3.8",
|
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Programming Language :: Python :: 3.12",
|
"Programming Language :: Python :: 3.12",
|
||||||
@ -34,7 +32,7 @@ classifiers = [
|
|||||||
"Topic :: Utilities",
|
"Topic :: Utilities",
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"yt-dlp>=2023.12.0",
|
"yt-dlp==2026.3.3",
|
||||||
"rich>=13.0.0",
|
"rich>=13.0.0",
|
||||||
"requests>=2.28.0",
|
"requests>=2.28.0",
|
||||||
]
|
]
|
||||||
@ -80,14 +78,14 @@ python_functions = ["test_*"]
|
|||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 80
|
line-length = 80
|
||||||
target-version = "py37"
|
target-version = "py310"
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
select = ["E", "F", "W", "I"]
|
select = ["E", "F", "W", "I"]
|
||||||
ignore = ["E501"]
|
ignore = ["E501"]
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
python_version = "3.10"
|
python_version = "3.11"
|
||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unused_configs = true
|
warn_unused_configs = true
|
||||||
disallow_untyped_defs = false
|
disallow_untyped_defs = false
|
||||||
|
|||||||
@ -598,12 +598,8 @@ class YouTubeCLI:
|
|||||||
start, end = map(int, user_input.split("-"))
|
start, end = map(int, user_input.split("-"))
|
||||||
video_indices = list(range(start, end + 1))
|
video_indices = list(range(start, end + 1))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logger.info(
|
logger.info(f"Invalid range format: {user_input}")
|
||||||
f"Invalid range format: {user_input}"
|
logger.info("Please use format like '1-7' or '1,2,3'")
|
||||||
)
|
|
||||||
logger.info(
|
|
||||||
"Please use format like '1-7' or '1,2,3'"
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
# Handle comma-separated numbers
|
# Handle comma-separated numbers
|
||||||
@ -1031,9 +1027,7 @@ class YouTubeCLI:
|
|||||||
|
|
||||||
# Show what format will be used for download (if available)
|
# Show what format will be used for download (if available)
|
||||||
if "format" in ytdlp_args:
|
if "format" in ytdlp_args:
|
||||||
logger.info(
|
logger.info(f"Using custom format: {ytdlp_args['format']}")
|
||||||
f"Using custom format: {ytdlp_args['format']}"
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
logger.info("Using 1080p quality by default")
|
logger.info("Using 1080p quality by default")
|
||||||
|
|
||||||
@ -1061,9 +1055,7 @@ class YouTubeCLI:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
logger.info(
|
logger.info("Playlist download completed successfully!")
|
||||||
"Playlist download completed successfully!"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Copy to network share if specified
|
# Copy to network share if specified
|
||||||
if network_folder:
|
if network_folder:
|
||||||
@ -1095,9 +1087,7 @@ class YouTubeCLI:
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(
|
logger.info(f"Could not track playlist in archive: {e}")
|
||||||
f"Could not track playlist in archive: {e}"
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Playlist download failed with return code {result.returncode}"
|
f"Playlist download failed with return code {result.returncode}"
|
||||||
@ -1107,9 +1097,7 @@ class YouTubeCLI:
|
|||||||
logger.info(result.stdout)
|
logger.info(result.stdout)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(
|
logger.info(f"[red]Error during playlist download: {str(e)}[/red]")
|
||||||
f"[red]Error during playlist download: {str(e)}[/red]"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def signal_handler(sig, frame):
|
def signal_handler(sig, frame):
|
||||||
@ -1170,9 +1158,7 @@ def main():
|
|||||||
if args.download:
|
if args.download:
|
||||||
# Handle download functionality
|
# Handle download functionality
|
||||||
if not args.query:
|
if not args.query:
|
||||||
logger.info(
|
logger.info("Error: You must provide a video URL for downloading")
|
||||||
"Error: You must provide a video URL for downloading"
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
# For direct download, we'll ask for category selection
|
# For direct download, we'll ask for category selection
|
||||||
cli.download_video(args.query, cli.config, category=None)
|
cli.download_video(args.query, cli.config, category=None)
|
||||||
|
|||||||
@ -6,7 +6,6 @@ Enhanced with command palette, help screen, status bar, and theme support
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user