Add Pocket CSV import

This commit is contained in:
Nicolas Lœuillet
2025-05-24 17:51:45 +02:00
committed by Kevin Decherf
parent 52a16bb75f
commit c1397f43ac
17 changed files with 754 additions and 4 deletions

View File

@ -18,6 +18,7 @@ use Wallabag\ImportBundle\Import\FirefoxImport;
use Wallabag\ImportBundle\Import\InstapaperImport;
use Wallabag\ImportBundle\Import\OmnivoreImport;
use Wallabag\ImportBundle\Import\PinboardImport;
use Wallabag\ImportBundle\Import\PocketCsvImport;
use Wallabag\ImportBundle\Import\PocketHtmlImport;
use Wallabag\ImportBundle\Import\ReadabilityImport;
use Wallabag\ImportBundle\Import\ShaarliImport;
@ -43,6 +44,7 @@ class ImportCommand extends Command
private ElcuratorImport $elcuratorImport;
private ShaarliImport $shaarliImport;
private PocketHtmlImport $pocketHtmlImport;
private PocketCsvImport $pocketCsvImport;
public function __construct(
EntityManagerInterface $entityManager,
@ -59,7 +61,8 @@ class ImportCommand extends Command
ElcuratorImport $elcuratorImport,
OmnivoreImport $omnivoreImport,
ShaarliImport $shaarliImport,
PocketHtmlImport $pocketHtmlImport
PocketHtmlImport $pocketHtmlImport,
PocketCsvImport $pocketCsvImport
) {
$this->entityManager = $entityManager;
$this->tokenStorage = $tokenStorage;
@ -76,6 +79,7 @@ class ImportCommand extends Command
$this->elcuratorImport = $elcuratorImport;
$this->shaarliImport = $shaarliImport;
$this->pocketHtmlImport = $pocketHtmlImport;
$this->pocketCsvImport = $pocketCsvImport;
parent::__construct();
}
@ -87,7 +91,7 @@ class ImportCommand extends Command
->setDescription('Import entries from a JSON export')
->addArgument('username', InputArgument::REQUIRED, 'User to populate')
->addArgument('filepath', InputArgument::REQUIRED, 'Path to the JSON file')
->addOption('importer', null, InputOption::VALUE_OPTIONAL, 'The importer to use: v1, v2, instapaper, pinboard, delicious, readability, firefox, chrome, elcurator, shaarli or pocket', 'v1')
->addOption('importer', null, InputOption::VALUE_OPTIONAL, 'The importer to use: v1, v2, instapaper, pinboard, delicious, readability, firefox, chrome, elcurator, shaarli, pocket or pocket_csv', 'v1')
->addOption('markAsRead', null, InputOption::VALUE_OPTIONAL, 'Mark all entries as read', false)
->addOption('useUserId', null, InputOption::VALUE_NONE, 'Use user id instead of username to find account')
->addOption('disableContentUpdate', null, InputOption::VALUE_NONE, 'Disable fetching updated content from URL')
@ -159,6 +163,9 @@ class ImportCommand extends Command
case 'pocket':
$import = $this->pocketHtmlImport;
break;
case 'pocket_csv':
$import = $this->pocketCsvImport;
break;
default:
$import = $this->wallabagV1Import;
}