X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FImportBundle%2FImport%2FInstapaperImport.php;h=7d70154a66bf63b32e3f6e5f1574b134c002b628;hb=2490f61dca635026a3eb9b5e9b6978b1981b1172;hp=cf4c785ce8dca325d3ab0b93a07a3b7e09b484bc;hpb=114c55c0a6eade2ba6c53fe25f61cc58cca91620;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index cf4c785c..7d70154a 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -68,14 +68,22 @@ 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'], true)) { + $tags = [$data[3]]; + } + $entries[] = [ 'url' => $data[0], 'title' => $data[1], 'status' => $data[3], 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred', 'is_starred' => $data[3] === 'Starred', - 'content_type' => '', - 'language' => '', + 'html' => false, + 'tags' => $tags, ]; } fclose($handle); @@ -117,7 +125,15 @@ class InstapaperImport extends AbstractImport $entry->setTitle($importedEntry['title']); // update entry with content (in case fetching failed, the given entry will be return) - $entry = $this->fetchContent($entry, $importedEntry['url'], $importedEntry); + $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']);