93 Commits

Author SHA1 Message Date
Bart De Vries
f861f4e802 Add podcast subscription and episode play state synchronization
This implements the gpodder API from scratch.  It turned out that
libmygpo-qt has several critical bugs, and there's no response to pull
requests upstream.  So using that library was not an option.

The implementation into kasts consists of the following:
- Can sync with gpodder.net or with a nextcloud server that has the
  nextcloud-gpodder app installed.  (This app is mostly API compatible
  with gpodder.)
- Passwords are stored using qtkeychain.  If the keychain is
  unavailable it will fallback to file.
- It syncs podcast subscriptions and episode play positions, including
  marking episodes as played. Episodes that have a non-zero play
  position will be added to the queue automatically.
- It will check for a metered connection before syncing.  This is
  coupled to the allowMeteredFeedUpdates setting.
- Full synchronization can be performed either manually (from the
  settings page) or through automatic triggers: on startup and/or on
  feed refresh.
- There is an additional possibility to trigger quick upload-only syncs
  to make sure that the local changes are immediately uploaded to the
  server (if the connection allows).  This will trigger when
  subscriptions are added or removed, when the pause/play button is
  toggled or an episode is marked as played.
- This implements a few safeguards to avoid having multiple feed URLS
  pointing to the same underlying feed (e.g. http vs https).  This
  solves part of #17

Solves #13
2021-10-29 18:47:55 +02:00
Tobias Fella
fc6969e018 Implement network status checking on android
Replaces the whole thing with the solidextras implementation found in
itinerary
2021-10-09 19:32:28 +00:00
Bart De Vries
de954f644a Fix issues with cached images being accessed while the download is still running 2021-10-06 19:16:06 +00:00
Bart De Vries
c061a01c59 Wrap feed update routine in KJob and make it more efficient
The feed update routine which is now spread over several methods
in Fetcher, is now put into a self-contained KJob.  This will allow
to re-use this job later on in e.g. gpodder sync, where it's
required to update feeds before syncing episode statuses.

This also makes the feed update abortable.

Lastly, but most importantly, the feed update procedure has been
optimized to minimize database transactions, resulting in a dramatic
speed-up.  This is especially true for importing new feeds, which
will now be at least 5x faster on slow hardware.
2021-10-01 22:36:42 +02:00
Swapnil Tripathi
a141cda44a Add chapter marks 2021-09-21 20:36:54 +00:00
Bart De Vries
117f314d0d Move models to dedicated directory 2021-09-18 19:07:15 +02:00
Bart De Vries
0b33c62a10 Select first enclosure if entry has multiple enclosure entries
Kasts can currently only handle one enclosure per entry.  In case an
entry/item has multiple enclosures, it's probably safe to assume that the
first one is the one that's preferred by the author.

CCBUG: 440389
2021-07-30 14:20:51 +02:00
Bart De Vries
6eb13167f2 Fix bug with feeds with multiple enclosures per entry
BUG: 440389
2021-07-30 08:44:43 +02:00
Bart De Vries
a15e2dbe5d Make storage path configurable
This adds a new setting to the Settings page.
Existing enclosures and images will be moved to the new location
(first copied, then deleted in the original location).  If any of
the copy actions fail, the operation is aborted and the original
path is restored.
The StorageMoveJob is set up in such a way that it's easy to add other
files or subfolders in the future.

Solves #15
2021-07-24 20:43:11 +02:00
Bart De Vries
b9b82d783f Also add title argument to Error elsewhere 2021-07-14 22:32:14 +02:00
Bart De Vries
9621919310 Use correct version number in user agent header 2021-07-13 16:27:27 +02:00
Bart De Vries
d0bc5b2b26 Add capability to check whether network connection is metered
For now this only works with NetworkManager.  The related settings are
greyed out on systems not using NetworkManager.

Some details of the implementation:
- Implement settings in the settings menu to enable/disable feed
  updates, episode downloads and/ or image downloads on metered
  connections.  If the option(s) is disabled, an overlay dialog is shown
  with options to "not allow", "allow once", or "allow always".
- If the network is down, no attempt is made to download images and the
  fallback image will be used until the network is up again.
  This also solves an issue where the application hangs when the network
  is down and feed images have not been cached yet.
- Next to this, part of the cachedImage implementation in Entry and Feed
  has been refactored to re-use code as part of the image() method in
  Fetcher.
- In case something unexpected happens, an error will be logged.
2021-07-03 20:20:27 +02:00
Bart De Vries
bcafb26c8c Add filesize units to download progress
This adds the currently downloaded size and the total enclosure size to
the entry delegate.
2021-06-24 17:12:07 +02:00
Bart De Vries
f197e6ab02 Implement Enclosure::PartiallyDownloaded status
Still to be done:
- Update Download Page to show partial downloads.
- Connect signals to Download Page to update whenever an enclosure
  changes status.  This is broken by this commit because
  downloadCountChanged has been removed.
2021-06-23 23:04:18 +02:00
Bart De Vries
03081edc66 Improve estimate of enclosure download size, also when resuming 2021-06-23 22:29:15 +02:00
Bart De Vries
49977adc38 Refactor Error implementation and add Error::Type
- This refactoring also includes a cleanup of a lot of header includes to
  avoid circular dependencies.
- The error message will now be shown below the info message.
- Add database migration (for Errors)
2021-06-19 17:09:44 +02:00
Bart De Vries
26d3755922 Use debug categories in fetcher.cpp for partial downloads 2021-06-11 20:30:15 +02:00
Bart De Vries
a24fb7d731 Get correct enclosure file size as soon as possible when download starts 2021-06-11 16:59:03 +02:00
Bart De Vries
d24b7ed7d0 Write downloads to disk and enable download resume
This enables the download method in Fetcher to resume in case a partial
download is already saved to disk.
For full implementation of download resumes, more changes are required,
because the current application will automatically clean up files that
don't match the expected size at startup.
2021-06-11 16:59:03 +02:00
Bart De Vries
2ed33aa750 Add debugging logging categories 2021-06-05 22:03:22 +02:00
Bart De Vries
9c83ee08e8 Show BusyIndicator on newly added feeds until they have finished updating 2021-05-08 16:13:28 +02:00
Bart De Vries
cfae4a9fa9 Defer resetting the new flag on feeds until everything's been processed
Resetting the flag immediately can lead to situations where all entries
of a new feed are marked as new if the initial feed import gets
interrupted somehow.  E.g. when the user quits the application while
doing an initial import.
2021-05-07 10:26:58 +02:00
Bart De Vries
8e3a688ddf Don't mark any episodes as new when adding new feeds
Tobias was right; marking one (or more) episodes as "new" on a new feed
doesn't make a lot of sense.  The latest episode from some podcast feeds
can be very old.  Besides, it's quite annoying having a lot of episodes
queued automatically...
2021-05-05 14:04:47 +02:00
Bart De Vries
1c44e717ae Renaming alligator to kasts everywhere 2021-05-03 22:31:45 +02:00
Bart De Vries
1b1654d1f4 Apply clang-format 2021-05-01 21:35:37 +02:00
Bart De Vries
d1618943f5 Update based on review by Tobias Fella 2021-05-01 21:09:07 +02:00
Bart De Vries
4aa2f14eb7 Apply 50 suggestion(s) to 19 file(s) 2021-05-01 18:59:08 +00:00
Bart De Vries
02e92f9a8f Remove numberNewEpisodes from settings
Also clean up the unused allowStreaming setting
2021-04-27 20:58:01 +02:00
Bart De Vries
f2c6c3fae2 Avoid race condition when adding feed
When adding a feed and simultaneously starting a feed update, a race
condition could happen where the feed update would catch up with the
feed adding, and start adding and marking old episodes as new before
the original addFeed method would reach them.
2021-04-26 16:58:22 +02:00
Bart De Vries
5a0972372b Add ErrorModel, just a placholder GUI for now 2021-04-24 23:32:10 +02:00
Bart De Vries
695baf9cbb Add fetch function that can take a list of urls 2021-04-21 14:53:03 +02:00
Bart De Vries
28e8051500 Implement update status progress indicator 2021-04-21 14:53:03 +02:00
Bart De Vries
53e2560796 Implement backend for feed update progress 2021-04-21 14:53:03 +02:00
Bart De Vries
6a256baa18 Disable more debug output
Disable in fetcher and datamanager
2021-04-21 14:53:03 +02:00
Bart De Vries
68771f4911 Solve problem in logic where it would only fetch the first new episode 2021-04-21 14:53:03 +02:00
Bart De Vries
a45351e1de Make entry models only update if something really changed 2021-04-21 14:53:03 +02:00
Bart De Vries
7ebfebe01e Fix potential issue with processing update of authors 2021-04-21 14:53:03 +02:00
Bart De Vries
ae13eb8cfd Begin refactoring feed updating routines for speed
Make sure that property change signals are only emitted when something
has really changed.  So far part "feed" has been done.  Entries,
enclosures and entry authors still need to be done.
2021-04-21 14:53:03 +02:00
Bart De Vries
e9d20ec569 Implement Downloads page
This change includes an update to the database, adding a downloaded
column in Enclosures.
2021-04-21 14:53:03 +02:00
Bart De Vries
16c052250c Make main thread more responsive when updating feeds 2021-04-21 14:53:02 +02:00
Bart De Vries
65ef16017b Rename AlligatorSettings to SettingsManager 2021-04-21 14:53:02 +02:00
Bart De Vries
a8e174739f Implement "new" episodes feature and autoQueue 2021-04-21 14:53:02 +02:00
Bart De Vries
26986616c7 Only mark episodes as read/new on new feeds, not on existing ones 2021-04-21 14:53:02 +02:00
Bart De Vries
3a4cdbfec0 Implement limited number of new entries for new feed 2021-04-21 14:53:02 +02:00
Bart De Vries
e85a3068fc Add check whether to insert or update enclosure to database 2021-04-21 14:53:02 +02:00
Bart De Vries
5d6f05e55e Update copyright headers 2021-04-21 14:53:02 +02:00
Bart De Vries
59da275f0e Completely fix author update on feed refresh/add 2021-04-21 14:53:02 +02:00
Bart De Vries
e092354696 Partially solve adding author for feed 2021-04-21 14:53:02 +02:00
Bart De Vries
75f8f93da7 Change paths where images and enclosures are saved
Images are now stored in the cache directory in a dedicated subdir
called "images".
Enclosures are stored in the data directory in a dedicated subdir
"enclosures".
2021-04-21 14:53:02 +02:00
Bart De Vries
06bffdb5e3 Add "new" and "playposition" to database
These fields have been added to, respectively, Entries and Enclosures.
2021-04-21 14:53:02 +02:00