Pregunta

Estoy escribiendo un plugin Rhythmbox para iterar sobre todos los archivos de podcast Actualmente se sabe que Rhythmbox (ya sea descargado o no) y hacer algo con ellos.

Después de algunas investigaciones y pruebas en Python Shell del Rhythmbox, tuve éxito para obtener una lista de todos los objetos. Sin embargo, cuando codificado en un plugin, me sale un error:

(rhythmbox:7500): GLib-GObject-WARNING **: invalid cast from `RhythmDBTree' to `RhythmDBEntryType'

y la lista está vacía entries:

def run(self, action, shell):
    db = shell.get_property('db')
    entry_type = db.entry_type_get_by_name('podcast-post')
    print entry_type
    entries = []
    db.entry_foreach_by_type(entry_type, entries.append)
    print entries

Sin embargo, los rendimientos print entry_type:. <rhythmdb.EntryType object at 0xa7ea34c (RhythmDBEntryType at 0xa106988)>, por lo que el objeto db es aparentemente válida

¿Qué estoy haciendo mal?

¿Fue útil?

Solución 2

I tried the following:

def run(self, action, shell):
    db = shell.get_property('db')
    entry_type = db.entry_type_get_by_name('podcast-post')
    print entry_type
    entries = []
    db.entry_foreach(entries.append)
    print entries
    for entry in entries:
        if entry.get_type() == entry_type:
            # process entry...

and it works correctly. Well, not the most beautiful solution, but it is OK for my needs.

Otros consejos

First try to reinstall rhythmbox.

See what this outputs, it runs fine on my machine, post what this outputs on your machine

from __future__ import print_function

def plugin_create(database):
    print(database)
    db.entry_foreach_by_type(db.entry_type_get_by_name('podcast-post'), print)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top