- $progress = new ProgressBar($output, $size);
- $progress->start();
-
- foreach ($data as $object) {
- $array = (array) $object;
- $entry = $em->getRepository('WallabagCoreBundle:Entry')
- ->findOneByUrl($array['url']);
-
- if (!is_object($entry)) {
- $entry = new Entry($user);
- $entry->setUrl($array['url']);
- }
-
- $entry->setTitle($array['title']);
- $entry->setArchived($array['is_read']);
- $entry->setStarred($array['is_fav']);
- $entry->setContent($array['content']);
- $entry->setReadingTime(Utils::getReadingTime($array['content']));
-
- $em->persist($entry);
-
- if (($i % $batchSize) === 0) {
- $em->flush();
- $progress->advance($batchSize);
-
- $now = new \DateTime();
- $output->writeln(' of entries imported ... | '.$now->format('d-m-Y G:i:s'));
- }
- ++$i;
+ switch ($input->getOption('importer')) {
+ case 'v2':
+ $import = $this->getContainer()->get('wallabag_import.wallabag_v2.import');
+ break;
+ case 'firefox':
+ $import = $this->getContainer()->get('wallabag_import.firefox.import');
+ break;
+ case 'chrome':
+ $import = $this->getContainer()->get('wallabag_import.chrome.import');
+ break;
+ case 'readability':
+ $import = $this->getContainer()->get('wallabag_import.readability.import');
+ break;
+ case 'instapaper':
+ $import = $this->getContainer()->get('wallabag_import.instapaper.import');
+ break;
+ case 'pinboard':
+ $import = $this->getContainer()->get('wallabag_import.pinboard.import');
+ break;
+ default:
+ $import = $this->getContainer()->get('wallabag_import.wallabag_v1.import');