diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-11-03 16:22:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-03 16:22:07 +0100 |
commit | da4136557963018287cae61226e9006c3c741747 (patch) | |
tree | 6bf23c0d32f3780843798ae47c65377ae1ff961a /src/Wallabag/ImportBundle/Command | |
parent | 816c0940d142f8ec69bdd3f302c9751033cce7e2 (diff) | |
parent | ca08d02f2f17c0e4ec0152a701c540f62713a428 (diff) | |
download | wallabag-da4136557963018287cae61226e9006c3c741747.tar.gz wallabag-da4136557963018287cae61226e9006c3c741747.tar.zst wallabag-da4136557963018287cae61226e9006c3c741747.zip |
Merge pull request #2180 from wallabag/download-pictures
Download pictures
Diffstat (limited to 'src/Wallabag/ImportBundle/Command')
-rw-r--r-- | src/Wallabag/ImportBundle/Command/ImportCommand.php | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php index 1df38295..2f7a906e 100644 --- a/src/Wallabag/ImportBundle/Command/ImportCommand.php +++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php | |||
@@ -14,10 +14,10 @@ class ImportCommand extends ContainerAwareCommand | |||
14 | { | 14 | { |
15 | $this | 15 | $this |
16 | ->setName('wallabag:import') | 16 | ->setName('wallabag:import') |
17 | ->setDescription('Import entries from a JSON export from a wallabag v1 instance') | 17 | ->setDescription('Import entries from a JSON export') |
18 | ->addArgument('userId', InputArgument::REQUIRED, 'User ID to populate') | 18 | ->addArgument('userId', InputArgument::REQUIRED, 'User ID to populate') |
19 | ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file') | 19 | ->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file') |
20 | ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: wallabag v1, v2, firefox or chrome', 'v1') | 20 | ->addOption('importer', null, InputArgument::OPTIONAL, 'The importer to use: v1, v2, instapaper, readability, firefox or chrome', 'v1') |
21 | ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false) | 21 | ->addOption('markAsRead', null, InputArgument::OPTIONAL, 'Mark all entries as read', false) |
22 | ; | 22 | ; |
23 | } | 23 | } |
@@ -42,29 +42,35 @@ class ImportCommand extends ContainerAwareCommand | |||
42 | 42 | ||
43 | switch ($input->getOption('importer')) { | 43 | switch ($input->getOption('importer')) { |
44 | case 'v2': | 44 | case 'v2': |
45 | $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v2.import'); | 45 | $import = $this->getContainer()->get('wallabag_import.wallabag_v2.import'); |
46 | break; | 46 | break; |
47 | case 'firefox': | 47 | case 'firefox': |
48 | $wallabag = $this->getContainer()->get('wallabag_import.firefox.import'); | 48 | $import = $this->getContainer()->get('wallabag_import.firefox.import'); |
49 | break; | 49 | break; |
50 | case 'chrome': | 50 | case 'chrome': |
51 | $wallabag = $this->getContainer()->get('wallabag_import.chrome.import'); | 51 | $import = $this->getContainer()->get('wallabag_import.chrome.import'); |
52 | break; | ||
53 | case 'readability': | ||
54 | $import = $this->getContainer()->get('wallabag_import.readability.import'); | ||
55 | break; | ||
56 | case 'instapaper': | ||
57 | $import = $this->getContainer()->get('wallabag_import.instapaper.import'); | ||
52 | break; | 58 | break; |
53 | case 'v1': | 59 | case 'v1': |
54 | default: | 60 | default: |
55 | $wallabag = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); | 61 | $import = $this->getContainer()->get('wallabag_import.wallabag_v1.import'); |
56 | break; | 62 | break; |
57 | } | 63 | } |
58 | 64 | ||
59 | $wallabag->setMarkAsRead($input->getOption('markAsRead')); | 65 | $import->setMarkAsRead($input->getOption('markAsRead')); |
60 | $wallabag->setUser($user); | 66 | $import->setUser($user); |
61 | 67 | ||
62 | $res = $wallabag | 68 | $res = $import |
63 | ->setFilepath($input->getArgument('filepath')) | 69 | ->setFilepath($input->getArgument('filepath')) |
64 | ->import(); | 70 | ->import(); |
65 | 71 | ||
66 | if (true === $res) { | 72 | if (true === $res) { |
67 | $summary = $wallabag->getSummary(); | 73 | $summary = $import->getSummary(); |
68 | $output->writeln('<info>'.$summary['imported'].' imported</info>'); | 74 | $output->writeln('<info>'.$summary['imported'].' imported</info>'); |
69 | $output->writeln('<comment>'.$summary['skipped'].' already saved</comment>'); | 75 | $output->writeln('<comment>'.$summary['skipped'].' already saved</comment>'); |
70 | } | 76 | } |