mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
Merge pull request #3168 from wallabag/instapaper-tags-import
Add support for tag in Instapaper import
This commit is contained in:
commit
4423b88c5b
13 changed files with 94 additions and 31 deletions
|
@ -68,6 +68,14 @@ class InstapaperImport extends AbstractImport
|
|||
continue;
|
||||
}
|
||||
|
||||
// last element in the csv is the folder where the content belong
|
||||
// BUT it can also be the status (since status = folder in Instapaper)
|
||||
// and we don't want archive, unread & starred to become a tag
|
||||
$tags = null;
|
||||
if (false === in_array($data[3], ['Archive', 'Unread', 'Starred'])) {
|
||||
$tags = [$data[3]];
|
||||
}
|
||||
|
||||
$entries[] = [
|
||||
'url' => $data[0],
|
||||
'title' => $data[1],
|
||||
|
@ -75,6 +83,7 @@ class InstapaperImport extends AbstractImport
|
|||
'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred',
|
||||
'is_starred' => $data[3] === 'Starred',
|
||||
'html' => false,
|
||||
'tags' => $tags,
|
||||
];
|
||||
}
|
||||
fclose($handle);
|
||||
|
@ -118,6 +127,14 @@ class InstapaperImport extends AbstractImport
|
|||
// update entry with content (in case fetching failed, the given entry will be return)
|
||||
$entry = $this->fetchContent($entry, $importedEntry['url'], $importedEntry);
|
||||
|
||||
if (!empty($importedEntry['tags'])) {
|
||||
$this->tagsAssigner->assignTagsToEntry(
|
||||
$entry,
|
||||
$importedEntry['tags'],
|
||||
$this->em->getUnitOfWork()->getScheduledEntityInsertions()
|
||||
);
|
||||
}
|
||||
|
||||
$entry->setArchived($importedEntry['is_archived']);
|
||||
$entry->setStarred($importedEntry['is_starred']);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue