From 958e77e6a7c779de11f0f070b70c861c246a959f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 7 Nov 2019 12:17:01 +0100 Subject: Added elCurator import --- .../Resources/translations/messages.da.yml | 3 ++ .../Resources/translations/messages.de.yml | 3 ++ .../Resources/translations/messages.en.yml | 3 ++ .../Resources/translations/messages.es.yml | 3 ++ .../Resources/translations/messages.fa.yml | 3 ++ .../Resources/translations/messages.fr.yml | 3 ++ .../Resources/translations/messages.it.yml | 3 ++ .../Resources/translations/messages.oc.yml | 3 ++ .../Resources/translations/messages.pl.yml | 3 ++ .../Resources/translations/messages.pt.yml | 3 ++ .../Resources/translations/messages.ro.yml | 3 ++ .../Resources/translations/messages.ru.yml | 3 ++ .../Resources/translations/messages.th.yml | 3 ++ .../Resources/translations/messages.tr.yml | 3 ++ .../Controller/ElcuratorController.php | 41 ++++++++++++++++ .../ImportBundle/Import/ElcuratorImport.php | 54 ++++++++++++++++++++++ .../ImportBundle/Resources/config/rabbit.yml | 8 ++++ .../ImportBundle/Resources/config/redis.yml | 21 +++++++++ .../ImportBundle/Resources/config/services.yml | 12 +++++ .../Resources/views/Elcurator/index.html.twig | 3 ++ 20 files changed, 181 insertions(+) create mode 100644 src/Wallabag/ImportBundle/Controller/ElcuratorController.php create mode 100644 src/Wallabag/ImportBundle/Import/ElcuratorImport.php create mode 100644 src/Wallabag/ImportBundle/Resources/views/Elcurator/index.html.twig (limited to 'src/Wallabag') diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 6f381408..8573ba72 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -465,6 +465,9 @@ import: # wallabag_v2: # page_title: 'Import > Wallabag v2' # description: 'This importer will import all your wallabag v2 articles. Go to All articles, then, on the export sidebar, click on "JSON". You will have a "All articles.json" file.' + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' # readability: # page_title: 'Import > Readability' # description: 'This importer will import all your Readability articles. On the tools (https://www.readability.com/tools/) page, click on "Export your data" in the "Data Export" section. You will received an email to download a json (which does not end with .json in fact).' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 7efb18aa..50e67d47 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: 'Aus wallabag v2 importieren' description: 'Dieser Import wird all deine Artikel aus wallabag v2 importieren. Gehe auf "Alle Artikel" und dann, in der Exportieren-Seitenleiste auf "JSON". Dabei erhältst du eine "All articles.json"-Datei.' + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: 'Aus Readability importieren' description: 'Dieser Import wird all deine Artikel aus Readability importieren. Auf der Tools Seite (https://www.readability.com/tools/) klickst du auf "Exportiere deine Daten" in dem Abschnitt "Datenexport". Du wirst eine E-Mail mit einem Downloadlink zu einer json Datei, die aber nicht auf .json endet, erhalten' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index cf98e408..206d3562 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: 'Import > Wallabag v2' description: 'This importer will import all your wallabag v2 articles. Go to All articles, then, on the export sidebar, click on "JSON". You will have a "All articles.json" file.' + elcurator: + page_title: 'Import > elCurator' + description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: 'Import > Readability' description: 'This importer will import all your Readability articles. On the tools (https://www.readability.com/tools/) page, click on "Export your data" in the "Data Export" section. You will received an email to download a json (which does not end with .json in fact).' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index b7cdd261..10f5e79a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: 'Importar > Wallabag v2' description: 'Importa todos tus artículos de wallabag v2. En la sección Todos los artículos, en la barra lateral, haga clic en "JSON". Obtendrás un archivo llamado "All articles.json".' + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: 'Importar > Readability' description: 'Importa todos tus artículos de Readability. En la página de herramientas (https://www.readability.com/tools/), haga clic en "Exportar tus datos" en la sección "Exportar datos". Recibirás un correo electrónico para descargar un JSON (que no tiene extensión .json).' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 66e83e16..730b7e68 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: 'درون‌ریزی > Wallabag v2' description: 'این برنامه همهٔ داده‌های شما را در نسخهٔ ۲ wallabag درون‌ریزی می‌کند. به بخش «همهٔ مقاله‌ها» بروید و در بخش «برون‌ریزی» روی "JSON" کلیک کنید. با این کار شما پرونده‌ای به شکل "All articles.json" دریافت خواهید کرد.' + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: 'درون‌ریزی > Readability' # description: 'This importer will import all your Readability articles. On the tools (https://www.readability.com/tools/) page, click on "Export your data" in the "Data Export" section. You will received an email to download a json (which does not end with .json in fact).' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 6fb856f2..1eecd111 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: "Importer > wallabag v2" description: "Cet outil va importer tous vos articles d’une autre instance de wallabag v2. Allez dans tous vos articles, puis, sur la barre latérale, cliquez sur « JSON ». Vous allez récupérer un fichier « All articles.json »" + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: "Importer > Readability" description: "Cet outil va importer toutes vos données de Readability. Sur la page des outils (https://www.readability.com/tools/), cliquez sur « Export your data » dans la section « Data Export ». Vous allez recevoir un courriel avec un lien pour télécharger le json." diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 3640e0a0..f1a8e3b1 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: 'Importa da > Wallabag v2' description: 'Questo importatore copierà tutti i tuoi dati da un wallabag v2. Vai in "Tutti i contenuti", e, nella barra laterale di esportazione, clicca su "JSON". Otterrai un file "Tutti i contenuti.json' + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: 'Importa da > Readability' description: 'Questo importatore copierà tutti i tuoi articoli da Readability. Nella pagina strumenti (https://www.readability.com/tools/), clicca su "Export your data" nella sezione "Data Export". Riceverai una E-mail per scaricare un file json (che tuttavia non termina con .json).' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index cd60566a..89bf8b16 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: 'Importar > Wallabag v2' description: "Aquesta aisina importarà totas vòstras donadas d'una instància mai de wallabag v2. Anatz dins totes vòstres articles, puèi, sus la barra laterala, clicatz sus \"JSON\". Traparetz un fichièr \"All articles.json\"." + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: 'Importar > Readability' description: "Aquesta aisina importarà totas vòstres articles de Readability. Sus la pagina de l'aisina (https://www.readability.com/tools/), clicatz sus \"Export your data\" dins la seccion \"Data Export\". Recebretz un corrièl per telecargar un json (qu'acaba pas amb un .json de fach)." diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 909f7058..0118ad21 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: 'Import > Wallabag v2' description: 'Ten importer, zaimportuje wszystkie twoje artykułu z wallabag v2. Idź do wszystkich artykułów, a następnie na panelu exportu kliknij na "JSON". Otrzymasz plik "All articles.json".' + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: 'Import > Readability' description: 'Ten importer, zaimportuje wszystkie twoje artykuły z Readability. Na stronie narzędzi (https://www.readability.com/tools/), kliknij na "Export your data" w sekcji "Data Export". Otrzymach email z plikiem JSON (plik nie będzie zawierał rozszerzenia .json).' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index 47e7b4db..d0082cda 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: 'Importar > Wallabag v2' description: 'Com este importador você importa todos os seus artigos do wallabag v2. Vá em Todos os artigos e então, na barra lateral de exportação, clique em "JSON". Você irá criar um arquivo "All articles.json".' + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: 'Importar > Readability' description: 'Este importador pode importar todos os artigos do Readability. Nas página ferramentas (https://www.readability.com/tools/), clique em "Export your data" na seção "Data Export". Você receberá um e-mail para fazer o download de um json (que de fato não termina com .json).' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 380b5233..c8e2dfb4 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -465,6 +465,9 @@ import: # wallabag_v2: # page_title: 'Import > Wallabag v2' # description: 'This importer will import all your wallabag v2 articles. Go to All articles, then, on the export sidebar, click on "JSON". You will have a "All articles.json" file.' + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' # readability: # page_title: 'Import > Readability' # description: 'This importer will import all your Readability articles. On the tools (https://www.readability.com/tools/) page, click on "Export your data" in the "Data Export" section. You will received an email to download a json (which does not end with .json in fact).' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml index a47525c6..41379f90 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: 'Импорт > Wallabag v2' description: 'Функция импорта добавит все ваши записи wallabag v2. Перейдите ко всем статьям, затем на боковой панели экспорта нажмите "JSON". У вас появится файл со всеми записями "All articles.json".' + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: 'Импорт > Readability' description: 'Функция импорта добавит все ваши записи для чтения. На странице инструментов (https://www.readability.com/tools/) нажмите "Экспорт ваших данных" в разделе "Экспорт данных". Вы получите электронное письмо для загрузки json (что не заканчивается только .json файлом).' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml index 5879c48f..b5a3bcb6 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: 'นำเข้าข้อมูล > Wallabag v2' description: 'สำหรับผู้นำเข้าข้อมูลจะ import บทความ wallabag v2 ทั้งหมดของคุณ ไปยังบทความทั้งหมด, ดังนั้น, บน export sidebar, click ที่ "JSON" คุณจะมีไฟล์ "All articles.json"' + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: 'นำเข้าข้อมูล > Readability' description: 'สำหรับผู้นำเข้าข้อมูลจะ import บทความ Readability ทั้งหมดของคุณ ไปที่เครื่องมือ (https://www.readability.com/tools/) ของหน้านั้น, click ที่ "Export your data" ในส่วน "Data Export" คุณจะได้รับ email ไป download json (which does not end with .json in fact).' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index d023e368..4aaef781 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -465,6 +465,9 @@ import: wallabag_v2: page_title: 'İçe Aktar > Wallabag v2' # description: 'This importer will import all your wallabag v2 articles. Go to All articles, then, on the export sidebar, click on "JSON". You will have a "All articles.json" file.' + # elcurator: + # page_title: 'Import > elCurator' + # description: 'This importer will import all your elCurator articles. Go to your preferences in your elCurator account and then, export your content. You will have a JSON file.' readability: page_title: 'İçe Aktar > Readability' # description: 'This importer will import all your Readability articles. On the tools (https://www.readability.com/tools/) page, click on "Export your data" in the "Data Export" section. You will received an email to download a json (which does not end with .json in fact).' diff --git a/src/Wallabag/ImportBundle/Controller/ElcuratorController.php b/src/Wallabag/ImportBundle/Controller/ElcuratorController.php new file mode 100644 index 00000000..174c2c96 --- /dev/null +++ b/src/Wallabag/ImportBundle/Controller/ElcuratorController.php @@ -0,0 +1,41 @@ +get('wallabag_import.elcurator.import'); + + if ($this->get('craue_config')->get('import_with_rabbitmq')) { + $service->setProducer($this->get('old_sound_rabbit_mq.import_elcurator_producer')); + } elseif ($this->get('craue_config')->get('import_with_redis')) { + $service->setProducer($this->get('wallabag_import.producer.redis.elcurator')); + } + + return $service; + } + + /** + * {@inheritdoc} + */ + protected function getImportTemplate() + { + return 'WallabagImportBundle:Elcurator:index.html.twig'; + } +} diff --git a/src/Wallabag/ImportBundle/Import/ElcuratorImport.php b/src/Wallabag/ImportBundle/Import/ElcuratorImport.php new file mode 100644 index 00000000..d1281613 --- /dev/null +++ b/src/Wallabag/ImportBundle/Import/ElcuratorImport.php @@ -0,0 +1,54 @@ + $entry['url'], + 'title' => $entry['title'], + 'created_at' => $entry['created_at'], + 'is_archived' => 0, + 'is_starred' => $entry['is_saved'], + ] + $entry; + } + + /** + * {@inheritdoc} + */ + protected function setEntryAsRead(array $importedEntry) + { + $importedEntry['is_archived'] = 1; + + return $importedEntry; + } +} diff --git a/src/Wallabag/ImportBundle/Resources/config/rabbit.yml b/src/Wallabag/ImportBundle/Resources/config/rabbit.yml index e9ecb846..0bf0e761 100644 --- a/src/Wallabag/ImportBundle/Resources/config/rabbit.yml +++ b/src/Wallabag/ImportBundle/Resources/config/rabbit.yml @@ -48,6 +48,14 @@ services: - "@wallabag_import.wallabag_v2.import" - "@event_dispatcher" - "@logger" + wallabag_import.consumer.amqp.elcurator: + class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer + arguments: + - "@doctrine.orm.entity_manager" + - "@wallabag_user.user_repository" + - "@wallabag_import.elcurator.import" + - "@event_dispatcher" + - "@logger" wallabag_import.consumer.amqp.firefox: class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer arguments: diff --git a/src/Wallabag/ImportBundle/Resources/config/redis.yml b/src/Wallabag/ImportBundle/Resources/config/redis.yml index 091cdba0..40a6e224 100644 --- a/src/Wallabag/ImportBundle/Resources/config/redis.yml +++ b/src/Wallabag/ImportBundle/Resources/config/redis.yml @@ -126,6 +126,27 @@ services: - "@event_dispatcher" - "@logger" + # elcurator + wallabag_import.queue.redis.elcurator: + class: Simpleue\Queue\RedisQueue + arguments: + - "@wallabag_core.redis.client" + - "wallabag.import.elcurator" + + wallabag_import.producer.redis.elcurator: + class: Wallabag\ImportBundle\Redis\Producer + arguments: + - "@wallabag_import.queue.redis.elcurator" + + wallabag_import.consumer.redis.elcurator: + class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer + arguments: + - "@doctrine.orm.entity_manager" + - "@wallabag_user.user_repository" + - "@wallabag_import.elcurator.import" + - "@event_dispatcher" + - "@logger" + # firefox wallabag_import.queue.redis.firefox: class: Simpleue\Queue\RedisQueue diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml index 973c0d03..d824da4a 100644 --- a/src/Wallabag/ImportBundle/Resources/config/services.yml +++ b/src/Wallabag/ImportBundle/Resources/config/services.yml @@ -48,6 +48,18 @@ services: tags: - { name: wallabag_import.import, alias: wallabag_v2 } + wallabag_import.elcurator.import: + class: Wallabag\ImportBundle\Import\ElcuratorImport + arguments: + - "@doctrine.orm.entity_manager" + - "@wallabag_core.content_proxy" + - "@wallabag_core.tags_assigner" + - "@event_dispatcher" + calls: + - [ setLogger, [ "@logger" ]] + tags: + - { name: wallabag_import.import, alias: elcurator } + wallabag_import.readability.import: class: Wallabag\ImportBundle\Import\ReadabilityImport arguments: diff --git a/src/Wallabag/ImportBundle/Resources/views/Elcurator/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Elcurator/index.html.twig new file mode 100644 index 00000000..e3a0d709 --- /dev/null +++ b/src/Wallabag/ImportBundle/Resources/views/Elcurator/index.html.twig @@ -0,0 +1,3 @@ +{% extends "WallabagImportBundle:WallabagV1:index.html.twig" %} + +{% block title %}{{ 'import.elcurator.page_title'|trans }}{% endblock %} -- cgit v1.2.3