Esempio n. 1
0
        fb = Facebook(settings[API_KEY], settings[SECRET_KEY])

        # if there is no facebook session id
        if (settings[SESSION_KEY] == ""):
            # login for the first time
            facebook_login()
        else:
            # try to connect with the session id
            if (not facebook_login_with_session()):
                # if doesn't work - login with user & password to get a new session id
                facebook_login()

        show_news_feed()
    except FacebookError, (err):
        if (err.code == "612"):
            fb.request_extended_permission("read_stream")
            dialog.ok(xbmc.getLocalizedString(30000),
                      xbmc.getLocalizedString(30013),
                      xbmc.getLocalizedString(30014),
                      xbmc.getLocalizedString(30015))
        elif (err.code == "102"):
            facebook_login()
            show_news_feed()
        else:
            raise
else:
    if params.has_key("playMedia"):
        listitem = xbmcgui.ListItem(params["moviename"])
        pDialog.update(100,
                       xbmc.getLocalizedString(30023) % params["moviename"])
        xbmc.Player().play(params["url"], listitem)
        fb = Facebook(settings[API_KEY], settings[SECRET_KEY])

        # if there is no facebook session id
        if settings[SESSION_KEY] == "":
            # login for the first time
            facebook_login()
        else:
            # try to connect with the session id
            if not facebook_login_with_session():
                # if doesn't work - login with user & password to get a new session id
                facebook_login()

        show_news_feed()
    except FacebookError, (err):
        if err.code == "612":
            fb.request_extended_permission("read_stream")
            dialog.ok(
                xbmc.getLocalizedString(30000),
                xbmc.getLocalizedString(30013),
                xbmc.getLocalizedString(30014),
                xbmc.getLocalizedString(30015),
            )
        elif err.code == "102":
            facebook_login()
            show_news_feed()
        else:
            raise
else:
    if params.has_key("playMedia"):
        listitem = xbmcgui.ListItem(params["moviename"])
        pDialog.update(100, xbmc.getLocalizedString(30023) % params["moviename"])