|
This change introduces the ability to import feeds from an OPML file
using a command-line interface.
Key features:
- New `--import-opml` (or `-I`) flag in `main.go` to specify the
OPML file path.
- The `importer.ImportOPML` function in `importer/importer.go` handles
the parsing of the OPML file (using `github.com/gilliek/go-opml`)
and addition of new feeds to the database.
- Recursive processing of OPML outlines allows for importing feeds
nested within folders.
- Feeds are identified by their XML URL; existing feeds with the
same URL are skipped to avoid duplicates.
- Title extraction prioritizes the `title` attribute, then the `text`
attribute of an outline, and falls back to "Untitled Feed".
Comprehensive unit tests have been added in `importer/importer_test.go`
to verify:
- Correct parsing and importing of various OPML structures.
- Proper handling of duplicate feeds (skipping).
- Correct title extraction logic.
- Database interaction and cleanup.
|