def setup_features(self): try: session = WebKit.get_default_session() session.connect('request-queued', self.on_session_request_queued) cookie = Soup.CookieJarText( filename=os.path.join(CONFIG_ROOT, 'cookies')) session.add_feature(cookie) self._cache = Soup.Cache(cache_dir=os.path.join( CONFIG_ROOT, 'cache'), cache_type=Soup.CacheType.SHARED) session.add_feature(self._cache) self._cache.set_max_size(10 * 1024 * 1024) self._cache.load() except Exception, e: log.error("setup_features failed with %s" % e)
return key = parameters.get_child_value(1).get_string() if key == 'Play': self.web_view.execute_script('aurena.playPause()') if key == 'Next': self.web_view.execute_script('aurena.next()') if key == 'Previous': self.web_view.execute_script('aurena.previous()') def title_changed(self, view, frame, title): if frame == view.get_main_frame(): self.set_title(title) # make a data dir for this app data_dir = os.path.join(GLib.get_user_data_dir(), 'aurena') if not os.path.exists(data_dir): os.makedirs(data_dir) # put cookies in it cookie_jar = os.path.join(data_dir, 'cookies.txt') jar = Soup.CookieJarText(filename=cookie_jar) session = WebKit.get_default_session() session.add_feature(jar) w = AurenaWindow() w.show() w.connect('destroy', lambda w: Gtk.main_quit()) Gtk.main()