Exemple #1
0
    def simple_database_downloader(self, force_jamendo=False):
        dia = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, 0, _("Downloading database dump from Jamendo right now. Please be patient.\n\nFor more information please run Pyjama from console.\n\nThis might take up to a minute"))
        dia.show()
        self.window.do_events()
        dump = update.dump_tools()
        dump.delete_db()
        dump.create_tables()
        ret = dump.create_db(force_jamendo)
        if ret == "nofile":
            if force_jamendo:
                 self.Events.raise_event("error", None, "Error downloading the database dump from jamendo. Please try again later and notify me about this.")
            else:
                self.Events.raise_event("error", None, "Error downloading the database dump from the mirror.\nPlease try running 'pyjama --update-jamendo' in order to get the database right from jamendo.")
            dia.destroy()
            return
        dump.finish()
        dia.destroy()

        self.db = dbthreaded.DB(self)
        self.window.sbStatus.set_text("Counter", _("Artists: %i, Albums: %i, Tracks: %i") % (self.db.artists, self.db.albums, self.db.tracks))
Exemple #2
0
    def __init__(self, parent, options):
        ## Holds a bool indicating if pyjama is running verbose
        self.verbose = options.verbose
        ## Holds a bool indicating if pyjama is running in debugging mode
        self.debug = options.debug
        ## Holds a bool indicating if pyjama is running in debugging extreme mode
        self.debug_extreme = options.debug_extreme
#        self.print_tracebacks = options.print_tracebacks
        
        ## Hold pyjama's current version
        self.version = functions.VERSION
        if GNOME_UI_AVAILABLE:
            gnome.init("Pyjama", self.version)
        print "PYJAMA FOUND IN %s" % functions.install_dir()


        ## In some cases to many windows pop up on pyjama's
        # startup. If you want to popup a message on startup
        # please wait until need_attention is False!
        self.need_attention = False

        ## Pyjama's Event class
        self.Events = clEvent.Events()
        # Create some events:
        self.Events.add_event("pluginloaded")
        self.Events.add_event("nowplaying")
        self.Events.add_event("alldone")
        self.Events.add_event("showing_album_page")
        self.Events.add_event("showing_artist_page")
        self.Events.add_event("firstrun")
        self.Events.add_event("error")
        self.Events.add_event("info")
        self.Events.add_event("info")
        self.Events.add_event("layout_changed")
        self.Events.add_event("populate_listmenu")
        self.Events.add_event("populate_playlistmenu")
        self.Events.add_event("scrolled_window_resized")
        self.Events.add_event("playlist_tooltip")
        self.Events.add_event("quit")
        self.Events.add_event("albuminfo_created")
        self.Events.add_event("hide_controls")
        self.Events.add_event("show_controls")


        ## Connect to some events
        self.Events.connect_event("pluginloaded", self.ev_plugin_loaded)
        self.Events.connect_event("error", self.error)
        self.Events.connect_event("info", self.info)
        
        self.home_fkt = self.go_home_fkt

        ## Pyjama's Settings class
        # Use for simple general settings
        # data will be stored in a pyjama.cfg
        self.settings = clSettings.settings(self)

        ## Pyjama's database setting class
        # Use this, if you need to store many
        # values.
        self.settingsdb = dbthreaded.DB_Settings(self)
#        self.settingsdb = clDB.DB_Settings(self)
        ## Database class  clDB.DB
        self.db = dbthreaded.DB(self)
#        self.db = clDB.DB(self)

        ## Some database-dump tools
        self.dump_tools = download_db.dump_tools(self)
        ## The clWindow.gtkWIN reference 
        self.window = parent
        ## The notification TrayIcon class notification.TrayIcon
        self.icon = notification.TrayIcon(self)
        ## The Audio class clGstreamer010.Player
        self.player = PLAYER.Player(self, sink=self.__get_audio_interface())
        ## Pyjama's class for jamendo's get2 api clJamendo.Jamendo
        self.jamendo = clJamendo.Jamendo(self)
        ## The browser class clBrowserInterfacce.Browser for handling
        # different browser calls
        self.browser = clBrowserInterface.Browser(self)
        ## Pyjama's clLayouts.Layouts is referenced here
        # it is most important for anything to show up in the
        # main paned field
        self.layouts = clLayouts.Layouts(self)
        ## Preferences
        self.preferences = clPreferences.Preferences(self)

        if XMLRPC_AVAILABLE:
            self.xmlrpc = clXMLRPC.XMLRPC(self)
        
            for item in sys.argv:
                if item.endswith(".m3u"):
                    if self.xmlrpc.role == "client":
                        try:
                            self.xmlrpc.server.test("test123")
                        except Exception, inst:
                            print ("Could not connect to server: %s" % inst)
                            break