Compare commits

..

No commits in common. "caefa4dd37bef36a5aa0354ba4a7f10992a9250c" and "71725c7a29870e56d0678333c1d9e0ae9670c07c" have entirely different histories.

6 changed files with 6 additions and 19 deletions

View file

@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.1
current_version = 0.1.0
commit = True
tag = True

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "ucast"
version = "0.1.1"
version = "0.1.0"
description = "YouTube to Podcast converter"
authors = ["Theta-Dev <t.testboy@gmail.com>"]
packages = [

View file

@ -1,4 +1,4 @@
__version__ = "0.1.1"
__version__ = "0.1.0"
def template_context(request):

View file

@ -1,5 +1,4 @@
import os
import tempfile
from pathlib import Path
from django.conf import settings
@ -63,13 +62,3 @@ class Storage:
if not cf.does_exist():
cf.create()
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)

View file

@ -2,6 +2,7 @@ import datetime
import logging
import re
import shutil
import tempfile
from dataclasses import dataclass
from operator import itemgetter
from pathlib import Path
@ -11,7 +12,7 @@ import feedparser
import requests
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}""")
@ -141,8 +142,7 @@ def download_audio(
:param sponsorblock: Enable Sponsorblock
:return: VideoDetails
"""
cache = storage.Cache()
tmpdir = cache.create_tmpdir()
tmpdir = tempfile.TemporaryDirectory(prefix="ucast_")
tmp_dld_file = Path(tmpdir.name) / "audio.mp3"
ydl_params = {
@ -151,7 +151,6 @@ def download_audio(
{"key": "FFmpegExtractAudio", "preferredcodec": "mp3"},
],
"outtmpl": str(tmp_dld_file),
"cachedir": str(cache.dir_ytdlp_cache),
}
if sponsorblock:

View file

@ -208,7 +208,6 @@ USE_TZ = True
STATIC_URL = "static/"
STATIC_ROOT = get_env_path("STATIC_ROOT", BASE_DIR / "static")
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")]