Compare commits

...

2 commits

Author SHA1 Message Date
28e48220c2 Bump version: 0.4.2 → 0.4.3
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-05 21:01:39 +02:00
f50fa96dc4 fix downloading items display 2022-07-05 21:01:18 +02:00
4 changed files with 15 additions and 8 deletions

View file

@ -1,5 +1,5 @@
[bumpversion] [bumpversion]
current_version = 0.4.2 current_version = 0.4.3
commit = True commit = True
tag = True tag = True

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "ucast" name = "ucast"
version = "0.4.2" version = "0.4.3"
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 = [

View file

@ -1,4 +1,4 @@
__version__ = "0.4.2" __version__ = "0.4.3"
def template_context(request): def template_context(request):

View file

@ -2,6 +2,7 @@ import redis
import rq import rq
import rq_scheduler import rq_scheduler
from django.conf import settings from django.conf import settings
from django.db.models import ObjectDoesNotExist
from rq import registry from rq import registry
from ucast.models import Video from ucast.models import Video
@ -94,15 +95,21 @@ def get_failed_job_registry():
def get_downloading_videos(offset=0, limit=-1): def get_downloading_videos(offset=0, limit=-1):
queue = get_queue() queue = get_queue()
videos = {} v_ids = set()
for job in queue.get_jobs(offset, limit): for job in queue.get_jobs(offset, limit):
if ( if (
job.func_name == "ucast.tasks.download.download_video" job.func_name == "ucast.tasks.download.download_video"
and job.args and job.args
and isinstance(job.args[0], Video) and job.args[0] > 0
): ):
video = job.args[0] v_ids.add(job.args[0])
videos[video.id] = video
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