add some options for podcast aggregator , multiple urls
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
from django.contrib import admin
|
||||
from import_export.admin import ImportExportModelAdmin
|
||||
from import_export import resources
|
||||
from .models import podcastData
|
||||
|
||||
# Register your models here.
|
||||
@admin.register(podcastData)
|
||||
class JobAdmin(ImportExportModelAdmin):
|
||||
list_display = ('podcast_name','podcast_url','enabled')
|
||||
|
||||
@@ -3,4 +3,5 @@ from django.apps import AppConfig
|
||||
|
||||
class PodcastAggregatorConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'podcast_aggregator'
|
||||
name = 'apps.podcast_aggregator'
|
||||
label = 'podcast'
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 4.2.29 on 2026-06-30 22:05
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='podcastData',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('podcast_name', models.CharField(max_length=100, null=True)),
|
||||
('podcast_url', models.CharField(max_length=100, null=True)),
|
||||
],
|
||||
options={
|
||||
'db_table': 'podcasts',
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.29 on 2026-06-30 22:08
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('podcast', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='podcastdata',
|
||||
name='enabled',
|
||||
field=models.BooleanField(default=True),
|
||||
),
|
||||
]
|
||||
@@ -3,5 +3,6 @@ from django.db import models
|
||||
class podcastData(models.Model):
|
||||
podcast_name = models.CharField(max_length=100, null=True)
|
||||
podcast_url = models.CharField(max_length=100, null=True)
|
||||
enabled = models.BooleanField(default=True)
|
||||
class Meta:
|
||||
db_table = 'podcasts'
|
||||
@@ -8,7 +8,7 @@ def rss_to_dict(url):
|
||||
response = requests.get(url)
|
||||
data = xmltodict.parse(response.content)
|
||||
|
||||
#print(data['rss'])
|
||||
print(data['rss'])
|
||||
|
||||
title = data['rss']['channel']['title']
|
||||
|
||||
@@ -16,7 +16,12 @@ def rss_to_dict(url):
|
||||
#print(data['rss'].keys())
|
||||
|
||||
#use first object as it's ordered in a chronological order
|
||||
|
||||
|
||||
today_object = data['rss']['channel']['item']
|
||||
if isinstance(today_object, list):
|
||||
today_object = data['rss']['channel']['item'][0]
|
||||
|
||||
today_title = today_object['title']
|
||||
today_podcast_url = data['rss']['channel']['item'][0]['enclosure']['@url']
|
||||
|
||||
@@ -44,6 +49,7 @@ def podcasts():
|
||||
telegram.clear_expired_messages()
|
||||
|
||||
url = "https://feeds.audiomeans.fr/feed/44f6a116-20a6-44c4-98c4-b3e1bdd46dce.xml"
|
||||
url_bbc = "https://podcast.voice.api.bbci.co.uk/rss/audio/p002vsmz?api_key=Wbek5zSqxz0Hk1blo5IBqbd9SCWIfNbT"
|
||||
today_podcast = rss_to_dict(url)
|
||||
print(today_podcast)
|
||||
file= pretty_filename(today_podcast[1],'mp3')
|
||||
|
||||
Reference in New Issue
Block a user