4

私はRhythmboxプラグインを作成して、現在Rhythmboxに認識されているすべてのポッドキャストファイル(ダウンロードされているかどうかに関係なく)を反復処理し、それらを使用して何かを実行します。

RhythmboxのPythonシェルで調査とテストを行った後、すべてのオブジェクトのリストを取得することに成功しました。ただし、プラグインにコーディングすると、エラーが発生します。

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

リストは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

ただし、print entry_typeは:を返す<rhythmdb.EntryType object at 0xa7ea34c (RhythmDBEntryType at 0xa106988)>ため、dbオブジェクトは明らかに有効です。

私は何が間違っているのですか?

4

2 に答える 2

1

まず、rhythmboxを再インストールしてみてください。

これが何を出力するかを見て、私のマシンで正常に動作し、この出力をあなたのマシンに投稿してください

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)
于 2010-09-29T01:19:28.500 に答える
0

私は次のことを試しました:

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...

そしてそれは正しく動作します。まあ、最も美しい解決策ではありませんが、私のニーズには問題ありません。

于 2013-02-26T08:49:53.520 に答える