def startVideoList(self, data): downloadInfo = Ui.SearchResult(data).exec() if downloadInfo != False: downloaderId = DownloadManager.start( downloadInfo, unmuteVideo=DB.download.isUnmuteVideoEnabled(), updateTrack=DB.download.isUpdateTrackEnabled()) App.coreWindow().showDownload(downloaderId)
def openSettings(self): oldTemplateString = self.downloadInfo.getFileNameTemplate() oldUpdateTrack = DB.download.isUpdateTrackEnabled() App.coreWindow().openSettings(page=2) if oldTemplateString != self.downloadInfo.getFileNameTemplate(): if Utils.ask( "filename-change", "#The filename template has been changed. Do you want to create a new filename based on the changed template?", defaultOk=True): self.downloadInfo.setFileName( self.downloadInfo.createFileName()) self.reloadFileDirectory() if oldUpdateTrack != DB.download.isUpdateTrackEnabled(): self.warnUpdateTrack()
def startSearch(self, mode): searchResult = Ui.Search(mode).exec() if searchResult != False: if type(searchResult) == PlaylistAccessToken.TwitchPlaylist: if searchResult.type.isStream(): data = TwitchGqlModels.Stream({"title": "Unknown Stream"}) else: data = TwitchGqlModels.Video({ "title": "Unknown Video", "lengthSeconds": searchResult.totalSeconds }) downloadInfo = Ui.DownloadMenu(DownloadInfo( data, searchResult), showMore=False).exec() if downloadInfo != False: downloaderId = DownloadManager.start( downloadInfo, unmuteVideo=DB.download.isUnmuteVideoEnabled(), updateTrack=DB.download.isUpdateTrackEnabled()) App.coreWindow().showDownload(downloaderId) else: self.startVideoList(searchResult)
def processVideoAccessToken(self, result): self.window.setLoading(False) self.window.setDownloadEnabled(True) self.downloadButton.setText(T("download")) if result.success: video = result.data if video.found != True: if video.found == TwitchPlaybackAccessTokens.Exceptions.VideoRestricted: if DB.account.isUserLoggedIn(): advice = T("#Unable to find subscription in your account.\nSubscribe to this streamer or log in with another account.") okText = "change-account" else: advice = T("#You need to log in to download subscriber-only videos.") okText = "login" if Utils.ask("unable-to-download", "#This video is for subscribers only.\n{advice}", okText=okText, cancelText="ok", advice=advice): App.coreWindow().openAccount() elif video.found == TwitchPlaybackAccessTokens.Exceptions.VideoNotFound: Utils.info("unable-to-download", "#Video not found. Deleted or temporary error.") else: Utils.info(*Messages.INFO.NETWORK_ERROR) return self.window.downloadVideo(DownloadInfo(self.data, video)) else: self.handleExceptions(result.error)
def __init__(self): super().__init__(parent=App.getActiveWindow()) self.selectLanguage.setText(" / ".join(Translator.getLanguageList())) self.selectLanguage.clicked.connect( lambda: App.coreWindow().openSettings(page=1)) self.textBrowser.setHtml( Utils.getDocs("TermsOfService", DB.localization.getLanguage(), appName=Config.APP_NAME, copyright=Config.getCopyrightInfo())) if DB.termsOfService.getAgreedTime() == None: self.setWindowFlag(QtCore.Qt.WindowCloseButtonHint, False) self.agreed.hide() self.agree.stateChanged.connect(self.checkAgree) self.buttonBox.button( QtWidgets.QDialogButtonBox.Ok).setEnabled(False) self.buttonBox.accepted.connect(DB.termsOfService.agree) self.buttonBox.rejected.connect(App.exit) else: self.agree.hide() self.agreed.setText( T("#Agreed at {time}", time=str(DB.termsOfService.getAgreedTime()).split(".")[0])) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)