Exemplo n.º 1
0
def do_import(parent, library):
    db_path = expanduser(BansheeImport.USR_PATH)

    importer = BansheeDBImporter(library)
    try:
        db = sqlite3.connect(db_path)
        importer.read(db)
        db.close()
    except sqlite3.OperationalError:
        msg = _("Specified Banshee database is malformed or missing")
        WarningMessage(parent, BansheeImport.PLUGIN_NAME, msg).run()
    except Exception:
        util.print_exc()
        importer.finish()
        msg = _("Import Failed")
        # FIXME: don't depend on the plugin class here
        ErrorMessage(parent, BansheeImport.PLUGIN_NAME, msg).run()
    else:
        count = importer.finish()
        msg = ngettext(
            "Successfully imported ratings and statistics for %d song",
            "Successfully imported ratings and statistics for %d songs",
            count) % count
        Message(Gtk.MessageType.INFO, parent, BansheeImport.PLUGIN_NAME,
                msg).run()
Exemplo n.º 2
0
def do_import(parent, library):
    db_path = expanduser("~/.local/share/rhythmbox/rhythmdb.xml")
    handler = RBDBContentHandler(library)
    try:
        xml.sax.parse(db_path, handler)
    except Exception:
        util.print_exc()
        handler.finish()
        msg = _("Import Failed")
        # FIXME: don't depend on the plugin class here..
        ErrorMessage(parent, RBImport.PLUGIN_NAME, msg).run()
    else:
        count = handler.finish()
        msg = _("Successfully imported ratings and statistics "
                "for %d songs") % count
        # FIXME: this is just a warning so it works with older QL
        WarningMessage(parent, RBImport.PLUGIN_NAME, msg).run()
Exemplo n.º 3
0
def do_import(parent, library):
    plist_path = expanduser("~/Music/iTunes/iTunes Music Library.xml")
    importer = iTunesimporter(library)
    try:
        plist = plistlib.readPlist(plist_path)
        importer.read(plist)
    except Exception:
        util.print_exc()
        importer.finish()
        msg = _("Import Failed")
        # FIXME: don't depend on the plugin class here..
        ErrorMessage(parent, iTunesImport.PLUGIN_NAME, msg).run()
    else:
        count = importer.finish()
        msg = _("Successfully imported ratings and statistics "
                "for %d songs") % count
        # FIXME: this is just a warning so it works with older QL
        WarningMessage(parent, iTunesimport.PLUGIN_NAME, msg).run()
Exemplo n.º 4
0
 def test_ctr(self):
     WarningMessage(None, "title", "description").destroy()
Exemplo n.º 5
0
 def _warning_nothing_to_import(self):
     WarningMessage(
         app.window, _("Nothing to import"),
         _("You have to export something before you can import."))