def __init__(self, pathSuffix): self.LocalMainPath = Settings.GetValue(pathSuffix + "LocalMainPath") self.GDriveMainPath = Settings.GetValue(pathSuffix + "GDriveMainPath") self.CurrentRecordings = "Current Recordings" self.GDriveRemovePath = Settings.GetValue(pathSuffix + "GDriveRemovePath") self.LocalBackupPath = Settings.GetValue(pathSuffix + "LocalBackupPath") self.GDriveBackupPath = Settings.GetValue(pathSuffix + "GDriveBackupPath") self.SourceFiles = Functions.ScanAllFiles(self.LocalMainPath, False)
def __init__(self): client_config = json.loads(Settings.GetValue("YoutubeSecret")) appFlow = InstalledAppFlow.from_client_config( client_config, CustomisedYoutubeService.SCOPES) urlForAuth = appFlow.run_console() authCode = CustomisedYoutubeService.GetAuthenticationCode(urlForAuth) credentialsForAuth = appFlow.run_console_rest(authCode) self.youtubeService = build(CustomisedYoutubeService.API_SERVICE_NAME, CustomisedYoutubeService.API_VERSION, credentials=credentialsForAuth)
def GetAuthenticationCode(authUrl): webDriver = CustomisedWebDriver() webDriver.LaunchURL(authUrl) webDriver.LocateByPath("//input[@type='email']") webDriver.SendKeys(Settings.GetValue("GUsername")) webDriver.LocateByPath("//input[@type='password']") webDriver.SendKeys(Settings.GetValue("GPassword")) webDriver.LocateByPath("//*[contains(text(), '" + Settings.GetValue("YTChannelName") + "')]") webDriver.Click() webDriver.LocateByPath("//a[contains(text(), 'Advanced')]") webDriver.Click() webDriver.LocateByPath( "//a[contains(text(), 'Go to python test project (unsafe)')]") webDriver.Click() webDriver.LocateByPath("//span[contains(text(), 'Allow')]") webDriver.Click() code = webDriver.GetAuthCode() webDriver.quit() return code
def GetVideoIDs(self, searchString): queryReturnParts = "id,snippet" orderString = "date" queryString = searchString nextPageToken = "" responseData = [] while True: response = self.youtubeService.search().list( part=queryReturnParts, channelId=Settings.GetValue("YTChannelID"), order=orderString, q=queryString, pageToken=nextPageToken).execute() for currentResponseItems in response["items"]: if u"videoId" in currentResponseItems[u"id"].keys(): currentVideoId = currentResponseItems[u"id"][u"videoId"] responseData.append(currentVideoId) if u"nextPageToken" in response.keys(): nextPageToken = response[u"nextPageToken"] else: break return responseData
def __init__(self): connection = sqlite3.connect(Settings.GetValue("DatabasePath")) self.connection = connection