Skip to content

Instantly share code, notes, and snippets.

@oubiwann
Created October 14, 2012 01:34
Show Gist options
  • Select an option

  • Save oubiwann/3886915 to your computer and use it in GitHub Desktop.

Select an option

Save oubiwann/3886915 to your computer and use it in GitHub Desktop.
Python and Rhythmbox
source_list = shell.get_property("sourcelist")
library, playlists = source_list.get_property("model")
for child in library.iterchildren():
x1, pixbuf, name, source, pango_attrs, x2, x3, enum = child
if name == "Import Errors":
import_errors = source
elif name == "Missing Files":
missing_files = source
fh = open("/tmp/missing_files.txt", "w+")
query_model = missing_files.get_property("query-model")
for entry, count in query_model:
data = entry.get_playback_uri().replace("file://", "")
fh.write("%s\n" % data)
fh.close()
db = shell.get_property("db")
qm = import_errors.get_property("query-model")
fh = open("/tmp/import_errors.txt", "w+")
for entry, count in qm:
location = db.entry_get(entry, rhythmdb.PROP_LOCATION).replace("file://", "")
error = db.entry_get(entry, rhythmdb.PROP_PLAYBACK_ERROR)
fh.write('%s "%s"\n' % (location, error))
fh.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment