Commit Graph

101 Commits

Author SHA1 Message Date
Thomas Perl 90b20f2984 Final database module code clean-ups 2010-04-26 23:57:50 +02:00
Thomas Perl 806f219fc7 Special-casing loading of all episodes from DB 2010-04-26 23:01:28 +02:00
Thomas Perl 3d8f369356 New implementation of load_episodes() 2010-04-26 22:38:02 +02:00
Thomas Perl 82262b1aab Special implementation of load_episode() 2010-04-26 22:17:22 +02:00
Thomas Perl 1be902f2ea Quicker saving of downloaded episodes
This temporarily disables updating the M3U files
until we find a more efficient way updating them.
2010-04-26 21:41:50 +02:00
Thomas Perl 5569b8412e Calculate episode stats with a single query 2010-04-26 20:52:16 +02:00
Thomas Perl 47d8231153 Remove dead code (count_* in model.PodcastChannel) 2010-04-26 20:41:08 +02:00
Thomas Perl bb3dda528e Replace fetchall() by iterators where possible 2010-04-26 20:36:52 +02:00
Stefan Koegl dc340c04b4 typo in dbsqlite.delete_channel() 2010-04-25 16:17:15 +02:00
Thomas Perl 5a33ce0353 Refactor database module and add new columns
Clean-up the database module for easier adding and
removal of columns to the podcast and episode tables.

Add time-related information (total time, position and
timestamp for the last position update) to episodes.

Remove the "deleted" column for podcasts and make sure
to remove all "deleted" podcasts and their episodes when
upgrading from an older version of gPodder.
2010-04-24 18:51:19 +02:00
Thomas Perl 2b3a2aa743 Don't mark old episodes as new on update (bug 340)
Another attempt at finally fixing bug 340, but this time I'm pretty sure
that it works, because we are more selective now.

Whenever a new episode appears in the feed, its date is compared to the
date of the newest-known episode in the same feed. If it's more than one
week older than the newest-known episode, it's marked as old by default.

The "one week" value is just a randomly-chosen one to allow for border
cases (like a daily podcast re-issuing an episode of the last few days)
to work correctly and not cause "missing episodes".
2010-03-11 19:41:29 +01:00
Thomas Perl 181564f1b7 Add 2010 to the years in copyright notice
The following command has been used:

grep -r '2005-2009 Thomas Perl and the gPodder Team' * | cut -d: -f1 |
xargs sed -i -e 's/2005-2009 Thomas Perl and the gPodder Team/2005-2010
Thomas Perl and the gPodder Team/g'
2010-01-02 17:35:42 +01:00
Janne Makela e9e4862c8a Add an optional "All episodes" view (bug 60)
Set "podcast_list_view_all" to True to enable.
2009-12-17 12:01:48 +01:00
Thomas Perl f954691797 Remove episodes that have been removed from the feed (bug 458)
Episode that have not been downloaded (or have been
deleted since) and that do not appear in the feed are
now purged from the database after a feed update to
avoid the database getting filled with orphaned episodes.

Based on a patch by Neal Cox.
2009-09-28 15:00:38 +02:00
Thomas Perl 8148074f85 Support for hiding "boring" podcasts in podcast list
This adds a new checkbox in the "View" menu that allows
the user to hide all podcasts in the podcast list for
which the episode list is empty (probably because some
filter is active).
2009-09-01 18:56:30 +02:00
Thomas Perl c0a4c50d5a Delete entries in database when unsubscribing (bug 541)
As long as the "Keep downloaded episodes" checkbox is
not checked, we now delete episodes and the podcast from
the database when unsubscribing from a podcast.

Thanks to slestak989 for reporting this issue.
2009-09-01 15:26:00 +02:00
Morten Nygaard Åsnes b35c3411f3 Re-use existing folder names for podcasts (bug 519)
When looking for a unique foldername, reuse existing
names if they belongs to a deleted channel with a
non-existing download folder.
2009-08-24 00:17:59 +02:00
Thomas Perl b2fc9dc777 Make dependencies on the database object explicit
This allows us to modularize the code later and control
which database object is given to which other object.

It should also allow for easier testing of code parts
because we could use a dummy database object instead of
the real one ;)
2009-08-10 23:40:31 +02:00
Thomas Perl 5d4097ecb6 Refactoring: Database object usage / reference
Minimize the direct usage of the database object to
avoid dependencies between modules. Also clean up some
cruft in the GUI code.
2009-08-10 23:14:35 +02:00
Thomas Perl a031408c1e Strip down libgpodder even further, remove old cruft 2009-08-10 18:32:08 +02:00
Thomas Perl a6b0187797 Initial work on statistics-based update optimizations
Currently for feeds updated in the last 24 hours, we
will try to intelligently skip feed updates based on
the expected publishing date of the next episode per
podcast.

Also, when the last feed updates is only 10 minutes
ago, the update is also skipped.
2009-06-12 02:44:04 +02:00
Thomas Perl 4c7088dfa3 First cut of new feedcore module + related changes
This might break a lot, but it makes feed parsing and
updating so much cleaner, and also helps with error
reporting, because exceptions are bubbled up to the UI.

Removed:

 * Changing feed URL (this introduces too many problems)
 * Support for FTP proxy servers (who uses FTP for podcasts?)
2009-06-12 00:51:13 +02:00
Eric Le Lay 952ea28548 Correct import for pysqlite2 2009-05-10 23:04:36 +02:00
Thomas Perl d6d70e39d5 Bugfixes, API enhancements (episode status) and DB improvements
Fix a bug in gui.py (add URLs without scheme did not work).

Add is_new, is_downloaded and is_deleted as episode attributes.

Make the DB code less locking and don't complain about not being
able to write to the database when only trying to open it.
2009-05-07 18:57:14 +02:00
Thomas Perl e17b413532 Initial version of "gpo" CLI tool and API module
In order to be able to allow for a more generic access
to gPodder's data, we now provide a better CLI interface
that acts like apt-get/svn/git/... and an API module
that will allow developers to integrate gPodder functionality
into their Python applications.
2009-05-07 18:26:12 +02:00
Thomas Perl b1ec8f62e9 Make gPodder more library-like; remove --local
Do not install gettext globally, but have a gettext
function in the gpodder module and import it from all
dependent modules.

Remove the --local command line option and instead
automatically detect if the gpodder script is called
from a source folder (determined by the existence of
"src" and "data" in the parent folder and by the fact
that prefix does not start with '/usr').

Clean up setup.py and use metadata from the module.
2009-05-07 16:26:07 +02:00
Thomas Perl f500f586ca Fix "You must not use 8-bit bytestrings" (bug 375)
This happens for new versions of PySQLite that are available
with Python 2.6 (i.e. Ubuntu Jaunty).

Thanks to Fabian Scherschel and Tyler Rick for reporting this.
2009-03-11 10:18:51 +01:00
Thomas Perl 0cafc12941 Refactor libpodcasts; fix episode dialog
Refactor libpodcasts:
 * Rename podcastChannel to PodcastChannel
 * Rename podcastItem to PodcastEpisode
 * Add a new base class with common functions for
   PodcastChannel/PodcastEpisode
 * Remove unneeded / orphaned functions and properties

Fix the buttons in the episode shownotes dialog when a
new episode finishes downloading by reloading the filename
from the database (so we can display the play button).
2009-03-10 14:59:01 +01:00
Justin Forest 4865917c40 Fix changing podcast URLs.
Fixed the "column url not unique" problem, got rid of an
unnecessary loop through all channels to find the one we
need to relocate.

Also, before the channel is updated from its new URL, old
episodes from this channel which haven't been downloaded
are deleted.

http://bugs.gpodder.org/show_bug.cgi?id=304
2009-02-25 15:02:38 +01:00
nikosapi 2f85ecc1fd Thomas and Justin's proper file and folder names patch
Make the patch work on top of current git HEAD
2009-02-09 18:49:12 +01:00
Thomas Perl 0f226211b5 Update copyright info from 2005-2008 to 2005-2009
As every year, we have to update the year info for
gPodder in all our files throughout the source tree.
2009-02-01 21:22:21 +01:00
Thomas Perl b26187b9af Support umlauts when sorting the podcast list
Transform the string comparison function for sorting
so that Umlauts (ä, ö, ü) are sorted in their respective
alphabetical position and not at the end of the list.
2008-12-25 14:49:43 +01:00
Thomas Perl c807f3691d Faster quit experience by hiding the main window
Hide the main window before starting vacuuming the
database, so it looks like shutdown is blazingly fast
while still allowing for optimizations to complete.
2008-11-19 18:55:59 +01:00
Anders Kvist f3ba748cd3 Allow locking of complete podcast channels (bug 85)
Add a "lock all" option to the main and context menu
for podcast channels that allows to automatically lock
and unlock all episodes in this podcast.
2008-11-19 17:05:19 +01:00
Justin Forest 6272b5dee0 VACUUM the database when gPodder is closed. 2008-11-19 16:48:03 +01:00
Justin Forest a4f2fd1f3f A new way of creating tables and adding fields. 2008-11-19 16:47:59 +01:00
Justin Forest 8258b17b6b Fix formatting in SQL logging.
Log messages that included a % sign (such as URLs to
Google Video queries) were treated as format strings.
2008-11-19 16:34:43 +01:00
Justin Forest 1ddb6ff2ef Use uppercase collation names for SQLite (bug 224)
Fix problems with certain distributions/variants of
PySQLite that require collation names to be uppercase.

Thanks to Mehmet Nur Olcay for reporting this bug.
2008-10-23 13:05:05 +02:00
Thomas Perl 1a3ed032a7 Fix trivial bug in database code, introduced by me 2008-10-14 23:04:21 +02:00
Thomas Perl 7567453a97 Simplify database purging code for single channels
Make the purge() function in dbsqlite simpler by only
allowing a single channel to be purged at a time. This
reduces the amounts of SQL queries.
2008-10-14 23:01:20 +02:00
Justin Forest 7fee669127 Add support for SQL module logging
Must be enabled in advanced settings, with the log_sqlite option.
2008-10-14 18:56:52 +02:00
Justin Forest e07d7810ab Properly update existing episodes (bug 211)
New episodes coming from feedparser no longer overwrite
the ones that are already in the database, but update
them properly, keeping states and file size.
2008-10-14 18:55:28 +02:00
Justin Forest f5a00b19e1 Purge old episodes before updating the channel.
Old episodes used to be kept in the database, but not displayed.
This patch removes all episodes beyond the max_episodes_per_feed
limit, which weren't downloaded.
2008-10-14 18:55:11 +02:00
Justin Forest a0b009ba5d Improved startup time by minimizing the number of SQL queries.
channels_to_model() was issuing 3 SQL queries per channel to
get episode statistics (the number of downloaded, new and unplayed
episodes).  This is now done with one query for all channels.
3 temporary views are created when the database is first open.

This not only affects the startup time, but also the time required
to finish a download, change settings -- everything that renews
the list of channels.
2008-10-14 18:54:33 +02:00
Justin Forest c2db36d697 Improve performance by minimizing commits.
Changes to the database are only commited after a channel is added,
updated or when all downloads are finished, but not during episode
related operations.  The threaded feed updater benefits the most
from this change.
2008-10-14 18:38:38 +02:00
Justin Forest 8b4bdc092a Fix for the threading issue (bug 185).
Removed the LockingCursor subclass, added explicit
calls to cur.close() to avoid race conditions.
No more "library routine called out of sequence" errors.
2008-09-22 15:21:23 +02:00
Justin Forest 71144243c8 Thread safe SQLite interaction
Makes the SQLite interaction thread safe, required for threaded
feed updates and other threaded things that are coming.  The changes
are completely internal and do not affect the usage.  Also, some
commit() calls were removed (after selects, where they did nothing).
2008-08-07 15:05:36 +02:00
Justin Forest 55dd7cbb2b Case-insensitive channel sorting
Implemented as a custom collation because the only collation
supported by SQLite natively is binary, which is case-sensitive.
2008-08-07 15:05:27 +02:00
Nick a624fb363f Mon, 14 Jul 2008 15:18:04 -0400 <me@nikosapi.org>
Always show downloaded episodes (Patch from Justin Forest)

	* src/gpodder/dbsqlite.py: Include downloaded episodes even when they 
	go beyond the episode limit.  e.g., when you have 
	gl.max_episodes_per_feed set to 10, but there are 20 downloaded ones
	already.  With this patch, all 20 episodes are displayed.



git-svn-id: svn://svn.berlios.de/gpodder/trunk@771 b0d088ad-0a06-0410-aad2-9ed5178a7e87
2008-07-14 19:36:51 +00:00
Nick c4c7346a88 Sat, 05 Jul 2008 15:23:55 -0400 <me@nikosapi.org>
Support episodes without a guid during migration (patch from Justin Forest)

	* src/gpodder/dbsqlite.py: Don't raise an exception if an episode is
	missing a guid
	* src/gpodder/libpodcasts.py: Make sure that episodes from LocalDBReader
	always contain some kind of guid


git-svn-id: svn://svn.berlios.de/gpodder/trunk@757 b0d088ad-0a06-0410-aad2-9ed5178a7e87
2008-07-05 19:37:04 +00:00
Nick a86b127309 Sun, 29 Jun 2008 16:59:30 -0400 <me@nikosapi.org>
Merge patch from Justin Forest and Thomas Perl:
- Use SQLite instead of cPickle to store all data, including feed summary
and entries, download and play history. 
- Migration assistant to import the old cPickle files in to the SQLite DB
	* src/gpodder/cache.py: SQLite-related accomodations 
	* src/gpodder/console.py: SQLite-related accomodations
	* src/gpodder/dbsqlite.py: New file, SQLite interface for gPodder
	* src/gpodder/gui.py: Lots of changes to accomodate the new SQLite
	DB + new migration assistant code
	* src/gpodder/libgpodder.py: Added gPodderLib.migrate_to_sqlite().
	HistoryStore and ChannelSettings are marked as DEPRECATED
	* src/gpodder/libpodcasts.py: SQLite-related accomodations and new 
	code for setting/determining episode state
	* src/gpodder/sync.py: SQLite-related accomodations
	* src/gpodder/trayicon.py: Use episode.was_downloaded() instead
	of episode.is_downloaded()
	* src/gpodder/util.py: SQLite-related accomodations


git-svn-id: svn://svn.berlios.de/gpodder/trunk@750 b0d088ad-0a06-0410-aad2-9ed5178a7e87
2008-06-30 01:10:18 +00:00