[Migration] remove unused methods for unifying slugs
[mygpo.git] / mygpo / administration / tasks.py
blob708ba67bc54a08f4dc90217ae8f1e6bd9959556f
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__)
11 @celery.task
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)
21 actions = Counter()
23 pm = PodcastMerger(podcasts, actions, num_groups)
24 podcast = pm.merge()
26 logger.info('merging result: %s', actions)
28 return actions, podcast