def setup(self): #create authorization helper and load default settings gauth = GoogleAuth(xbmc.validatePath(xbmc.translatePath(utils.addon_dir() + '/resources/lib/pydrive/settings.yaml'))) gauth.LoadClientConfigSettings() #check if this user is already authorized if(not xbmcvfs.exists(xbmc.translatePath(utils.data_dir() + "google_drive.dat"))): settings = {"client_id":self.CLIENT_ID,'client_secret':self.CLIENT_SECRET} drive_url = gauth.GetAuthUrl(settings) utils.log("Google Drive Authorize URL: " + drive_url) code = xbmcgui.Dialog().input('Google Drive Validation Code','Input the Validation code after authorizing this app') gauth.Auth(code) gauth.SaveCredentialsFile(xbmc.validatePath(xbmc.translatePath(utils.data_dir() + 'google_drive.dat'))) else: gauth.LoadCredentialsFile(xbmc.validatePath(xbmc.translatePath(utils.data_dir() + 'google_drive.dat'))) #create the drive object self.drive = GoogleDrive(gauth) #make sure we have the folder we need xbmc_folder = self._getGoogleFile(self.root_path) print xbmc_folder if(xbmc_folder == None): self.mkdir(self.root_path)
def __init__(self): self.dataBasePath = os.path.join(xbmc.translatePath(utils.data_dir()), 'History.db') #use scripts home for reading SQL files self.sqlDir = os.path.join(xbmc.translatePath(utils.addon_dir()), 'resources', 'database') #quick check to make sure data_dir exists if(not xbmcvfs.exists(xbmc.translatePath(utils.data_dir()))): xbmcvfs.mkdir(xbmc.translatePath(utils.data_dir()))
def setup(self): #create authorization helper and load default settings gauth = GoogleAuth( xbmc.validatePath( xbmc.translatePath(utils.addon_dir() + '/resources/lib/pydrive/settings.yaml'))) gauth.LoadClientConfigSettings() #check if this user is already authorized if (not xbmcvfs.exists( xbmc.translatePath(utils.data_dir() + "google_drive.dat"))): settings = { "client_id": self.CLIENT_ID, 'client_secret': self.CLIENT_SECRET } drive_url = gauth.GetAuthUrl(settings) utils.log("Google Drive Authorize URL: " + drive_url) code = xbmcgui.Dialog().input( 'Google Drive Validation Code', 'Input the Validation code after authorizing this app') gauth.Auth(code) gauth.SaveCredentialsFile( xbmc.validatePath( xbmc.translatePath(utils.data_dir() + 'google_drive.dat'))) else: gauth.LoadCredentialsFile( xbmc.validatePath( xbmc.translatePath(utils.data_dir() + 'google_drive.dat'))) #create the drive object self.drive = GoogleDrive(gauth) #make sure we have the folder we need xbmc_folder = self._getGoogleFile(self.root_path) print xbmc_folder if (xbmc_folder == None): self.mkdir(self.root_path)