diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-05-31 10:38:00 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-05-31 10:38:00 +0200 |
commit | 7a8ed3cee1003aae56400e18509980e2695ea622 (patch) | |
tree | 6719b99d1a5a370ac6c9d41c965a04f689383d39 /src/Wallabag/ImportBundle | |
parent | 7aa5607f297d5ef188d06cc3f808f9ff5bda83b2 (diff) | |
download | wallabag-7a8ed3cee1003aae56400e18509980e2695ea622.tar.gz wallabag-7a8ed3cee1003aae56400e18509980e2695ea622.tar.zst wallabag-7a8ed3cee1003aae56400e18509980e2695ea622.zip |
Add support for tag in Instapaper import
Diffstat (limited to 'src/Wallabag/ImportBundle')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/InstapaperImport.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 70a53f1a..c8e0cd5b 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php | |||
@@ -68,6 +68,14 @@ class InstapaperImport extends AbstractImport | |||
68 | continue; | 68 | continue; |
69 | } | 69 | } |
70 | 70 | ||
71 | // last element in the csv is the folder where the content belong | ||
72 | // BUT it can also be the status (since status = folder in Instapaper) | ||
73 | // and we don't want archive, unread & starred to become a tag | ||
74 | $tags = null; | ||
75 | if (false === in_array($data[3], ['Archive', 'Unread', 'Starred'])) { | ||
76 | $tags = [$data[3]]; | ||
77 | } | ||
78 | |||
71 | $entries[] = [ | 79 | $entries[] = [ |
72 | 'url' => $data[0], | 80 | 'url' => $data[0], |
73 | 'title' => $data[1], | 81 | 'title' => $data[1], |
@@ -75,6 +83,7 @@ class InstapaperImport extends AbstractImport | |||
75 | 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred', | 83 | 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred', |
76 | 'is_starred' => $data[3] === 'Starred', | 84 | 'is_starred' => $data[3] === 'Starred', |
77 | 'html' => false, | 85 | 'html' => false, |
86 | 'tags' => $tags, | ||
78 | ]; | 87 | ]; |
79 | } | 88 | } |
80 | fclose($handle); | 89 | fclose($handle); |
@@ -118,6 +127,14 @@ class InstapaperImport extends AbstractImport | |||
118 | // update entry with content (in case fetching failed, the given entry will be return) | 127 | // update entry with content (in case fetching failed, the given entry will be return) |
119 | $entry = $this->fetchContent($entry, $importedEntry['url'], $importedEntry); | 128 | $entry = $this->fetchContent($entry, $importedEntry['url'], $importedEntry); |
120 | 129 | ||
130 | if (!empty($importedEntry['tags'])) { | ||
131 | $this->tagsAssigner->assignTagsToEntry( | ||
132 | $entry, | ||
133 | $importedEntry['tags'], | ||
134 | $this->em->getUnitOfWork()->getScheduledEntityInsertions() | ||
135 | ); | ||
136 | } | ||
137 | |||
121 | $entry->setArchived($importedEntry['is_archived']); | 138 | $entry->setArchived($importedEntry['is_archived']); |
122 | $entry->setStarred($importedEntry['is_starred']); | 139 | $entry->setStarred($importedEntry['is_starred']); |
123 | 140 | ||