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 # prepare downloading and extracting processes
downloader = SimpleDownloader() if rimport.downloader == RecurrentImport.DOWNLOADER.SIMPLE else ChromiumHeadlessDownloader() 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: if extractor is None:
logger.error("Unknown extractor") logger.error("Unknown extractor")

View File

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

View File

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