Compare commits
No commits in common. "caefa4dd37bef36a5aa0354ba4a7f10992a9250c" and "71725c7a29870e56d0678333c1d9e0ae9670c07c" have entirely different histories.
caefa4dd37
...
71725c7a29
6 changed files with 6 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.1.1
|
current_version = 0.1.0
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "ucast"
|
name = "ucast"
|
||||||
version = "0.1.1"
|
version = "0.1.0"
|
||||||
description = "YouTube to Podcast converter"
|
description = "YouTube to Podcast converter"
|
||||||
authors = ["Theta-Dev <t.testboy@gmail.com>"]
|
authors = ["Theta-Dev <t.testboy@gmail.com>"]
|
||||||
packages = [
|
packages = [
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
__version__ = "0.1.1"
|
__version__ = "0.1.0"
|
||||||
|
|
||||||
|
|
||||||
def template_context(request):
|
def template_context(request):
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import os
|
import os
|
||||||
import tempfile
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -63,13 +62,3 @@ class Storage:
|
||||||
if not cf.does_exist():
|
if not cf.does_exist():
|
||||||
cf.create()
|
cf.create()
|
||||||
return cf
|
return cf
|
||||||
|
|
||||||
|
|
||||||
class Cache:
|
|
||||||
def __init__(self):
|
|
||||||
self.dir_cache = settings.CACHE_ROOT
|
|
||||||
self.dir_ytdlp_cache = self.dir_cache / "yt_dlp"
|
|
||||||
os.makedirs(self.dir_ytdlp_cache, exist_ok=True)
|
|
||||||
|
|
||||||
def create_tmpdir(self, prefix="dld") -> tempfile.TemporaryDirectory:
|
|
||||||
return tempfile.TemporaryDirectory(prefix=prefix + "_", dir=self.dir_cache)
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import datetime
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
import tempfile
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -11,7 +12,7 @@ import feedparser
|
||||||
import requests
|
import requests
|
||||||
from yt_dlp import YoutubeDL
|
from yt_dlp import YoutubeDL
|
||||||
|
|
||||||
from ucast.service import scrapetube, storage, util
|
from ucast.service import scrapetube, util
|
||||||
|
|
||||||
CHANID_REGEX = re.compile(r"""[-_a-zA-Z\d]{24}""")
|
CHANID_REGEX = re.compile(r"""[-_a-zA-Z\d]{24}""")
|
||||||
|
|
||||||
|
@ -141,8 +142,7 @@ def download_audio(
|
||||||
:param sponsorblock: Enable Sponsorblock
|
:param sponsorblock: Enable Sponsorblock
|
||||||
:return: VideoDetails
|
:return: VideoDetails
|
||||||
"""
|
"""
|
||||||
cache = storage.Cache()
|
tmpdir = tempfile.TemporaryDirectory(prefix="ucast_")
|
||||||
tmpdir = cache.create_tmpdir()
|
|
||||||
tmp_dld_file = Path(tmpdir.name) / "audio.mp3"
|
tmp_dld_file = Path(tmpdir.name) / "audio.mp3"
|
||||||
|
|
||||||
ydl_params = {
|
ydl_params = {
|
||||||
|
@ -151,7 +151,6 @@ def download_audio(
|
||||||
{"key": "FFmpegExtractAudio", "preferredcodec": "mp3"},
|
{"key": "FFmpegExtractAudio", "preferredcodec": "mp3"},
|
||||||
],
|
],
|
||||||
"outtmpl": str(tmp_dld_file),
|
"outtmpl": str(tmp_dld_file),
|
||||||
"cachedir": str(cache.dir_ytdlp_cache),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if sponsorblock:
|
if sponsorblock:
|
||||||
|
|
|
@ -208,7 +208,6 @@ USE_TZ = True
|
||||||
STATIC_URL = "static/"
|
STATIC_URL = "static/"
|
||||||
STATIC_ROOT = get_env_path("STATIC_ROOT", BASE_DIR / "static")
|
STATIC_ROOT = get_env_path("STATIC_ROOT", BASE_DIR / "static")
|
||||||
DOWNLOAD_ROOT = get_env_path("DOWNLOAD_ROOT", BASE_DIR / "data")
|
DOWNLOAD_ROOT = get_env_path("DOWNLOAD_ROOT", BASE_DIR / "data")
|
||||||
CACHE_ROOT = get_env_path("CACHE_ROOT", BASE_DIR / "cache")
|
|
||||||
|
|
||||||
STATICFILES_DIRS = [resources.path("ucast", "static")]
|
STATICFILES_DIRS = [resources.path("ucast", "static")]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue