diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 837fb4f..6bfdcb8 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.4.2 +current_version = 0.4.3 commit = True tag = True diff --git a/pyproject.toml b/pyproject.toml index 106007c..aaf8d74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ucast" -version = "0.4.2" +version = "0.4.3" description = "YouTube to Podcast converter" authors = ["Theta-Dev "] packages = [ diff --git a/ucast/__init__.py b/ucast/__init__.py index 8ade61d..e07686c 100644 --- a/ucast/__init__.py +++ b/ucast/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.4.2" +__version__ = "0.4.3" def template_context(request): diff --git a/ucast/queue.py b/ucast/queue.py index 08c90fc..2248ab1 100644 --- a/ucast/queue.py +++ b/ucast/queue.py @@ -2,6 +2,7 @@ import redis import rq import rq_scheduler from django.conf import settings +from django.db.models import ObjectDoesNotExist from rq import registry from ucast.models import Video @@ -94,15 +95,21 @@ def get_failed_job_registry(): def get_downloading_videos(offset=0, limit=-1): queue = get_queue() - videos = {} + v_ids = set() for job in queue.get_jobs(offset, limit): if ( job.func_name == "ucast.tasks.download.download_video" and job.args - and isinstance(job.args[0], Video) + and job.args[0] > 0 ): - video = job.args[0] - videos[video.id] = video + v_ids.add(job.args[0]) - return list(videos.values()) + videos = [] + for v_id in v_ids: + try: + videos.append(Video.objects.get(id=v_id)) + except ObjectDoesNotExist: + pass + + return videos