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 503343 - Can't load playlist files
Can't load playlist files
Status: RESOLVED FIXED
Product: gnome-python-desktop
Classification: Deprecated
Component: general
2.20.x
Other All
: High major
: ---
Assigned To: Serpentine Maint
Serpentine Maint
Depends on: 536060
Blocks:
 
 
Reported: 2007-12-13 00:33 UTC by Sam Morris
Modified: 2008-08-31 20:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sam Morris 2007-12-13 00:33:09 UTC
Please describe the problem:
Serpentine can't load playlist files. The following exception is thrown each time the 'entry-parsed' signal is fired:

Traceback (most recent call last):
  • File "/usr/lib/python2.4/site-packages/serpentine/plugins/plugfilter_plparser.py", line 42 in _on_entry_parsed
    val = data[src_key]
TypeError: unsubscriptable object

Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?
Yes

Other information:
Forwarded from http://bugs.debian.org/455506
Comment 1 Sam Morris 2008-03-15 12:36:59 UTC
def _on_entry_parsed(self, parser, uri, data, hints_list):
        hints = {'location': uri}

        for src_key, dst_key in (('title', 'title'), ('author', 'artist')):
            val = data[src_key]
            if val is not None:
                data[dst_key] = val

        hints_list.append(hints)

It appears that type(data) == <type 'gobject.GPointer'>. Which can not be used as a list.
Comment 2 Sam Morris 2008-03-15 12:43:51 UTC
From totem-pl-parser.h:

	/* signals */
	void (*entry_parsed) (TotemPlParser *parser,
			      const char *uri,
			      GHashTable *metadata);

So it looks like the GHashTable is not being converted into a dict-like object as Serpentine expects. Maybe this is a bug in pygtk?
Comment 3 Gustavo Carneiro 2008-06-01 14:02:45 UTC
	/**
	 * TotemPlParser::entry-parsed:
	 * @parser: the object which received the signal
	 * @uri: the URI of the entry parsed
	 * @metadata: a #GHashTable of metadata relating to the entry added
	 *
	 * The ::entry-parsed signal is emitted when a new entry is parsed.
	 */
	totem_pl_parser_table_signals[ENTRY_PARSED] =
		g_signal_new ("entry-parsed",
			      G_TYPE_FROM_CLASS (klass),
			      G_SIGNAL_RUN_LAST,
			      G_STRUCT_OFFSET (TotemPlParserClass, entry_parsed),
			      NULL, NULL,
			      totemplparser_marshal_VOID__STRING_POINTER,
			      G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_POINTER);

It is not possible to wrap this.  There is no runtime information that says the second signal parameter is a GHashTable*.  As far as pygobject knows, the parameter type is void*.

Not make this work, totem-plparser needs to register custom GType for the metadata parameter, and gnome-python-desktop needs to register a to-python conversion handler for that GType.

I don't know why is serpentine expecting a dict; surely this never worked before, so we can't say it's a regression.  Certainly it is not critical.
Comment 4 Gustavo Carneiro 2008-08-22 21:49:08 UTC
I fixed it by mapping into a python dict.  So, sorry but serpentine will have to adapt, I guess.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 5 Gustavo Carneiro 2008-08-31 13:12:11 UTC
(In reply to comment #4)
> I fixed it by mapping into a python dict.  So, sorry but serpentine will have
> to adapt, I guess.
> 
> This problem has been fixed in the development version. The fix will be
> available in the next major software release. Thank you for your bug report.
> 

Damn it! I wrote this code, but instead of committing it I must have accidentally reverted it and now can't find it anywhere :-(
Comment 6 Gustavo Carneiro 2008-08-31 20:09:57 UTC
gjc@dark-tower:gnome-python-desktop$ svn ci -m "[Bug 503343] Can't load playlist files"
Sending        ChangeLog
Sending        totem/plparsermodule.c
Transmitting file data ..
Committed revision 495.