Ajout d'une classe pour supprimer les "Busy" des événements ical

Fix #77
This commit is contained in:
Jean-Marie Favreau 2024-02-16 17:07:52 +01:00
parent 3912da4a7c
commit 6d1c09207c
4 changed files with 97 additions and 77 deletions

View File

@ -94,7 +94,12 @@ def run_recurrent_import(self, pk):
# prepare downloading and extracting processes
downloader = SimpleDownloader() if rimport.downloader == RecurrentImport.DOWNLOADER.SIMPLE else ChromiumHeadlessDownloader()
extractor = ICALExtractor() if rimport.processor == RecurrentImport.PROCESSOR.ICAL else None
if rimport.processor == RecurrentImport.PROCESSOR.ICAL:
extractor = ICALExtractor()
elif rimport.processor == RecurrentImport.PROCESSOR.ICALNOBUSY:
extractor = ICALNoBusyExtractor()
else:
extractor = None
if extractor is None:
logger.error("Unknown extractor")

View File

@ -111,3 +111,10 @@ class ICALExtractor(Extractor):
return self.get_structure()
class ICALNoBusyExtractor(ICALExtractor):
def add_event(self, title, category, start_day, location, description, tags, uuid, recurrences=None, url_human=None, start_time=None, end_day=None, end_time=None, last_modified=None, published=False, image=None, image_alt=None):
if title != 'Busy':
super().add_event(title, category, start_day, location, description, tags, uuid, recurrences, url_human, start_time, end_day, end_time, last_modified, published, image, image_alt)

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: agenda_culturel\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-26 12:27+0000\n"
"POT-Creation-Date: 2024-02-16 16:06+0000\n"
"PO-Revision-Date: 2023-10-29 14:16+0000\n"
"Last-Translator: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n"
"Language-Team: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n"
@ -30,7 +30,7 @@ msgid "JSON in the format expected for the import."
msgstr "JSON dans le format attendu pour l'import"
#: agenda_culturel/models.py:32 agenda_culturel/models.py:61
#: agenda_culturel/models.py:695
#: agenda_culturel/models.py:702
msgid "Name"
msgstr "Nom"
@ -79,7 +79,7 @@ msgid "Color used as background for the category"
msgstr "Couleur utilisée comme fond de la catégorie"
#: agenda_culturel/models.py:101 agenda_culturel/models.py:168
#: agenda_culturel/models.py:733
#: agenda_culturel/models.py:741
msgid "Category"
msgstr "Catégorie"
@ -87,7 +87,7 @@ msgstr "Catégorie"
msgid "Categories"
msgstr "Catégories"
#: agenda_culturel/models.py:153
#: agenda_culturel/models.py:153 agenda_culturel/models.py:739
msgid "Published"
msgstr "Publié"
@ -107,7 +107,7 @@ msgstr "Titre"
msgid "Short title"
msgstr "Titre court"
#: agenda_culturel/models.py:166 agenda_culturel/models.py:756
#: agenda_culturel/models.py:166 agenda_culturel/models.py:764
msgid "Status"
msgstr "Status"
@ -141,7 +141,7 @@ msgstr "Heure de fin"
msgid "Recurrence"
msgstr "Récurrence"
#: agenda_culturel/models.py:178 agenda_culturel/models.py:731
#: agenda_culturel/models.py:178 agenda_culturel/models.py:740
msgid "Location"
msgstr "Localisation"
@ -225,155 +225,163 @@ msgstr "Événement"
msgid "Events"
msgstr "Événements"
#: agenda_culturel/models.py:694
#: agenda_culturel/models.py:701
msgid "Subject"
msgstr "Sujet"
#: agenda_culturel/models.py:694
#: agenda_culturel/models.py:701
msgid "The subject of your message"
msgstr "Sujet de votre message"
#: agenda_culturel/models.py:695
#: agenda_culturel/models.py:702
msgid "Your name"
msgstr "Votre nom"
#: agenda_culturel/models.py:696
#: agenda_culturel/models.py:703
msgid "Email address"
msgstr "Adresse email"
#: agenda_culturel/models.py:696
#: agenda_culturel/models.py:703
msgid "Your email address"
msgstr "Votre adresse email"
#: agenda_culturel/models.py:697
#: agenda_culturel/models.py:704
msgid "Message"
msgstr "Message"
#: agenda_culturel/models.py:697
#: agenda_culturel/models.py:704
msgid "Your message"
msgstr "Votre message"
#: agenda_culturel/models.py:701 agenda_culturel/views.py:366
#: agenda_culturel/models.py:708 agenda_culturel/views.py:376
msgid "Closed"
msgstr "Fermé"
#: agenda_culturel/models.py:701
#: agenda_culturel/models.py:708
msgid "this message has been processed and no longer needs to be handled"
msgstr "Ce message a été traité et ne nécessite plus d'être pris en charge"
#: agenda_culturel/models.py:702
#: agenda_culturel/models.py:709
msgid "Comments"
msgstr "Commentaires"
#: agenda_culturel/models.py:702
#: agenda_culturel/models.py:709
msgid "Comments on the message from the moderation team"
msgstr "Commentaires sur ce message par l'équipe de modération"
#: agenda_culturel/models.py:711
#: agenda_culturel/models.py:718
msgid "ical"
msgstr "ical"
#: agenda_culturel/models.py:714
#: agenda_culturel/models.py:719
msgid "ical no busy"
msgstr "ical sans busy"
#: agenda_culturel/models.py:722
msgid "simple"
msgstr "simple"
#: agenda_culturel/models.py:715
#: agenda_culturel/models.py:723
msgid "Headless Chromium"
msgstr "chromium sans interface"
#: agenda_culturel/models.py:719
#: agenda_culturel/models.py:727
msgid "daily"
msgstr "chaque jour"
#: agenda_culturel/models.py:720
#: agenda_culturel/models.py:728
msgid "weekly"
msgstr "chaque semaine"
#: agenda_culturel/models.py:722
#: agenda_culturel/models.py:730
msgid "Processor"
msgstr "Processeur"
#: agenda_culturel/models.py:723
#: agenda_culturel/models.py:731
msgid "Downloader"
msgstr "Téléchargeur"
#: agenda_culturel/models.py:725
#: agenda_culturel/models.py:733
msgid "Import recurrence"
msgstr "Récurrence d'import"
#: agenda_culturel/models.py:728
#: agenda_culturel/models.py:736
msgid "Source"
msgstr "Source"
#: agenda_culturel/models.py:728
#: agenda_culturel/models.py:736
msgid "URL of the source document"
msgstr "URL du document source"
#: agenda_culturel/models.py:729
#: agenda_culturel/models.py:737
msgid "Browsable url"
msgstr "URL navigable"
#: agenda_culturel/models.py:729
#: agenda_culturel/models.py:737
msgid "URL of the corresponding document that will be shown to visitors."
msgstr "URL correspondant au document et qui sera montrée aux visiteurs"
#: agenda_culturel/models.py:731
#: agenda_culturel/models.py:739
msgid "Status of each imported event (published or draft)"
msgstr "Status de chaque événement importé (publié ou brouillon)"
#: agenda_culturel/models.py:740
msgid "Address for each imported event"
msgstr "Adresse de chaque événement importé"
#: agenda_culturel/models.py:733
#: agenda_culturel/models.py:741
msgid "Category of each imported event"
msgstr "Catégorie de chaque événement importé"
#: agenda_culturel/models.py:734
#: agenda_culturel/models.py:742
msgid "Tags for each imported event"
msgstr "Étiquettes de chaque événement importé"
#: agenda_culturel/models.py:734
#: agenda_culturel/models.py:742
msgid "A list of tags that describe each imported event."
msgstr "Une liste d'étiquettes décrivant chaque événement importé"
#: agenda_culturel/models.py:746
#: agenda_culturel/models.py:754
msgid "Running"
msgstr "En cours"
#: agenda_culturel/models.py:747
#: agenda_culturel/models.py:755
msgid "Canceled"
msgstr "Annulé"
#: agenda_culturel/models.py:748
#: agenda_culturel/models.py:756
msgid "Success"
msgstr "Succès"
#: agenda_culturel/models.py:749
#: agenda_culturel/models.py:757
msgid "Failed"
msgstr "Erreur"
#: agenda_culturel/models.py:754
#: agenda_culturel/models.py:762
msgid "Recurrent import"
msgstr "Import récurrent"
#: agenda_culturel/models.py:754
#: agenda_culturel/models.py:762
msgid "Reference to the recurrent import processing"
msgstr "Référence du processus d'import récurrent"
#: agenda_culturel/models.py:758
#: agenda_culturel/models.py:766
msgid "Error message"
msgstr "Votre message"
#: agenda_culturel/models.py:760
#: agenda_culturel/models.py:768
msgid "Number of collected events"
msgstr "Nombre d'événements collectés"
#: agenda_culturel/models.py:761
#: agenda_culturel/models.py:769
msgid "Number of imported events"
msgstr "Nombre d'événements importés"
#: agenda_culturel/models.py:762
#: agenda_culturel/models.py:770
msgid "Number of updated events"
msgstr "Nombre d'événements mis à jour"
#: agenda_culturel/models.py:763
#: agenda_culturel/models.py:771
msgid "Number of removed events"
msgstr "Nombre d'événements supprimés"
@ -385,27 +393,27 @@ msgstr "anglais"
msgid "French"
msgstr "français"
#: agenda_culturel/views.py:203
#: agenda_culturel/views.py:206
msgid "The static content has been successfully updated."
msgstr "Le contenu statique a été modifié avec succès."
#: agenda_culturel/views.py:209
#: agenda_culturel/views.py:212
msgid "The event has been successfully modified."
msgstr "L'événement a été modifié avec succès."
#: agenda_culturel/views.py:220
#: agenda_culturel/views.py:223
msgid "The event has been successfully deleted."
msgstr "L'événement a été supprimé avec succès"
#: agenda_culturel/views.py:247
#: agenda_culturel/views.py:250
msgid "The status has been successfully modified."
msgstr "Le status a été modifié avec succès."
#: agenda_culturel/views.py:269
#: agenda_culturel/views.py:272
msgid "The event is saved."
msgstr "L'événement est enregistré."
#: agenda_culturel/views.py:272
#: agenda_culturel/views.py:275
msgid ""
"The event has been submitted and will be published as soon as it has been "
"validated by the moderation team."
@ -413,7 +421,7 @@ msgstr ""
"L'événement a été soumis et sera publié dès qu'il aura été validé par "
"l'équipe de modération."
#: agenda_culturel/views.py:302
#: agenda_culturel/views.py:312
msgid ""
"The event has been successfully extracted, and you can now submit it after "
"modifying it if necessary."
@ -421,7 +429,7 @@ msgstr ""
"L'événement a été extrait avec succès, vous pouvez maintenant le soumettre "
"après l'avoir modifié au besoin."
#: agenda_culturel/views.py:306
#: agenda_culturel/views.py:316
msgid ""
"Unable to extract an event from the proposed URL. Please use the form below "
"to submit the event."
@ -429,16 +437,16 @@ msgstr ""
"Impossible d'extraire un événement depuis l'URL proposée. Veuillez utiliser "
"le formulaire ci-dessous pour soumettre l'événement."
#: agenda_culturel/views.py:315
#: agenda_culturel/views.py:325
msgid "This URL has already been submitted, and you can find the event below."
msgstr ""
"Cette URL a déjà été soumise, et vous trouverez l'événement ci-dessous."
#: agenda_culturel/views.py:319
#: agenda_culturel/views.py:329
msgid "This URL has already been submitted and is awaiting moderation."
msgstr "Cette URL a déjà été soumise, et est en attente de modération"
#: agenda_culturel/views.py:321
#: agenda_culturel/views.py:331
msgid ""
"This URL has already been submitted, but has not been selected for "
"publication by the moderation team."
@ -446,75 +454,75 @@ msgstr ""
"Cette URL a déjà été soumise, mais n'a pas été retenue par l'équipe de "
"modération pour la publication."
#: agenda_culturel/views.py:343
#: agenda_culturel/views.py:353
msgid "Your message has been sent successfully."
msgstr "L'événement a été supprimé avec succès"
#: agenda_culturel/views.py:351
#: agenda_culturel/views.py:361
msgid "The contact message properties has been successfully modified."
msgstr "Les propriétés du message de contact ont été modifié avec succès."
#: agenda_culturel/views.py:366
#: agenda_culturel/views.py:376
msgid "Open"
msgstr "Ouvert"
#: agenda_culturel/views.py:406
#: agenda_culturel/views.py:416
msgid "Search"
msgstr "Rechercher"
#: agenda_culturel/views.py:521
#: agenda_culturel/views.py:531
msgid "The import has been run successfully."
msgstr "L'import a été lancé avec succès"
#: agenda_culturel/views.py:537
#: agenda_culturel/views.py:547
msgid "The import has been canceled."
msgstr "L'import a été annulé"
#: agenda_culturel/views.py:571
#: agenda_culturel/views.py:581
msgid "The recurrent import has been successfully modified."
msgstr "L'import récurrent a été modifié avec succès."
#: agenda_culturel/views.py:577
#: agenda_culturel/views.py:587
msgid "The recurrent import has been successfully deleted."
msgstr "L'import récurrent a été supprimé avec succès"
#: agenda_culturel/views.py:606
#: agenda_culturel/views.py:616
msgid "The import has been launched."
msgstr "L'import a été lancé"
#: agenda_culturel/views.py:665
#: agenda_culturel/views.py:675
msgid "The merge has been successfully completed."
msgstr "La fusion a été réalisée avec succès."
#: agenda_culturel/views.py:694
#: agenda_culturel/views.py:704
msgid "Events have been marked as unduplicated."
msgstr "Les événements ont été marqués comme non dupliqués."
#: agenda_culturel/views.py:711
#: agenda_culturel/views.py:721
msgid ""
"The selected event has been retained, while the other has been moved "
"to the recycle bin."
"The selected event has been retained, while the other has been moved to the "
"recycle bin."
msgstr ""
"L'événement sélectionné a été conservé, l'autre a été déplacé dans la "
"corbeille."
#: agenda_culturel/views.py:713
#: agenda_culturel/views.py:723
msgid ""
"The selected event has been retained, while the others have been moved "
"to the recycle bin."
"The selected event has been retained, while the others have been moved to "
"the recycle bin."
msgstr ""
"L'événement sélectionné a été conservé, les autres ont été déplacés dans la "
"corbeille."
#: agenda_culturel/views.py:719
#: agenda_culturel/views.py:729
msgid "The event has been withdrawn from the group and made independent."
msgstr "L'événement a été retiré du groupe et rendu indépendant."
#: agenda_culturel/views.py:765
#: agenda_culturel/views.py:775
msgid "The event was successfully duplicated."
msgstr "L'événement a été marqué dupliqué avec succès."
#: agenda_culturel/views.py:768
#: agenda_culturel/views.py:778
msgid ""
"The event has been successfully flagged as a duplicate. The moderation team "
"will deal with your suggestion shortly."
@ -522,7 +530,6 @@ msgstr ""
"L'événement a été signalé comme dupliqué avec succès. Votre suggestion sera "
"prochainement prise en charge par l'équipe de modération."
msgid "Add another"
msgstr "Ajouter un autre"

View File

@ -716,6 +716,7 @@ class RecurrentImport(models.Model):
class PROCESSOR(models.TextChoices):
ICAL = "ical", _("ical")
ICALNOBUSY = "icalnobusy", _("ical no busy")
class DOWNLOADER(models.TextChoices):
SIMPLE = "simple", _("simple")