Created
October 14, 2012 01:34
-
-
Save oubiwann/3886915 to your computer and use it in GitHub Desktop.
Python and Rhythmbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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