Beispiel #1
0
 def init_thread(self):
     time.sleep(5)
     if not self.controls.net_wrapper.is_internet():
         return None
         
     logging.debug("RUN INIT LAST.FM")
     username = FCBase().lfm_login
     password_hash = pylast.md5(FCBase().lfm_password)
     self.cache = None
     try:
         self.network = pylast.get_lastfm_network(api_key=API_KEY, api_secret=API_SECRET, username=username, password_hash=password_hash)
         self.cache = Cache(self.network)
         
         """scrobbler"""
         scrobbler_network = pylast.get_lastfm_network(username=username, password_hash=password_hash)
         self.scrobbler = scrobbler_network.get_scrobbler("fbx", "1.0")
     except:
         self.network = None
         self.scrobbler = None
         self.controls.statusbar.set_text("Error last.fm connection with %s/%s" % (username, FCBase().lfm_password))
         logging.error("Either invalid last.fm login or password or network problems")
         """
         val = show_login_password_error_dialog(_("Last.fm connection error"), _("Verify user and password"), username, FC().lfm_password)
         if val:
             FC().lfm_login = val[0]
             FC().lfm_password = val[1]
         return False
         """
     return True
Beispiel #2
0
    def init_thread(self):
        logging.debug("RUN INIT LAST.FM")
        username = FCBase().lfm_login
        password_hash = pylast.md5(FCBase().lfm_password)
        self.cache = None
        try:
            
            self.network = pylast.get_lastfm_network(api_key=API_KEY, api_secret=API_SECRET, username=username, password_hash=password_hash)
            self.cache = Cache(self.network)
            if FC().proxy_enable and FC().proxy_url:
                proxy_rul = FC().proxy_url
                index = proxy_rul.find(":")
                proxy = proxy_rul[:index]
                port = proxy_rul[index + 1:]
                self.network.enable_proxy(proxy, port)
                logging.info("Enable proxy for last fm" + str(proxy) + str(port))


            """scrobbler"""
            scrobbler_network = pylast.get_lastfm_network(username=username, password_hash=password_hash)
            self.scrobbler = scrobbler_network.get_scrobbler("fbx", "1.0")
        except:
            self.network = None
            self.scrobbler = None
            self.controls.statusbar.set_text("Error last.fm connection with %s/%s" % (username, FCBase().lfm_password))
            logging.error("Invalid last fm login or password or network problems" + username + FCBase().lfm_password)
            """
            val = show_login_password_error_dialog(_("Last.fm connection error"), _("Verify user and password"), username, FC().lfm_password)
            if val:
                FC().lfm_login = val[0]
                FC().lfm_password = val[1]
            return False
            """

        return True
Beispiel #3
0
    def __init__(self):
        """last fm"""
        self.lfm_login = self.LASTFM_USER
        self.lfm_password = pylast.md5(self.LASTFM_PASSWORD)

        self.uuid = uuid.uuid4().hex

        self.load()
Beispiel #4
0
    def init_thread(self):
        time.sleep(5)
        if not self.controls.net_wrapper.is_internet():
            return None

        logging.debug("RUN INIT LAST.FM")
        username = FCBase().lfm_login
        password_hash = pylast.md5(FCBase().lfm_password)
        self.cache = None
        try:
            self.network = pylast.get_lastfm_network(
                api_key=API_KEY,
                api_secret=API_SECRET,
                username=username,
                password_hash=password_hash)
            self.cache = Cache(self.network)
            """scrobbler"""
            scrobbler_network = pylast.get_lastfm_network(
                username=username, password_hash=password_hash)
            self.scrobbler = scrobbler_network.get_scrobbler("fbx", "1.0")
        except:
            self.network = None
            self.scrobbler = None
            self.controls.statusbar.set_text(
                "Error last.fm connection with %s/%s" %
                (username, FCBase().lfm_password))
            logging.error(
                "Either invalid last.fm login or password or network problems")
            """
            val = show_login_password_error_dialog(_("Last.fm connection error"), _("Verify user and password"), username, FC().lfm_password)
            if val:
                FC().lfm_login = val[0]
                FC().lfm_password = val[1]
            return False
            """
        return True
Beispiel #5
0
'''
Created on Nov 9, 2013

@author: ivan
'''
import unittest
from foobnix.thirdparty import pylast
from foobnix.fc.fc_base import FCBase
from foobnix.thirdparty.pylast import Artist

API_KEY = FCBase().API_KEY
API_SECRET = FCBase().API_SECRET
username = FCBase().lfm_login
password_hash = pylast.md5(FCBase().lfm_password)

class Test(unittest.TestCase):

    def test_pylast(self):
        network = pylast.get_lastfm_network(api_key=API_KEY,
                                                     api_secret=API_SECRET,
                                                     username=username,
                                                     password_hash=password_hash)
        artist = network.get_artist("Madonna");
        summary = artist.get_bio_summary()
        print "========="
        print summary

Beispiel #6
0
'''
Created on Nov 9, 2013

@author: ivan
'''
import unittest
from foobnix.thirdparty import pylast
from foobnix.fc.fc_base import FCBase
from foobnix.thirdparty.pylast import Artist

API_KEY = FCBase().API_KEY
API_SECRET = FCBase().API_SECRET
username = FCBase().lfm_login
password_hash = pylast.md5(FCBase().lfm_password)

class Test(unittest.TestCase):

    def test_pylast(self):
        network = pylast.get_lastfm_network(api_key=API_KEY,
                                                     api_secret=API_SECRET,
                                                     username=username,
                                                     password_hash=password_hash)
        artist = network.get_artist("Madonna");
        summary = artist.get_bio_summary()
        print("=========")
        print(summary)