diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 1da39e5..d78ccd0 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.1 +current_version = 0.1.0 commit = True tag = True diff --git a/pyproject.toml b/pyproject.toml index de2bdfa..871092f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ucast" -version = "0.1.1" +version = "0.1.0" description = "YouTube to Podcast converter" authors = ["Theta-Dev "] packages = [ diff --git a/ucast/__init__.py b/ucast/__init__.py index 93b1944..52428bd 100644 --- a/ucast/__init__.py +++ b/ucast/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.1.1" +__version__ = "0.1.0" def template_context(request): diff --git a/ucast/service/storage.py b/ucast/service/storage.py index e0a87ba..dc46f36 100644 --- a/ucast/service/storage.py +++ b/ucast/service/storage.py @@ -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) diff --git a/ucast/service/youtube.py b/ucast/service/youtube.py index 1ae4479..5068fae 100644 --- a/ucast/service/youtube.py +++ b/ucast/service/youtube.py @@ -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: diff --git a/ucast_project/settings.py b/ucast_project/settings.py index 3e16b0a..24d64bb 100644 --- a/ucast_project/settings.py +++ b/ucast_project/settings.py @@ -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")]