1 from collections
import Counter
3 from mygpo
.podcasts
.models
import Podcast
4 from mygpo
.cel
import celery
5 from mygpo
.maintenance
.merge
import PodcastMerger
7 from celery
.utils
.log
import get_task_logger
8 logger
= get_task_logger(__name__
)
12 def merge_podcasts(podcast_ids
, num_groups
):
13 """ Task to merge some podcasts"""
15 logger
.info('merging podcast ids %s', podcast_ids
)
17 podcasts
= Podcast
.objects
.filter(id__in
=podcast_ids
)
19 logger
.info('merging podcasts %s', podcasts
)
23 pm
= PodcastMerger(podcasts
, actions
, num_groups
)
26 logger
.info('merging result: %s', actions
)
28 return actions
, podcast