🎉 init
This commit is contained in:
@@ -0,0 +1,72 @@
|
|||||||
|
import yt_dlp
|
||||||
|
import logging
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="A video-to-sheet music converter that uses opencv-python to extract significant frame changes.",
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument("source", type=str, help="source of the file or a youtube link")
|
||||||
|
parser.add_argument(
|
||||||
|
"destination", type=str, help="destination of the output in pdf form"
|
||||||
|
)
|
||||||
|
parser.add_argument("-v", "--verbose", action="store_true", help="debug mode")
|
||||||
|
parser.add_argument(
|
||||||
|
"-a", "--alt-temp", action="store_false", help="use var dest to store temporary files"
|
||||||
|
)
|
||||||
|
parser.add_argument("-i","--ignore-temp", action="store_true", help="[requires -a] do not delete alt tmp")
|
||||||
|
parser.add_argument(
|
||||||
|
"-f", "--format", type=str, default="png", help="use output custom img format"
|
||||||
|
)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
src = args.source
|
||||||
|
dest = args.destination
|
||||||
|
verbose = args.verbose
|
||||||
|
alt_temp = args.alt_temp
|
||||||
|
ignore_temp = args.ignore_temp
|
||||||
|
format = args.format
|
||||||
|
|
||||||
|
if verbose:
|
||||||
|
logging.basicConfig(level=logging.DEBUG, format="[%(levelname)s] - %(message)s")
|
||||||
|
else:
|
||||||
|
logging.basicConfig(level=logging.INFO, format="[%(levelname)s] - %(message)s")
|
||||||
|
log = logging.getLogger()
|
||||||
|
|
||||||
|
class Download:
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def video(self, src, dest):
|
||||||
|
ydl_opts = {
|
||||||
|
"outtmpl": f"{dest}/%(title)s.%(ext)s",
|
||||||
|
"quiet": True,
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
||||||
|
info_dict = ydl.extract_info(src, download=False)
|
||||||
|
video_title = info_dict.get('title', 'Unknown Title')
|
||||||
|
log.info(f"Downloading: {video_title}")
|
||||||
|
ydl.download([src])
|
||||||
|
log.info("Download Successful")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
log.error(f"An error occurred: {e}")
|
||||||
|
exit()
|
||||||
|
|
||||||
|
def playlist(self, src, dest):
|
||||||
|
ydl_opts = {
|
||||||
|
"outtmpl": f"{dest}/%(title)s.%(ext)s",
|
||||||
|
"quiet": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Misc:
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def create_blank_image(self):
|
||||||
|
pass
|
||||||
Reference in New Issue
Block a user