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 338308 - Install needed plugins when metadata load fails.
Install needed plugins when metadata load fails.
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: Importing
HEAD
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
: 498840 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-04-13 06:56 UTC by James "Doc" Livingston
Modified: 2007-11-21 21:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to add hooks. (10.08 KB, patch)
2006-04-13 07:03 UTC, James "Doc" Livingston
none Details | Review
gst-plugin-install-apt.py (4.04 KB, text/x-python)
2006-04-17 11:38 UTC, James "Doc" Livingston
  Details
patch (18.48 KB, patch)
2006-04-23 09:35 UTC, James "Doc" Livingston
none Details | Review
update to cvs. (18.92 KB, patch)
2006-05-26 05:00 UTC, James "Doc" Livingston
none Details | Review
it works.. (36.58 KB, patch)
2007-09-04 14:00 UTC, Jonathan Matthew
none Details | Review
add playback and podcast download hooks (65.62 KB, patch)
2007-10-25 14:13 UTC, Jonathan Matthew
needs-work Details | Review
better (66.26 KB, patch)
2007-11-04 15:00 UTC, Jonathan Matthew
none Details | Review
slightly better again (66.83 KB, patch)
2007-11-11 07:30 UTC, Jonathan Matthew
committed Details | Review

Description James "Doc" Livingston 2006-04-13 06:56:37 UTC
It would be good to automagically install the necessary gstreamer plugins when we can't decode a file. Exactly how to do this will be distro-specific, so we really just need to provide the necessary hooks to allow it.
Comment 1 James "Doc" Livingston 2006-04-13 07:03:16 UTC
Created attachment 63360 [details] [review]
patch to add hooks.

This adds an "import-error" signal which can be used to absorb import errors, and install plugins.

How it would get used:

a) write a plugin that connects to the db's "import-error" signal
b) in the signal handler, lookup the mimetype in the plugins mimetype->gst_plugin map
c) if it isn't in the map, or the plugin is installed, return false to continue normal import error processing
d) store the data somewhere, and return true to stop normal import error processing
e) install the gstreamer plugin
f) ask gstreamer to check for new plugins
g) use the info stored in (d) to call rhythmdb_add_uri (uri, entry_type) again


(e) is the only bit that is really distro-specific, and I'm not sure how (or if) we can do (f).
Comment 2 James "Doc" Livingston 2006-04-17 11:38:13 UTC
Created attachment 63691 [details]
gst-plugin-install-apt.py

Python plugin to use these to automagically install needed plugins with apt. I don't know if there is a way to get GStreamer to re-scan for new plugins, so you have to restart RB and import again once it has done installing. If there is a way to do that, it should automatically re-try the import once the install has been completed.
Comment 3 James "Doc" Livingston 2006-04-23 09:35:48 UTC
Created attachment 64133 [details] [review]
patch

This patch adds the requires hooks and a plugin that works for me on Ubuntu Dapper. It currently doesn't work with the metadata helper turned on, because that doesn't send the mime-type with the load error.

Adding support for other distros or install methods is simply a matter of adding a new subclass. I'm not sure how it is best to set up, probably with a configure flag to choose which one to use.
Comment 4 James "Doc" Livingston 2006-05-26 05:00:53 UTC
Created attachment 66242 [details] [review]
update to cvs.

Updated to cvs.

As before it doesn't work with the metadata-helper becuase I haven't figured out how best to send the mimetype with the error.
Comment 5 James "Doc" Livingston 2006-06-07 06:39:55 UTC
Marking as enhancement
Comment 6 James "Doc" Livingston 2006-06-20 04:37:37 UTC
http://devel.linux.duke.edu/cgi-bin/viewcvs.cgi/yum-utils/yumdownloader.py?revision=1.10&view=markup is probably useful, for anyone who wanted to write a yum backend.
Comment 7 Bastien Nocera 2007-04-10 09:33:22 UTC
This should be using GStreamer's missing plugins support instead. Totem already implements this.
Comment 8 Tim-Philipp Müller 2007-04-10 10:11:05 UTC
It's a lot easier to do in Totem though than it is for Rhythmbox, because Totem doesn't have a decoupled importer. I started implementing this at same point based on the code above, but gave up when it became clear it wouldn't be finished in time for the release/feature freeze. I'll have a look to see how much of my half-finished patch still applies though.
Comment 9 Jonathan Matthew 2007-08-27 14:27:33 UTC
I've started working on this a bit, using the Totem code as a base.  It shouldn't be too hard to get it working for import and playback situations, but tag writing and (especially) encoding will be more difficult.
Comment 10 Jonathan Matthew 2007-09-04 14:00:49 UTC
Created attachment 94933 [details] [review]
it works..

This only works if you're importing a single file.  It needs to block further imports until the plugin installation finishes.  It seems to break ignoring of non-audio files a bit too.
Comment 11 Jonathan Matthew 2007-10-25 14:13:31 UTC
Created attachment 97846 [details] [review]
add playback and podcast download hooks

The playback side of things is pretty simple, in the end.
Comment 12 James "Doc" Livingston 2007-10-28 09:55:17 UTC
It looks okay to me, although shouldn't there be an i++ somewhere in the loop in emit_missing_plugins()?

The dialog provided by Ubuntu's codec-buddy can be a bit confusing some times, but there isn't much we can do about it. It told me "you need to install a codec to play this file" while I was already listening to some music, because the library watching noticed a new file.
Comment 13 Martin Ejdestig 2007-10-28 10:19:48 UTC
(In reply to comment #12)
> The dialog provided by Ubuntu's codec-buddy can be a bit confusing some times,
> but there isn't much we can do about it. It told me "you need to install a
> codec to play this file" while I was already listening to some music, because
> the library watching noticed a new file.

File a bug? :)
Comment 14 Jonathan Matthew 2007-11-04 11:40:46 UTC
This manages to deadlock itself if you hit two files in a row that have missing plugins.  The locking used to block importing while processing missing plugins is too racy.

And yes, there should have been an i++ in the loop in emit_missing_plugins().
Comment 15 Jonathan Matthew 2007-11-04 15:00:14 UTC
Created attachment 98514 [details] [review]
better

Now with well-behaved locking.  

I think the changes in rb-metadata-gst.c have some slightly bad side effects relating to plain text or nearly-plain text files.
Comment 16 Jonathan Matthew 2007-11-11 07:30:48 UTC
Created attachment 98905 [details] [review]
slightly better again

I think this fixes ignorable file types a bit better.  Stops us requesting 'application/xml decoder' plugins, at least.

It doesn't seem to retry importing files after installing plugins correctly.

Has anyone tried this on a fedora system, or indeed anything other than debian/ubuntu?
Comment 17 Alex Lancaster 2007-11-11 09:55:14 UTC
(In reply to comment #16)

> Has anyone tried this on a fedora system, or indeed anything other than
> debian/ubuntu?

Just tried this on Fedora 7, if I double-click a file with a missing plugin, I see the following on the console, but nothing else (e.g. any kind of GUI selector) appears:

Rhythmbox-Message: Missing plugin: gstreamer|0.10|rhythmbox|MPEG-1 Layer 3 (MP3) decoder|decoder-audio/mpeg, mpegversion=(int)1, layer=(int)3, parsed=(boolean)true
Rhythmbox-Message: Automatic missing codec installation not supported (helper script missing)

What is supposed to happen?  Is the codec-buddy an Ubuntu/Debian-specific thing?
Comment 18 Alex Lancaster 2007-11-11 09:59:22 UTC
On Fedora, a (possible) equivalent to the codec-buddy on Ubuntu is this:

http://fedoraproject.org/wiki/Multimedia/Codeina
Comment 19 Alex Lancaster 2007-11-11 10:41:14 UTC
With codeina installed, installing Fluendo plugins for (say) MP3, works if you try to playback an MP3 file without gstreamer-plugins-ugly (say).  

The playback seemed to be a bit odd with the fluendo plugin, but that's not rhythmbox's fault.
Comment 20 Jonathan Matthew 2007-11-12 11:57:49 UTC
I've committed this to svn.  Thanks for testing.
Comment 21 Jonathan Matthew 2007-11-21 21:57:32 UTC
*** Bug 498840 has been marked as a duplicate of this bug. ***