Ejemplo n.º 1
0
def Startup():
   #This is the "initialisation call"

   #logger is the global logging object..
   global logger
   #gm is our gomiso object (global here in case anyone else needed it, but maybe they won't)
   global gm
   #a login oject to hold our authenticated user info
   global login
   #mypath holds the location of the script so that relative references can be made
   global mypath
   mypath=sys.path[0]
   #create the logger object..
   logger=CreateLog("MisoNotifier")
   #and the gomiso object..
   gm=gomiso.gomiso()
   #try to authentiate with miso..
   logger.info('trying to authenticate with miso to grab api handle')
   loginsuccess = gm.authentification(consumer_key, consumer_secret, gm_username, gm_password, tokensFile)
   try:
      login = json.loads(gm.getUserInfo())
      #getting this far should meant that we were authorized, so we have populated our global login object with the json data
      #and log our success :)
      logger.info ('logged in as ' + login['user']['username'])
   except:
      logger.error('looks like we had issues logging in - check consumer_key,secret, username, password in config')
      return 1
      exit
   return 0
	def __init__(self):
		self.loginsuccess=False
		self.curuser=""
		self.curnews=""
		self.newuser=""
		self.newnews=""
		from gmnotifier import CreateLog
		#mydata=gmnotifier.mydata
		self.gm=gomiso.gomiso()
		#create the logger object..
		#and the gomiso object..
		#try to authentiate with miso..
		logger.info('trying to authenticate with miso to grab api handle')
		try:
			authentication=self.gm.authentification(consumer_key, consumer_secret, gm_username, gm_password, tokensFile)
		except:
			logger.info("authentication result:\n" + str(authentication))
		try:
			self.login = json.loads(self.gm.getUserInfo())
			#getting this far should meant that we were authorized, so we have populated our global login object with the json data
			#and log our success :)
			logger.info ('logged in as ' + self.login['user']['username'])
			self.loginsuccess=True
		except Exception as e:
			logger.error('looks like we had issues logging in - check consumer_key,secret, username, password in config')
			return 1
Ejemplo n.º 3
0
#We cannot have tokens file and no settings file
if os.path.isfile(tokensFile) == True:
    if os.path.isfile(settingsFile) != True:
        os.remove(tokensFile)
        __settings__.openSettings()
#And no settings file and no tokens file would force setting page to appear
elif os.path.isfile(settingsFile) != True:
    __settings__.openSettings()

#From now on, we have all needed informations to work with
username = __settings__.getSetting('Username')
password = __settings__.getSetting('Password')

#Class instanciation and authentification with application key and secret
letsGo = gomiso()

if letsGo.authentification('AgmVUNp8BgtTLQWElAnA',
                           'BL7xQH3Aeut68IWsOD6SGoUfsRqkC5t16jLg', username,
                           password, tokensFile) == False:
    xbmc.executebuiltin("XBMC.Notification(%s, %s, %i, %s)" %
                        ('Gomiso', __language__(30921), 5000,
                         __settings__.getAddonInfo("icon")))
else:
    #Retrieving user information and display a message that authentification is ok
    json_result = json.loads(letsGo.getUserInfo())
    xbmc.executebuiltin(
        "XBMC.Notification(%s, %s, %i, %s)" %
        ('Gomiso', json_result['user']['username'] + " " + __language__(30916),
         5000, __settings__.getAddonInfo("icon")))
Ejemplo n.º 4
0
#We cannot have tokens file and no settings file
if os.path.isfile(tokensFile) == True:
	if os.path.isfile(settingsFile) != True:
		os.remove(tokensFile)
		__settings__.openSettings()
#And no settings file and no tokens file would force setting page to appear
elif os.path.isfile(settingsFile) != True:
	__settings__.openSettings()

#From now on, we have all needed informations to work with
username = __settings__.getSetting('Username')
password = __settings__.getSetting('Password')

#Class instanciation and authentification with application key and secret
letsGo = gomiso()
if letsGo.authentification('AgmVUNp8BgtTLQWElAnA', 'BL7xQH3Aeut68IWsOD6SGoUfsRqkC5t16jLg', username, password, tokensFile) == False:
	xbmc.executebuiltin("XBMC.Notification(%s, %s, %i, %s)"  % ('Gomiso', __language__(30921), 5000, __settings__.getAddonInfo("icon")))
else:
	#Retrieving user information and display a message that authentification is ok
	json_result = json.loads(letsGo.getUserInfo())
	xbmc.executebuiltin("XBMC.Notification(%s, %s, %i, %s)"  % ('Gomiso', json_result['user']['username'] + " " + __language__(30916), 5000, __settings__.getAddonInfo("icon")))

	videoThreshold = int(__settings__.getSetting("VideoThreshold"))
	if videoThreshold == 0:
		videoThreshold = 75
	elif videoThreshold == 1:
		videoThreshold = 25
	#videoThreshold=25
	submitLimit = float(videoThreshold) / 100
	checkedTitle = ''