Exemplo n.º 1
0
 def __init__(self, name):
     """
         Init lastfm support
         @param name as str
     """
     self.__name = name
     self.__login = ""
     self.session_key = ""
     self.__password = None
     self.__goa = None
     self.__queue = []
     if name == "librefm":
         LibreFMNetwork.__init__(self)
     else:
         self.__goa = GoaSyncedAccount("Last.fm")
         self.__goa.connect("account-switched",
                            self.on_goa_account_switched)
         if self.is_goa:
             auth = self.__goa.oauth2_based
             self.__API_KEY = auth.props.client_id
             self.__API_SECRET = auth.props.client_secret
         else:
             self.__API_KEY = "7a9619a850ccf7377c46cf233c51e3c6"
             self.__API_SECRET = "9254319364d73bec6c59ace485a95c98"
         LastFMNetwork.__init__(self,
                                api_key=self.__API_KEY,
                                api_secret=self.__API_SECRET)
     self.connect(True)
Exemplo n.º 2
0
 def _connect(self, username, password, populate_loved=False):
     """
         Connect lastfm
         @param username as str
         @param password as str
         @thread safe
     """
     self._username = username
     if self._goa is not None or (password != '' and username != ''):
         self._is_auth = True
     else:
         self._is_auth = False
     try:
         self._check_for_proxy()
         if self._goa is None:
             LastFMNetwork.__init__(
                 self,
                 api_key=self._API_KEY,
                 api_secret=self._API_SECRET,
                 username=self._username,
                 password_hash=md5(password))
         else:
             LastFMNetwork.__init__(
                 self,
                 api_key=self._API_KEY,
                 api_secret=self._API_SECRET,
                 session_key=self._goa.call_get_access_token_sync(None)[0])
         if populate_loved:
             self._populate_loved_tracks()
     except Exception as e:
         print("Lastfm::_connect(): %s" % e)
Exemplo n.º 3
0
 def __init__(self, name):
     """
         Init lastfm support
         @param name as str
     """
     self.__name = name
     self.__login = ""
     self.__is_auth = False
     self.__password = None
     self.__goa = None
     self.__check_for_proxy()
     if name == "librefm":
         LibreFMNetwork.__init__(self)
     else:
         self.__goa = self.__get_goa_oauth()
         if self.__goa is not None:
             self.__API_KEY = self.__goa.props.client_id
             self.__API_SECRET = self.__goa.props.client_secret
         else:
             self.__API_KEY = "7a9619a850ccf7377c46cf233c51e3c6"
             self.__API_SECRET = "9254319364d73bec6c59ace485a95c98"
         LastFMNetwork.__init__(self,
                                api_key=self.__API_KEY,
                                api_secret=self.__API_SECRET)
     self.connect()
Exemplo n.º 4
0
 def _connect(self, username, password, populate_loved=False):
     """
         Connect lastfm
         @param username as str
         @param password as str
         @thread safe
     """
     self._username = username
     if password != "" and username != "":
         self._is_auth = True
     else:
         self._is_auth = False
     try:
         self._check_for_proxy()
         LastFMNetwork.__init__(
             self,
             api_key=self._API_KEY,
             api_secret=self._API_SECRET,
             username=Lp.settings.get_value("lastfm-login").get_string(),
             password_hash=md5(password),
         )
         if populate_loved:
             self._populate_loved_tracks()
     except Exception as e:
         print("Lastfm::_connect(): %s" % e)
Exemplo n.º 5
0
 def __connect(self, username, password, populate_loved=False):
     """
         Connect lastfm
         @param username as str
         @param password as str
         @thread safe
     """
     self.__username = username
     if self.__goa is not None or (password != '' and username != ''):
         self.__is_auth = True
     else:
         self.__is_auth = False
     try:
         self.__check_for_proxy()
         if self.__goa is None:
             LastFMNetwork.__init__(self,
                                    api_key=self.__API_KEY,
                                    api_secret=self.__API_SECRET,
                                    username=self.__username,
                                    password_hash=md5(password))
         else:
             LastFMNetwork.__init__(
                 self,
                 api_key=self.__API_KEY,
                 api_secret=self.__API_SECRET,
                 session_key=self.__goa.call_get_access_token_sync(None)[0])
         if populate_loved:
             self.__populate_loved_tracks()
     except Exception as e:
         debug("Lastfm::__connect(): %s" % e)
         self.__is_auth = False
Exemplo n.º 6
0
 def __init__(self):
     """
         Init lastfm support
     """
     try:
         self._settings = Gio.Settings.new("org.gnome.system.proxy.http")
     except:
         self._settings = None
     LastFMNetwork.__init__(self, api_key=self._API_KEY, api_secret=self._API_SECRET)
     self._username = ""
     self._is_auth = False
     self._password = None
     self._check_for_proxy()
     self.connect(None)
Exemplo n.º 7
0
 def __init__(self):
     """
         Init lastfm support
     """
     try:
         self._settings = Gio.Settings.new('org.gnome.system.proxy.http')
     except:
         self._settings = None
     LastFMNetwork.__init__(self,
                            api_key=self._API_KEY,
                            api_secret=self._API_SECRET)
     self._username = ''
     self._is_auth = False
     self._password = None
     self._check_for_proxy()
     self.connect(None)
Exemplo n.º 8
0
 def __init__(self, name):
     """
         Init lastfm support
         @param name as str
     """
     GObject.Object.__init__(self)
     self.__name = name
     self.__login = ""
     self.session_key = ""
     self.__password = None
     self.__goa = None
     self.__queue_id = None
     try:
         self.__queue = load(
             open(LOLLYPOP_DATA_PATH + "/%s_queue.bin" % self.__name, "rb"))
     except Exception as e:
         Logger.info("LastFM::__init__(): %s", e)
         self.__queue = []
     if name == "librefm":
         LibreFMNetwork.__init__(self)
         Logger.debug("LibreFMNetwork.__init__()")
     else:
         self.__goa = GoaSyncedAccount("Last.fm")
         self.__goa.connect("account-switched",
                            self.on_goa_account_switched)
         if self.is_goa:
             Logger.debug("LastFMNetwork.__init__(goa.)")
             auth = self.__goa.oauth2_based
             self.__API_KEY = auth.props.client_id
             self.__API_SECRET = auth.props.client_secret
         else:
             Logger.debug("LastFMNetwork.__init__(secret)")
             self.__API_KEY = "7a9619a850ccf7377c46cf233c51e3c6"
             self.__API_SECRET = "9254319364d73bec6c59ace485a95c98"
         LastFMNetwork.__init__(self,
                                api_key=self.__API_KEY,
                                api_secret=self.__API_SECRET)
     self.connect()
     Gio.NetworkMonitor.get_default().connect("notify::network-available",
                                              self.__on_network_available)
Exemplo n.º 9
0
 def __init__(self):
     """
         Init lastfm support
     """
     self.__username = ''
     self.__is_auth = False
     self.__password = None
     self.__check_for_proxy()
     self.__goa = self.__get_goa_oauth()
     if self.__goa is None and Lp().settings.get_value('use-librefm'):
         LibreFMNetwork.__init__(self)
     else:
         if self.__goa is not None:
             self.__API_KEY = self.__goa.props.client_id
             self.__API_SECRET = self.__goa.props.client_secret
         else:
             self.__API_KEY = '7a9619a850ccf7377c46cf233c51e3c6'
             self.__API_SECRET = '9254319364d73bec6c59ace485a95c98'
         LastFMNetwork.__init__(self,
                                api_key=self.__API_KEY,
                                api_secret=self.__API_SECRET)
     self.connect(None)
Exemplo n.º 10
0
 def __init__(self):
     """
         Init lastfm support
     """
     self.__username = ''
     self.__is_auth = False
     self.__password = None
     self.__check_for_proxy()
     self.__goa = self.__get_goa_oauth()
     if self.__goa is None and Lp().settings.get_value('use-librefm'):
         LibreFMNetwork.__init__(self)
     else:
         if self.__goa is not None:
             self.__API_KEY = self.__goa.props.client_id
             self.__API_SECRET = self.__goa.props.client_secret
         else:
             self.__API_KEY = '7a9619a850ccf7377c46cf233c51e3c6'
             self.__API_SECRET = '9254319364d73bec6c59ace485a95c98'
         LastFMNetwork.__init__(self,
                                api_key=self.__API_KEY,
                                api_secret=self.__API_SECRET)
     self.connect(None)
Exemplo n.º 11
0
 def __init__(self):
     """
         Init lastfm support
     """
     try:
         self._settings = Gio.Settings.new('org.gnome.system.proxy.http')
     except:
         self._settings = None
     self._username = ''
     self._is_auth = False
     self._password = None
     self._check_for_proxy()
     self._goa = self._get_goa_oauth()
     if self._goa is not None:
         self._API_KEY = self._goa.props.client_id
         self._API_SECRET = self._goa.props.client_secret
     else:
         self._API_KEY = '7a9619a850ccf7377c46cf233c51e3c6'
         self._API_SECRET = '9254319364d73bec6c59ace485a95c98'
     LastFMNetwork.__init__(self,
                            api_key=self._API_KEY,
                            api_secret=self._API_SECRET)
     self.connect(None)
Exemplo n.º 12
0
 def _connect(self, username, password):
     """
         Connect lastfm
         @param username as str
         @param password as str
         @thread safe
     """
     self._username = username
     if password != '' and username != '':
         self._is_auth = True
     else:
         self._is_auth = False
     try:
         self._check_for_proxy()
         LastFMNetwork.__init__(
             self,
             api_key=self._API_KEY,
             api_secret=self._API_SECRET,
             username=Lp.settings.get_value('lastfm-login').get_string(),
             password_hash=md5(password))
     except Exception as e:
         print("Lastfm::_connect(): %s" % e)
     self._populate_loved_tracks()
Exemplo n.º 13
0
 def __init__(self):
     """
         Init lastfm support
     """
     try:
         self.__settings = Gio.Settings.new('org.gnome.system.proxy.http')
     except:
         self.__settings = None
     self.__username = ''
     self.__is_auth = False
     self.__password = None
     self.__check_for_proxy()
     self.__goa = self.__get_goa_oauth()
     if self.__goa is not None:
         self.__API_KEY = self.__goa.props.client_id
         self.__API_SECRET = self.__goa.props.client_secret
     else:
         self.__API_KEY = '7a9619a850ccf7377c46cf233c51e3c6'
         self.__API_SECRET = '9254319364d73bec6c59ace485a95c98'
     LastFMNetwork.__init__(self,
                            api_key=self.__API_KEY,
                            api_secret=self.__API_SECRET)
     self.connect(None)