From 03e3753f6bd36f12c0757c76b49b683c49de48ae Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 1 Sep 2016 08:00:30 +0200 Subject: [PATCH 1/6] Add Readability import Based on the JSON export instead of the API (which will be shutting down by the September 30, 2016) --- .../Resources/translations/messages.en.yml | 4 + .../Controller/ReadabilityController.php | 65 +++++++ .../ImportBundle/Import/ReadabilityImport.php | 181 ++++++++++++++++++ .../Resources/config/services.yml | 10 + .../views/Readability/index.html.twig | 43 +++++ .../ImportBundle/fixtures/readability.json | 25 +++ 6 files changed, 328 insertions(+) create mode 100644 src/Wallabag/ImportBundle/Controller/ReadabilityController.php create mode 100644 src/Wallabag/ImportBundle/Import/ReadabilityImport.php create mode 100644 src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig create mode 100644 tests/Wallabag/ImportBundle/fixtures/readability.json diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 220c4d9c3..f2bf9aedb 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -341,6 +341,10 @@ 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.' + 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)' + how_to: 'Please select your Readability export and click on the below button to upload and import it.' developer: page_title: 'Developer' diff --git a/src/Wallabag/ImportBundle/Controller/ReadabilityController.php b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php new file mode 100644 index 000000000..b61aa99cf --- /dev/null +++ b/src/Wallabag/ImportBundle/Controller/ReadabilityController.php @@ -0,0 +1,65 @@ +createForm(UploadImportType::class); + $form->handleRequest($request); + + $readability = $this->get('wallabag_import.readability.import'); + + if ($form->isValid()) { + $file = $form->get('file')->getData(); + $markAsRead = $form->get('mark_as_read')->getData(); + $name = 'readability_'.$this->getUser()->getId().'.json'; + + if (in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { + $res = $readability + ->setUser($this->getUser()) + ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name) + ->setMarkAsRead($markAsRead) + ->import(); + + $message = 'flashes.import.notice.failed'; + + if (true === $res) { + $summary = $readability->getSummary(); + $message = $this->get('translator')->trans('flashes.import.notice.summary', [ + '%imported%' => $summary['imported'], + '%skipped%' => $summary['skipped'], + ]); + + unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); + } + + $this->get('session')->getFlashBag()->add( + 'notice', + $message + ); + + return $this->redirect($this->generateUrl('homepage')); + } else { + $this->get('session')->getFlashBag()->add( + 'notice', + 'flashes.import.notice.failed_on_file' + ); + } + } + + return $this->render('WallabagImportBundle:Readability:index.html.twig', [ + 'form' => $form->createView(), + 'import' => $readability, + ]); + } +} diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php new file mode 100644 index 000000000..abea81a71 --- /dev/null +++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php @@ -0,0 +1,181 @@ +user = $user; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'Readability'; + } + + /** + * {@inheritdoc} + */ + public function getUrl() + { + return 'import_readability'; + } + + /** + * {@inheritdoc} + */ + public function getDescription() + { + return 'import.readability.description'; + } + + /** + * Set file path to the json file. + * + * @param string $filepath + */ + public function setFilepath($filepath) + { + $this->filepath = $filepath; + + return $this; + } + + /** + * Set whether articles must be all marked as read. + * + * @param bool $markAsRead + */ + public function setMarkAsRead($markAsRead) + { + $this->markAsRead = $markAsRead; + + return $this; + } + + /** + * Get whether articles must be all marked as read. + */ + public function getMarkAsRead() + { + return $this->markAsRead; + } + + /** + * {@inheritdoc} + */ + public function getSummary() + { + return [ + 'skipped' => $this->skippedEntries, + 'imported' => $this->importedEntries, + ]; + } + + /** + * {@inheritdoc} + */ + public function import() + { + if (!$this->user) { + $this->logger->error('ReadabilityImport: user is not defined'); + + return false; + } + + if (!file_exists($this->filepath) || !is_readable($this->filepath)) { + $this->logger->error('ReadabilityImport: unable to read file', ['filepath' => $this->filepath]); + + return false; + } + + $data = json_decode(file_get_contents($this->filepath), true); + + if (empty($data) || empty($data['bookmarks'])) { + return false; + } + + $this->parseEntries($data['bookmarks']); + + return true; + } + + /** + * Parse and insert all given entries. + * + * @param $entries + */ + protected function parseEntries($entries) + { + $i = 1; + + foreach ($entries as $importedEntry) { + $existingEntry = $this->em + ->getRepository('WallabagCoreBundle:Entry') + ->findByUrlAndUserId($importedEntry['article__url'], $this->user->getId()); + + if (false !== $existingEntry) { + ++$this->skippedEntries; + continue; + } + + $data = [ + 'title' => $importedEntry['article__title'], + // 'html' => $importedEntry['article__excerpt'], + 'url' => $importedEntry['article__url'], + 'content_type' => '', + 'language' => '', + 'is_archived' => $importedEntry['archive'] || $this->markAsRead, + 'is_starred' => $importedEntry['favorite'], + ]; + + $entry = $this->fetchContent( + new Entry($this->user), + $data['url'], + $data + ); + + // jump to next entry in case of problem while getting content + if (false === $entry) { + ++$this->skippedEntries; + continue; + } + $entry->setArchived($data['is_archived']); + $entry->setStarred($data['is_starred']); + + $this->em->persist($entry); + ++$this->importedEntries; + + // flush every 20 entries + if (($i % 20) === 0) { + $this->em->flush(); + $this->em->clear($entry); + } + ++$i; + } + + $this->em->flush(); + } +} diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml index 86b44cb3e..520d43aff 100644 --- a/src/Wallabag/ImportBundle/Resources/config/services.yml +++ b/src/Wallabag/ImportBundle/Resources/config/services.yml @@ -43,3 +43,13 @@ services: - [ setLogger, [ "@logger" ]] tags: - { name: wallabag_import.import, alias: wallabag_v2 } + + wallabag_import.readability.import: + class: Wallabag\ImportBundle\Import\ReadabilityImport + arguments: + - "@doctrine.orm.entity_manager" + - "@wallabag_core.content_proxy" + calls: + - [ setLogger, [ "@logger" ]] + tags: + - { name: wallabag_import.import, alias: readability } diff --git a/src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig new file mode 100644 index 000000000..f527d3090 --- /dev/null +++ b/src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig @@ -0,0 +1,43 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{{ 'import.readability.page_title'|trans }}{% endblock %} + +{% block content %} +
+
+
+
+
{{ import.description|trans }}
+

{{ 'import.readability.how_to'|trans }}

+ +
+ {{ form_start(form, {'method': 'POST'}) }} + {{ form_errors(form) }} +
+
+ {{ form_errors(form.file) }} +
+ {{ form.file.vars.label|trans }} + {{ form_widget(form.file) }} +
+
+ +
+
+
+
{{ 'import.form.mark_as_read_title'|trans }}
+ {{ form_widget(form.mark_as_read) }} + {{ form_label(form.mark_as_read) }} +
+
+ + {{ form_widget(form.save, { 'attr': {'class': 'btn waves-effect waves-light'} }) }} + + {{ form_rest(form) }} + +
+
+
+
+
+{% endblock %} diff --git a/tests/Wallabag/ImportBundle/fixtures/readability.json b/tests/Wallabag/ImportBundle/fixtures/readability.json new file mode 100644 index 000000000..343799053 --- /dev/null +++ b/tests/Wallabag/ImportBundle/fixtures/readability.json @@ -0,0 +1,25 @@ +{ + "bookmarks": [ + { + "article__excerpt": "When Twitter started it had so much promise to change the way we communicate. But now it has been ruined by the amount of garbage and hate we have to wade through. It’s like that polluted…", + "favorite": false, + "date_archived": null, + "article__url": "https://venngage.com/blog/hashtags-are-worthless/", + "date_added": "2016-08-25T12:05:00", + "date_favorited": null, + "article__title": "We Looked At 167,943 Tweets & Found Out Hashtags Are Worthless", + "archive": false + }, + { + "article__excerpt": "TL;DR: Re-use your DOM elements and remove the ones that are far away from the viewport. Use placeholders to account for delayed data. Here’s a demo and the code for the infinite…", + "favorite": false, + "date_archived": "2016-08-26T12:21:54", + "article__url": "https://developers.google.com/web/updates/2016/07/infinite-scroller?imm_mid=0e6839&cmp=em-webops-na-na-newsltr_20160805", + "date_added": "2016-08-06T05:35:26", + "date_favorited": null, + "article__title": "Complexities of an infinite scroller | Web Updates", + "archive": true + } + ], + "recommendations": [] +} From ca15aaac188a1ad4b08595d3dbb06634320183ed Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 1 Sep 2016 09:36:11 +0200 Subject: [PATCH 2/6] Fix import count tests --- tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php index 96b5300ba..d869cdf9c 100644 --- a/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/ImportControllerTest.php @@ -24,6 +24,6 @@ class ImportControllerTest extends WallabagCoreTestCase $crawler = $client->request('GET', '/import/'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertEquals(3, $crawler->filter('blockquote')->count()); + $this->assertEquals(4, $crawler->filter('blockquote')->count()); } } From ca2a43ae7dc48d76fffe7d40976fb8c902a73dc7 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 1 Sep 2016 09:36:27 +0200 Subject: [PATCH 3/6] Add missing translations --- .../Resources/translations/messages.da.yml | 4 ++++ .../Resources/translations/messages.de.yml | 4 ++++ .../Resources/translations/messages.en.yml | 2 +- .../Resources/translations/messages.es.yml | 4 ++++ .../Resources/translations/messages.fa.yml | 18 +++++++++++------- .../Resources/translations/messages.fr.yml | 4 ++++ .../Resources/translations/messages.it.yml | 4 ++++ .../Resources/translations/messages.oc.yml | 4 ++++ .../Resources/translations/messages.pl.yml | 4 ++++ .../Resources/translations/messages.ro.yml | 4 ++++ .../Resources/translations/messages.tr.yml | 5 +++++ 11 files changed, 49 insertions(+), 8 deletions(-) diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 3c98d4f4b..b3012b956 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -341,6 +341,10 @@ 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.' + # 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).' + # how_to: 'Please select your Readability export and click on the below button to upload and import it.' developer: # page_title: 'Developer' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index b3f6719b6..3b2b5e59d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -341,6 +341,10 @@ 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.' + readability: + page_title: 'Aus Readability importieren' + # 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).' + # how_to: 'Please select your Readability export and click on the below button to upload and import it.' developer: page_title: 'Entwickler' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index f2bf9aedb..061441ec1 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -343,7 +343,7 @@ import: 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.' 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)' + 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).' how_to: 'Please select your Readability export and click on the below button to upload and import it.' developer: diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index cae07cf27..db90fd073 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -341,6 +341,10 @@ import: wallabag_v2: page_title: 'Importar > Wallabag v2' description: 'Va a importar sus artículos de otra instancia de wallabag v2. Vaya a Todos los artículos, entonces, en la barra lateral, oprima en "JSON". Usted tendrá un fichero "All articles.json"' + readability: + page_title: 'Importar > 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).' + # how_to: 'Please select your Readability export and click on the below button to upload and import it.' developer: page_title: 'Promotor' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index fa34c307f..f7438591c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -316,16 +316,16 @@ tag: # see_untagged_entries: 'See untagged entries' import: - page_title: 'درون‌ریزی' - page_description: 'به درون‌ریز wallabag خوش آمدید. لطفاً سرویس قبلی خود را که می‌خواهید از آن مهاجرت کنید انتخاب کنید.' - action: + page_title: 'درون‌ریزی' + page_description: 'به درون‌ریز wallabag خوش آمدید. لطفاً سرویس قبلی خود را که می‌خواهید از آن مهاجرت کنید انتخاب کنید.' + action: import_contents: 'درون‌ریزی مقاله‌ها' - form: + form: mark_as_read_title: 'علامت‌زدن همه به عنوان خوانده‌شده؟' mark_as_read_label: 'همهٔ مقاله‌های درون‌ریزی شده را به عنوان خوانده‌شده علامت بزن' file_label: 'پرونده' save_label: 'بارگذاری پرونده' - pocket: + pocket: page_title: 'درون‌ریزی > Pocket' description: "این برنامه همهٔ داده‌های Pocket شما را درون‌ریزی می‌کند. سرویس Pocket اجازه نمی‌دهد که متن مقاله‌ها را درون‌ریزی کنیم، بنابراین wallabag متن مقاله‌ها را دوباره از اینترنت دریافت می‌کند." config_missing: @@ -334,13 +334,17 @@ import: user_message: 'مدیر سرور شما باید یک API Key برای Pocket تعریف کند.' authorize_message: 'شما می‌توانید داده‌هایتان را از حساب Pocket خود درون‌ریزی کنید. روی دکمهٔ زیر کلیک کنید و به برنامه اجازه دهید تا به getpocket.com وصل شود.' connect_to_pocket: 'به Pocket وصل شو و داده‌ها را دریافت کن' - wallabag_v1: + wallabag_v1: page_title: 'درون‌ریزی > Wallabag v1' description: 'این برنامه همهٔ داده‌های شما را در نسخهٔ ۱ wallabag درون‌ریزی می‌کند. در صفحهٔ تنظیمات، روی "JSON export" در بخش "Export your wallabag data" کلیک کنید. با این کار شما پرونده‌ای به شکل "wallabag-export-1-xxxx-xx-xx.json" دریافت خواهید کرد.' how_to: 'لطفاً پرونده را انتخاب کنید و روی دکمهٔ زیر کلیک کنید تا بارگذاری و درون‌ریزی شود.' - wallabag_v2: + wallabag_v2: page_title: 'درون‌ریزی > Wallabag v2' description: 'این برنامه همهٔ داده‌های شما را در نسخهٔ ۲ wallabag درون‌ریزی می‌کند. به بخش «همهٔ مقاله‌ها» بروید و در بخش «برون‌ریزی» روی "JSON" کلیک کنید. با این کار شما پرونده‌ای به شکل "All articles.json" دریافت خواهید کرد.' + 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).' + # how_to: 'Please select your Readability export and click on the below button to upload and import it.' developer: # page_title: 'Developer' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index b8547fef3..fed4cc858 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -341,6 +341,10 @@ 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\"" + 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 email avec un lien pour télécharger le json.' + how_to: "Choisissez le fichier de votre export Readability et cliquez sur le bouton ci-dessous pour l'importer." developer: page_title: 'Développeur' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index d3c9ca4b9..b90ec3dc6 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -340,6 +340,10 @@ 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 sidebar di esportazione, clicca su "JSON". Otterrai un file "Tutti i contenuti.json".' + readability: + page_title: 'Importa da > 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).' + # how_to: 'Please select your Readability export and click on the below button to upload and import it.' developer: page_title: 'Sviluppatori' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index c98b12200..c3504bb8b 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -341,6 +341,10 @@ import: wallabag_v2: page_title: 'Importer > 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\". Traparatz un fichièr \"All articles.json\"" + readability: + page_title: 'Importer > 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).' + # how_to: 'Please select your Readability export and click on the below button to upload and import it.' developer: page_title: 'Desvolopador' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index af2ab24f8..b33b3acea 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -341,6 +341,10 @@ 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".' + 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).' + # how_to: 'Please select your Readability export and click on the below button to upload and import it.' developer: page_title: 'Deweloper' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index d4ee5cbdd..c55ef2e6e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -341,6 +341,10 @@ 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.' + # 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).' + # how_to: 'Please select your Readability export and click on the below button to upload and import it.' developer: # page_title: 'Developer' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 78a72d861..6dfbfa896 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -292,6 +292,7 @@ quickstart: pocket: "Pocket üzerindeki verilerinizi wallabag'e aktarın" wallabag_v1: "wallabag v1 üzerindeki verilerinizi wallabag'in yeni sürümüne aktarın" wallabag_v2: "wallabag v2 üzerindeki verilerinizi wallabag'in yeni sürümüne aktarın" + readability: "Readability üzerindeki verilerinizi wallabag'e aktarın'" developer: # title: 'Developers' # create_application: 'Create your third application' @@ -341,6 +342,10 @@ 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.' + 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).' + # how_to: 'Please select your Readability export and click on the below button to upload and import it.' developer: # page_title: 'Developer' From a1a107705948c724aca7326f8550c336a25a6364 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 1 Sep 2016 09:57:02 +0200 Subject: [PATCH 4/6] Add tests on ReadabilityImport --- .../ImportBundle/Import/ReadabilityImport.php | 2 - .../Controller/ReadabilityControllerTest.php | 122 ++++++++++++++ .../Import/ReadabilityImportTest.php | 150 ++++++++++++++++++ .../fixtures/readability-read.json | 25 +++ 4 files changed, 297 insertions(+), 2 deletions(-) create mode 100644 tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php create mode 100644 tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php create mode 100644 tests/Wallabag/ImportBundle/fixtures/readability-read.json diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php index abea81a71..37b160c5c 100644 --- a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php +++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php @@ -8,7 +8,6 @@ use Wallabag\UserBundle\Entity\User; class ReadabilityImport extends AbstractImport { private $user; - private $client; private $skippedEntries = 0; private $importedEntries = 0; private $filepath; @@ -143,7 +142,6 @@ class ReadabilityImport extends AbstractImport $data = [ 'title' => $importedEntry['article__title'], - // 'html' => $importedEntry['article__excerpt'], 'url' => $importedEntry['article__url'], 'content_type' => '', 'language' => '', diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php new file mode 100644 index 000000000..92cf4bfc8 --- /dev/null +++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php @@ -0,0 +1,122 @@ +logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/import/readability'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertEquals(1, $crawler->filter('form[name=upload_import_file] > button[type=submit]')->count()); + $this->assertEquals(1, $crawler->filter('input[type=file]')->count()); + } + + public function testImportReadabilityWithFile() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/import/readability'); + $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); + + $file = new UploadedFile(__DIR__.'/../fixtures/readability.json', 'readability.json'); + + $data = [ + 'upload_import_file[file]' => $file, + ]; + + $client->submit($form, $data); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + $crawler = $client->followRedirect(); + + $content = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findByUrlAndUserId( + 'https://venngage.com/blog/hashtags-are-worthless/', + $this->getLoggedInUserId() + ); + + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); + $this->assertContains('flashes.import.notice.summary', $body[0]); + } + + public function testImportReadabilityWithFileAndMarkAllAsRead() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/import/readability'); + $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); + + $file = new UploadedFile(__DIR__.'/../fixtures/readability-read.json', 'readability-read.json'); + + $data = [ + 'upload_import_file[file]' => $file, + 'upload_import_file[mark_as_read]' => 1, + ]; + + $client->submit($form, $data); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + $crawler = $client->followRedirect(); + + $content1 = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findByUrlAndUserId( + 'https://blog.travis-ci.com/2016-07-28-what-we-learned-from-analyzing-2-million-travis-builds/', + $this->getLoggedInUserId() + ); + + $this->assertTrue($content1->isArchived()); + + $content2 = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findByUrlAndUserId( + 'https://facebook.github.io/graphql/', + $this->getLoggedInUserId() + ); + + $this->assertTrue($content2->isArchived()); + + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); + $this->assertContains('flashes.import.notice.summary', $body[0]); + } + + public function testImportReadabilityWithEmptyFile() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/import/readability'); + $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); + + $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); + + $data = [ + 'upload_import_file[file]' => $file, + ]; + + $client->submit($form, $data); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + $crawler = $client->followRedirect(); + + $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); + $this->assertContains('flashes.import.notice.failed', $body[0]); + } +} diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php new file mode 100644 index 000000000..706d707b2 --- /dev/null +++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php @@ -0,0 +1,150 @@ +user = new User(); + + $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') + ->disableOriginalConstructor() + ->getMock(); + + $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') + ->disableOriginalConstructor() + ->getMock(); + + $wallabag = new ReadabilityImport($this->em, $this->contentProxy); + + $this->logHandler = new TestHandler(); + $logger = new Logger('test', [$this->logHandler]); + $wallabag->setLogger($logger); + + if (false === $unsetUser) { + $wallabag->setUser($this->user); + } + + return $wallabag; + } + + public function testInit() + { + $readabilityImport = $this->getReadabilityImport(); + + $this->assertEquals('Readability', $readabilityImport->getName()); + $this->assertNotEmpty($readabilityImport->getUrl()); + $this->assertEquals('import.readability.description', $readabilityImport->getDescription()); + } + + public function testImport() + { + $readabilityImport = $this->getReadabilityImport(); + $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); + + $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') + ->disableOriginalConstructor() + ->getMock(); + + $entryRepo->expects($this->exactly(2)) + ->method('findByUrlAndUserId') + ->will($this->onConsecutiveCalls(false, true)); + + $this->em + ->expects($this->any()) + ->method('getRepository') + ->willReturn($entryRepo); + + $entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry') + ->disableOriginalConstructor() + ->getMock(); + + $this->contentProxy + ->expects($this->exactly(1)) + ->method('updateEntry') + ->willReturn($entry); + + $res = $readabilityImport->import(); + + $this->assertTrue($res); + $this->assertEquals(['skipped' => 1, 'imported' => 1], $readabilityImport->getSummary()); + } + + public function testImportAndMarkAllAsRead() + { + $readabilityImport = $this->getReadabilityImport(); + $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability-read.json'); + + $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') + ->disableOriginalConstructor() + ->getMock(); + + $entryRepo->expects($this->exactly(2)) + ->method('findByUrlAndUserId') + ->will($this->onConsecutiveCalls(false, false)); + + $this->em + ->expects($this->any()) + ->method('getRepository') + ->willReturn($entryRepo); + + $this->contentProxy + ->expects($this->exactly(2)) + ->method('updateEntry') + ->willReturn(new Entry($this->user)); + + // check that every entry persisted are archived + $this->em + ->expects($this->any()) + ->method('persist') + ->with($this->callback(function ($persistedEntry) { + return $persistedEntry->isArchived(); + })); + + $res = $readabilityImport->setMarkAsRead(true)->import(); + + $this->assertTrue($res); + + $this->assertEquals(['skipped' => 0, 'imported' => 2], $readabilityImport->getSummary()); + } + + public function testImportBadFile() + { + $readabilityImport = $this->getReadabilityImport(); + $readabilityImport->setFilepath(__DIR__.'/../fixtures/wallabag-v1.jsonx'); + + $res = $readabilityImport->import(); + + $this->assertFalse($res); + + $records = $this->logHandler->getRecords(); + $this->assertContains('ReadabilityImport: unable to read file', $records[0]['message']); + $this->assertEquals('ERROR', $records[0]['level_name']); + } + + public function testImportUserNotDefined() + { + $readabilityImport = $this->getReadabilityImport(true); + $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); + + $res = $readabilityImport->import(); + + $this->assertFalse($res); + + $records = $this->logHandler->getRecords(); + $this->assertContains('ReadabilityImport: user is not defined', $records[0]['message']); + $this->assertEquals('ERROR', $records[0]['level_name']); + } +} diff --git a/tests/Wallabag/ImportBundle/fixtures/readability-read.json b/tests/Wallabag/ImportBundle/fixtures/readability-read.json new file mode 100644 index 000000000..c60767dc8 --- /dev/null +++ b/tests/Wallabag/ImportBundle/fixtures/readability-read.json @@ -0,0 +1,25 @@ +{ + "bookmarks": [ + { + "article__excerpt": "This is a guest post from Moritz Beller from the Delft University of Technology in The Netherlands. His team produced amazing research on several million Travis CI builds, creating invaluable…", + "favorite": false, + "date_archived": "2016-08-02T06:49:30", + "article__url": "https://blog.travis-ci.com/2016-07-28-what-we-learned-from-analyzing-2-million-travis-builds/", + "date_added": "2016-08-01T05:24:16", + "date_favorited": null, + "article__title": "Travis", + "archive": true + }, + { + "article__excerpt": "The GraphQL Type system describes the capabilities of a GraphQL server and is used to determine if a query is valid. The type system also describes the input types of query variables to determine if…", + "favorite": false, + "date_archived": "2016-07-19T06:48:31", + "article__url": "https://facebook.github.io/graphql/", + "date_added": "2016-06-24T17:50:16", + "date_favorited": null, + "article__title": "GraphQL", + "archive": true + } + ], + "recommendations": [] +} From 209ec7cedd8bcf050223b869a54940c9f2d03899 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 1 Sep 2016 12:07:35 +0200 Subject: [PATCH 5/6] Add Readability to Quickstart page --- src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | 1 + src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | 1 + src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | 1 + src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | 1 + src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | 1 + src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | 1 + src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | 1 + src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | 1 + src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | 1 + src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | 1 + .../Resources/views/themes/baggy/Static/quickstart.html.twig | 1 + .../Resources/views/themes/material/Static/quickstart.html.twig | 1 + 12 files changed, 12 insertions(+) diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index b3012b956..073dee28e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -292,6 +292,7 @@ quickstart: # pocket: 'Migrate from Pocket' # wallabag_v1: 'Migrate from wallabag v1' # wallabag_v2: 'Migrate from wallabag v2' + # readability: 'Migrate from Readability' # developer: # title: 'Developers' # create_application: 'Create your third application' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 3b2b5e59d..4cfd240f4 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -292,6 +292,7 @@ quickstart: pocket: 'von Pocket migrieren' wallabag_v1: 'von wallabag v1 migrieren' wallabag_v2: 'von wallabag v2 migrieren' + readability: 'von Readability migrieren' developer: title: 'Entwickler' create_application: 'Erstelle eine Anwendung und nutze die wallabag API' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 061441ec1..42374b40e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -292,6 +292,7 @@ quickstart: pocket: 'Migrate from Pocket' wallabag_v1: 'Migrate from wallabag v1' wallabag_v2: 'Migrate from wallabag v2' + readability: 'Migrate from Readability' developer: title: 'Developers' create_application: 'Create your third application' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index db90fd073..ee84cc62f 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -292,6 +292,7 @@ quickstart: pocket: 'Migrar desde Pocket' wallabag_v1: 'Migrar desde wallabag v1' wallabag_v2: 'Migrar desde wallabag v2' + readability: 'Migrar desde Readability' developer: title: 'Promotores' create_application: 'Cree su tercera aplicación' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index f7438591c..e9af1e8d1 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -292,6 +292,7 @@ quickstart: pocket: 'مهاجرت از Pocket' wallabag_v1: 'مهاجرت از نسخهٔ یکم wallabag' wallabag_v2: 'مهاجرت از نسخهٔ دوم wallabag' + readability: 'مهاجرت از نسخهٔ دوم Readability' developer: title: 'برنامه‌نویسان' create_application: 'برنامهٔ wallabag خود را بسازید' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index fed4cc858..402cdf4a6 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -292,6 +292,7 @@ quickstart: pocket: 'Migrer depuis Pocket' wallabag_v1: 'Migrer depuis wallabag v1' wallabag_v2: 'Migrer depuis wallabag v2' + readability: 'Migrer depuis Readability' developer: title: 'Pour les développeurs' create_application: 'Créer votre application tierce' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index b90ec3dc6..3aee48167 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -291,6 +291,7 @@ quickstart: pocket: 'Trasferisci da Pocket' wallabag_v1: 'Trasferisci da wallabag v1' wallabag_v2: 'Trasferisci da wallabag v2' + readability: 'Trasferisci da Readability' developer: title: 'Sviluppatori' create_application: 'Crea la tua applicazione' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index c3504bb8b..855f23615 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -292,6 +292,7 @@ quickstart: pocket: 'Migrar dempuèi Pocket' wallabag_v1: 'Migrar dempuèi wallabag v1' wallabag_v2: 'Migrar dempuèi wallabag v2' + readability: 'Migrar dempuèi Readability' developer: title: 'Pels desvolopadors' create_application: 'Crear vòstra aplicacion tèrça' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index b33b3acea..69ccf8e38 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -292,6 +292,7 @@ quickstart: pocket: 'Migruj z Pocket' wallabag_v1: 'Migruj z wallabag v1' wallabag_v2: 'Migruj z wallabag v2' + readability: 'Migruj z Readability' developer: title: 'Deweloperzy' create_application: 'Stwórz swoją aplikację' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index c55ef2e6e..f41609d02 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -292,6 +292,7 @@ quickstart: # pocket: 'Migrate from Pocket' # wallabag_v1: 'Migrate from wallabag v1' # wallabag_v2: 'Migrate from wallabag v2' + # readability: 'Migrate from Readability' # developer: # title: 'Developers' # create_application: 'Create your third application' diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/quickstart.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/quickstart.html.twig index b3d3d5a08..ea1c1cbec 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/quickstart.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/quickstart.html.twig @@ -39,6 +39,7 @@
  • {{ 'quickstart.migrate.pocket'|trans }}
  • {{ 'quickstart.migrate.wallabag_v1'|trans }}
  • {{ 'quickstart.migrate.wallabag_v2'|trans }}
  • +
  • {{ 'quickstart.migrate.readability'|trans }}
  • {{ 'quickstart.developer.title'|trans }}

    diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig index 59dd037b8..8cbf4ab40 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig @@ -44,6 +44,7 @@
  • {{ 'quickstart.migrate.pocket'|trans }}
  • {{ 'quickstart.migrate.wallabag_v1'|trans }}
  • {{ 'quickstart.migrate.wallabag_v2'|trans }}
  • +
  • {{ 'quickstart.migrate.readability'|trans }}
  • {{ 'quickstart.developer.title'|trans }}

    From dc9d76b4906c34a79fbfa6255814f267082033d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 1 Sep 2016 13:36:26 +0200 Subject: [PATCH 6/6] Added documentation for Readability migration --- docs/en/user/import.rst | 21 ++++++++++++++++----- docs/fr/user/import.rst | 20 ++++++++++++++++---- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/docs/en/user/import.rst b/docs/en/user/import.rst index 632104847..e6c37d722 100644 --- a/docs/en/user/import.rst +++ b/docs/en/user/import.rst @@ -30,14 +30,25 @@ You need to authorize wallabag to interact with your Pocket account. Your data will be imported. Data import can be a demanding process for your server (we need to work on this import to improve it). -From Instapaper ---------------- - -*Feature not yet implemented in wallabag v2.* - From Readability ---------------- +Export your Readability data +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +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). + +Import your data into wallabag 2.x +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Click on ``Import`` link in the menu, on ``Import contents`` in Readability section +and then select your json file and upload it. + +Your data will be imported. Data import can be a demanding process for your server (we need to work on this import to improve it). + +From Instapaper +--------------- + *Feature not yet implemented in wallabag v2.* From HTML or JSON file diff --git a/docs/fr/user/import.rst b/docs/fr/user/import.rst index e6c2fa02d..99ac602b6 100644 --- a/docs/fr/user/import.rst +++ b/docs/fr/user/import.rst @@ -30,15 +30,27 @@ Vous devez autoriser wallabag à se connecter à votre compte Pocket. Vos données vont être importées. L'import de données est une action qui peut être couteuse pour votre serveur (nous devons encore travailler pour améliorer cet import). +Depuis Readability +------------------ + +Exportez 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 email avec un lien pour télécharger le json. + +Importez vos données dans wallabag 2.x +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Cliquez sur le lien ``Importer`` dans le menu, sur ``Importer les contenus`` dans +la section Readability et ensuite sélectionnez votre fichier json pour l'uploader. + +Vos données vont être importées. L'import de données est une action qui peut être couteuse pour votre serveur (nous devons encore travailler pour améliorer cet import). + Depuis Instapaper ----------------- *Fonctionnalité pas encore implémentée dans wallabag v2.* -Depuis Readability ------------------- - -*Fonctionnalité pas encore implémentée dans wallabag v2.* Depuis un fichier HTML ou JSON ------------------------------