diff --git a/django_code/apps/podcast_aggregator/utils.py b/django_code/apps/podcast_aggregator/utils.py index 585f90f..b0e3990 100644 --- a/django_code/apps/podcast_aggregator/utils.py +++ b/django_code/apps/podcast_aggregator/utils.py @@ -37,8 +37,12 @@ def pretty_filename(filename,extension=''): extension = str('.'+extension) return pretty_filename+extension -def main(): +def podcasts(): telegram = telegramUtils() + + #clear all expired messages before + telegram.clear_expired_messages() + url = "https://feeds.audiomeans.fr/feed/44f6a116-20a6-44c4-98c4-b3e1bdd46dce.xml" today_podcast = rss_to_dict(url) print(today_podcast) @@ -46,4 +50,4 @@ def main(): download_news_mp3(today_podcast[2],file) telegram.send_document(file,str(today_podcast[0])+" "+str(today_podcast[1])) -main() \ No newline at end of file +#main() \ No newline at end of file diff --git a/django_code/apps/podcast_aggregator/views.py b/django_code/apps/podcast_aggregator/views.py index 91ea44a..a1e59bb 100644 --- a/django_code/apps/podcast_aggregator/views.py +++ b/django_code/apps/podcast_aggregator/views.py @@ -1,3 +1,7 @@ -from django.shortcuts import render +from django.http import HttpResponse +from .utils import podcasts # Create your views here. +def execute_podcast(request): + podcasts() + return HttpResponse('