diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/InstapaperImport.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/InstapaperImport.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 70a53f1a..3aa12f6f 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); |
@@ -116,7 +125,15 @@ class InstapaperImport extends AbstractImport | |||
116 | $entry->setTitle($importedEntry['title']); | 125 | $entry->setTitle($importedEntry['title']); |
117 | 126 | ||
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 | $this->fetchContent($entry, $importedEntry['url'], $importedEntry); |
129 | |||
130 | if (!empty($importedEntry['tags'])) { | ||
131 | $this->tagsAssigner->assignTagsToEntry( | ||
132 | $entry, | ||
133 | $importedEntry['tags'], | ||
134 | $this->em->getUnitOfWork()->getScheduledEntityInsertions() | ||
135 | ); | ||
136 | } | ||
120 | 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']); |