Photomat -> Fotomat
This commit is contained in:
parent
aa878b8fb3
commit
44b6458d73
1
experimentations/.gitignore
vendored
1
experimentations/.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
*.json
|
*.json
|
||||||
*.html
|
*.html
|
||||||
*.ical
|
*.ical
|
||||||
|
*.xml
|
||||||
|
@ -28,14 +28,14 @@ from src.agenda_culturel.import_tasks.custom_extractors import *
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
u2e = URL2Events(SimpleDownloader(), LePhotomatExtractor())
|
u2e = URL2Events(SimpleDownloader(), LeFotomatExtractor())
|
||||||
url = "https://www.lefotomat.com/feed"
|
url = "https://www.lefotomat.com/feed"
|
||||||
url_human = "https://www.lefotomat.com/"
|
url_human = "https://www.lefotomat.com/"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
events = u2e.process(url, url_human, cache = "cache-lephotomat.xml", default_values = {"location": "Le Photomat'"}, published = True)
|
events = u2e.process(url, url_human, cache = "cache-lefotomat.xml", default_values = {"location": "Le Fotomat'"}, published = True)
|
||||||
|
|
||||||
exportfile = "events-lephotomat.json"
|
exportfile = "events-lefotomat.json"
|
||||||
print("Saving events to file {}".format(exportfile))
|
print("Saving events to file {}".format(exportfile))
|
||||||
with open(exportfile, "w") as f:
|
with open(exportfile, "w") as f:
|
||||||
json.dump(events, f, indent=4, default=str)
|
json.dump(events, f, indent=4, default=str)
|
@ -105,8 +105,8 @@ def run_recurrent_import(self, pk):
|
|||||||
extractor = LaCoopeExtractor()
|
extractor = LaCoopeExtractor()
|
||||||
elif rimport.processor == RecurrentImport.PROCESSOR.LACOMEDIE:
|
elif rimport.processor == RecurrentImport.PROCESSOR.LACOMEDIE:
|
||||||
extractor = LaComedieExtractor()
|
extractor = LaComedieExtractor()
|
||||||
elif rimport.processor == RecurrentImport.PROCESSOR.LEPHOTOMAT:
|
elif rimport.processor == RecurrentImport.PROCESSOR.LEFOTOMAT:
|
||||||
extractor = LePhotomatExtractor()
|
extractor = LeFotomatExtractor()
|
||||||
else:
|
else:
|
||||||
extractor = None
|
extractor = None
|
||||||
|
|
||||||
|
@ -130,13 +130,13 @@ class LaComedieExtractor(TwoStepsExtractor):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# A class dedicated to get events from Le Photomat'
|
# A class dedicated to get events from Le Fotomat'
|
||||||
# URL: https://www.lefotomat.com/
|
# URL: https://www.lefotomat.com/
|
||||||
class LePhotomatExtractor(TwoStepsExtractor):
|
class LeFotomatExtractor(TwoStepsExtractor):
|
||||||
|
|
||||||
nom_lieu = "Le Photomat'"
|
nom_lieu = "Le Fotomat'"
|
||||||
|
|
||||||
def category_photomat2agenda(self, category):
|
def category_fotomat2agenda(self, category):
|
||||||
if not category:
|
if not category:
|
||||||
return None
|
return None
|
||||||
mapping = { "Concerts": "Concert"}
|
mapping = { "Concerts": "Concert"}
|
||||||
@ -157,7 +157,7 @@ class LePhotomatExtractor(TwoStepsExtractor):
|
|||||||
title = e.find("title").contents[0]
|
title = e.find("title").contents[0]
|
||||||
self.add_event_title(e_url, title)
|
self.add_event_title(e_url, title)
|
||||||
|
|
||||||
category = self.category_photomat2agenda(e.find("category").contents[0])
|
category = self.category_fotomat2agenda(e.find("category").contents[0])
|
||||||
if category:
|
if category:
|
||||||
self.add_event_category(e_url, category)
|
self.add_event_category(e_url, category)
|
||||||
|
|
||||||
|
13
src/agenda_culturel/migrations/0052_auto_20240420_1353.py
Normal file
13
src/agenda_culturel/migrations/0052_auto_20240420_1353.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2024-04-20 11:53
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('agenda_culturel', '0051_alter_recurrentimport_processor'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
]
|
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.2.7 on 2024-04-20 11:53
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('agenda_culturel', '0052_auto_20240420_1353'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='recurrentimport',
|
||||||
|
name='processor',
|
||||||
|
field=models.CharField(choices=[('ical', 'ical'), ('icalnobusy', 'ical no busy'), ('icalnovc', 'ical no VC'), ('lacoope', 'lacoope.org'), ('lacomedie', 'la comédie'), ('lefotomat', 'le fotomat')], default='ical', max_length=20, verbose_name='Processor'),
|
||||||
|
),
|
||||||
|
]
|
@ -759,7 +759,7 @@ class RecurrentImport(models.Model):
|
|||||||
ICALNOVC = "icalnovc", _("ical no VC")
|
ICALNOVC = "icalnovc", _("ical no VC")
|
||||||
LACOOPE = "lacoope", _('lacoope.org')
|
LACOOPE = "lacoope", _('lacoope.org')
|
||||||
LACOMEDIE = "lacomedie", _('la comédie')
|
LACOMEDIE = "lacomedie", _('la comédie')
|
||||||
LEPHOTOMAT = "lephotomat", _('le photomat')
|
LEFOTOMAT = "lefotomat", _('le fotomat')
|
||||||
|
|
||||||
class DOWNLOADER(models.TextChoices):
|
class DOWNLOADER(models.TextChoices):
|
||||||
SIMPLE = "simple", _("simple")
|
SIMPLE = "simple", _("simple")
|
||||||
|
Loading…
Reference in New Issue
Block a user