passiomatic / coldsweat

Web RSS aggregator and reader compatible with the Fever API
MIT License
145 stars 21 forks source link

Add command to import and export saved entries #84

Open passiomatic opened 9 years ago

passiomatic commented 9 years ago

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:

  1. For each saved entry write the following fields: title, link, guid, updated, content and content_type. Since in Coldsweat we don't have the distinction between entry summary and content we always specify the latter.
  2. For each entry we need to specify the original feed URL, so we can associate them accordingly once reimported, via the atom:source element: "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.