coldsweat
coldsweat copied to clipboard
Add command to import and export saved entries
This feature is handy to transfer data between a database engine and another (e.g. sqlite to MySQL) or updating an existing installation (e.g. MySQL ISAM to MySQL InnoDB).
Input and output format could be a single saved.atom feed file.
Export procedure
To export a single Atom feed with the saved entries of a given user the required steps are:
- For each saved entry write the following fields:
title,link,guid,updated,contentandcontent_type. Since in Coldsweat we don't have the distinction between entry summary and content we always specify the latter. - For each entry we need to specify the original feed URL, so we can associate them accordingly once reimported, via the
atom:sourceelement: "The atom:source element is designed to allow the aggregation of entries from different feeds while retaining information about an entry's source feed." — https://tools.ietf.org/html/rfc4287#section-4.2.11
Import procedure
Import procedure will use feedparser to read back the save.atom feed, and loop thru its entries. Any entry which atom:source matches a feed already present in the database will be added. Also entry will be marked as saved too.