After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 323440 - Library directory concept should ignore the podcasts directory
Library directory concept should ignore the podcasts directory
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: Podcast
HEAD
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
: 409575 437701 447685 463685 (view as bug list)
Depends on:
Blocks: 357768
 
 
Reported: 2005-12-07 09:17 UTC by Bastien Nocera
Modified: 2015-11-14 16:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Ignore the podcasts under the music directory (5.70 KB, patch)
2008-09-07 01:06 UTC, Bastien Nocera
rejected Details | Review
Better version (10.75 KB, patch)
2008-09-07 01:39 UTC, Bastien Nocera
none Details | Review
Updated (11.52 KB, patch)
2008-09-07 13:20 UTC, Bastien Nocera
none Details | Review
Done properly (17.43 KB, patch)
2008-09-08 22:02 UTC, Bastien Nocera
none Details | Review
Upgrade the database as well (19.42 KB, patch)
2008-09-09 23:46 UTC, Bastien Nocera
none Details | Review
Mark the entry as not inserted when deleting it (20.32 KB, patch)
2008-09-10 11:35 UTC, Bastien Nocera
none Details | Review
seems to work (17.25 KB, patch)
2008-09-10 13:25 UTC, Jonathan Matthew
none Details | Review
And updated again (19.30 KB, patch)
2008-09-10 13:56 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2005-12-07 09:17:26 UTC
I have my Podcasts under my Music directory:
library: ~/Music
podcasts: ~/Music/Podcasts

And the downloaded Podcasts show up under the library as well as the Podcast
section. They should be ignored.
Comment 1 Christof Damian 2005-12-23 16:34:55 UTC
I think they should be included. If you don't like it move your podcast directory out of the music tree.
Comment 2 lexual 2006-02-08 11:58:16 UTC
My own idea on a solution for this is the idea of having 2 libraries. One for my music collection and one for podcasts.

If I'm listening to my music library on shuffle, it's unlikely that I'll want to listen to a random episode of lugradio. Also, having both podcasts and music in the one library really clogs up the browser.
Comment 3 Jonathan Matthew 2007-02-19 12:50:21 UTC
*** Bug 409575 has been marked as a duplicate of this bug. ***
Comment 4 Jonathan Matthew 2007-06-17 11:10:34 UTC
*** Bug 447685 has been marked as a duplicate of this bug. ***
Comment 5 Jeff Craig 2007-09-28 17:32:30 UTC
I'm of the opinion that this is NOTABUG.  The main library directory is supposed to be automatically scanned for audio files, if the user doesn't want their Podcasts in their main library, they should put the Podcast directory outside of the main library tree.  

It could be implemented to only allow a file to exist in one library at a time, but how do you determine the library precedence?  And what about users who WANT this sort of behaviour?
Comment 6 Bastien Nocera 2008-09-07 01:06:51 UTC
Created attachment 118193 [details] [review]
Ignore the podcasts under the music directory

I don't really like the code in rhythmdb-import-job.c, but it's required to avoid importing existing podcasts.
Comment 7 Bastien Nocera 2008-09-07 01:21:44 UTC
The best way to do this, after talking to Jonathan, would be to swap the location/mountpoint property use for podcasts, and podcasts would simply be ignored as they'd already be in the DB with a different entry type.
Comment 8 Bastien Nocera 2008-09-07 01:39:34 UTC
Created attachment 118194 [details] [review]
Better version

The hard part is, how do we swap the 2 properties in the DB, on startup.
Comment 9 Bastien Nocera 2008-09-07 01:40:17 UTC
And I'm not sure what that's supposed to do either...
↦       ↦       case RHYTHMDB_PROP_MOUNTPOINT:•
↦       ↦       ↦       /* fix old podcast posts */•
↦       ↦       ↦       if (g_str_has_prefix (ctx->buf->str, "http://"))•
↦       ↦       ↦       ↦       skip = TRUE;•
↦       ↦       ↦       break;•
Comment 10 Bastien Nocera 2008-09-07 13:20:37 UTC
Created attachment 118217 [details] [review]
Updated

A patch that compiles. The problem is that the rhythmdb just explodes when adding new podcasts. I think it really doesn't like us using the mountpoint as an identifier...
Comment 11 Jonathan Matthew 2008-09-07 13:59:00 UTC
The location field always needs to be unique across all entries.  I guess we could use the origin location for episodes that haven't been downloaded, replacing it with the download location when we start the download.

(In reply to comment #9)
> And I'm not sure what that's supposed to do either...
> ↦       ↦       case RHYTHMDB_PROP_MOUNTPOINT:•
> ↦       ↦       ↦       /* fix old podcast posts */•
> ↦       ↦       ↦       if (g_str_has_prefix (ctx->buf->str,
> "http://"))•
> ↦       ↦       ↦       ↦       skip = TRUE;•
> ↦       ↦       ↦       break;•

Initially we stored the origin location in the mountpoint property, then replaced it with the downloaded location (sounds familiar..).  This code was added to clean up existing podcast entries.  This was almost three years ago now, so I think we can safely drop it now.
Comment 12 Bastien Nocera 2008-09-08 22:02:01 UTC
Created attachment 118334 [details] [review]
Done properly

The only thing missing is the upgrade code. We need to be able to swap location and mountpoint for podcast-posts when there's both in an entry, and remove normal "song" entries for those same podcasts.

I have no idea how to code that, but I added test code for it...
Comment 13 Jonathan Matthew 2008-09-09 12:20:08 UTC
I guess you'd do that in rhythmdb_tree_parser_end_element under the RHYTHMDB_TREE_PARSER_STATE_ENTRY case.  Since podcast entries are always read after song entries, you could remove song entries just by doing a lookup in ctx->db->priv->entries (like the existing duplicate entry check) and deleting any song entry you find.

It might be worth considering combining the play count and last-played data from the song entry, too, but I don't think that's essential.
Comment 14 Bastien Nocera 2008-09-09 23:46:48 UTC
Created attachment 118398 [details] [review]
Upgrade the database as well

Upgrading now works using test-rhythmdb, need to test the whole solution now.
Comment 15 Bastien Nocera 2008-09-10 11:35:52 UTC
Created attachment 118416 [details] [review]
Mark the entry as not inserted when deleting it

This still doesn't work as expected
Comment 16 Jonathan Matthew 2008-09-10 13:25:54 UTC
Created attachment 118427 [details] [review]
seems to work

The inserted flag is set in process_added_entries_cb, so it needs to be cleared in process_deleted_entries_cb.  This works in the very limited test setup I had.
Comment 17 Bastien Nocera 2008-09-10 13:56:36 UTC
Created attachment 118429 [details] [review]
And updated again
Comment 18 Bastien Nocera 2008-09-11 16:04:43 UTC
2008-09-11  Bastien Nocera  <hadess@hadess.net>

	* podcast/rb-feed-podcast-properties-dialog.c
	(rb_feed_podcast_properties_dialog_update_location):
	* podcast/rb-podcast-manager.c (get_download_location),
	(set_download_location), (get_remote_location),
	(rb_podcast_manager_download_entry),
	(rb_podcast_manager_entry_downloaded),
	(rb_podcast_manager_head_query_cb), (download_error),
	(rb_podcast_manager_next_file), (download_file_info_cb),
	(rb_podcast_manager_save_metadata), (download_progress),
	(podcast_download_thread), (end_job), (cancel_job),
	(rb_podcast_manager_db_entry_deleted_cb),
	(remove_if_not_downloaded):
	* podcast/rb-podcast-properties-dialog.c
	(rb_podcast_properties_dialog_update_location),
	(rb_podcast_properties_dialog_update_download_location):
	* rhythmdb/rhythmdb-tree.c (rhythmdb_tree_parser_start_element),
	(rhythmdb_tree_parser_end_element):
	* rhythmdb/rhythmdb.c (process_deleted_entries_cb):
	Forbid podcasts from showing up in the main library, by using
	the local download location to identify the file as soon as we start
	downloading it (Closes: #323440)

	* tests/podcast-upgrade.xml:
	* tests/test-rhythmdb.c (START_TEST), (rhythmdb_suite), (main):
	Add a test for the database upgrade code above
Comment 19 Jonathan Matthew 2008-10-08 09:58:32 UTC
*** Bug 437701 has been marked as a duplicate of this bug. ***
Comment 20 Jonathan Matthew 2008-10-08 09:59:23 UTC
*** Bug 463685 has been marked as a duplicate of this bug. ***