def downloadClip(self, downloadInfo): downloadInfo = Ui.DownloadMenu(downloadInfo).exec() if downloadInfo != False: self.setDownloadEnabled(False) self.downloaderId = DownloadManager.start(downloadInfo) self.downloader = DownloadManager.get(self.downloaderId) self.connectDownloader()
def handleDownloadResult(self): self.setDownloadEnabled(True) self.progressArea.hide() if self.downloader.status.getError() == None: self.progressLabel.setText(T("download-complete")) else: self.progressLabel.setText(T("download-failed")) self.disconnectDownloader() DownloadManager.remove(self.downloaderId)
def closeEvent(self, event): event.ignore() if DownloadManager.isDownloaderRunning(): if Utils.ask( *(Messages.ASK.APP_EXIT if DownloadManager.isShuttingDown( ) else Messages.ASK.APP_EXIT_WHILE_DOWNLOADING)): Utils.wait("shutting-down", T("#Shutting down downloader", ellipsis=True), target=DownloadManager.removeAll).exec() self.shutdown() else: if Utils.ask(*Messages.ASK.APP_EXIT): self.shutdown()
def __init__(self, downloaderId): super().__init__() self.downloader = DownloadManager.get(downloaderId) self.downloadInfo = self.downloader.setup.downloadInfo self.videoData = self.downloadInfo.videoData self.setWindowTitle(self.videoData.title) self.window_title.setText(self.videoData.title) self.categoryImageLoader = Utils.ImageLoader( self.category_image, self.videoData.game.boxArtURL, Config.CATEGORY_IMAGE) self.category.setText(self.videoData.game.displayName) self.title.setText(self.videoData.title) self.thumbnail_image.setImageSizePolicy((480, 270), (1920, 1080)) if self.downloadInfo.type.isStream(): self.thumbnailImageLoader = Utils.ImageLoader( self.thumbnail_image, self.videoData.previewImageURL, Config.THUMBNAIL_IMAGE) self.user_name.setText(self.videoData.broadcaster.displayName) self.date.setText( self.videoData.createdAt.toUTC(DB.localization.getTimezone())) self.duration.setText(T("unknown")) self.view_countInfo.setText(T("#Viewer Count:")) self.view_count.setText(self.videoData.viewersCount) self.downloadProgressBar.setRange(0, 0) self.encodingProgressBar.setRange(0, 0) self.pauseButton.hide() self.cancelButton.setText(T("stop")) else: self.liveLabelArea.hide() self.thumbnailImageLoader = Utils.ImageLoader( self.thumbnail_image, self.videoData.previewThumbnailURL, Config.THUMBNAIL_IMAGE) self.user_name.setText(self.videoData.owner.displayName) self.date.setText( self.videoData.publishedAt.toUTC( DB.localization.getTimezone())) start, end = self.downloadInfo.range totalSeconds = self.videoData.lengthSeconds.totalSeconds() durationSeconds = (end or totalSeconds) - (start or 0) self.showVideoDuration(start, end, totalSeconds, durationSeconds) self.view_countInfo.setText(T("#View Count:")) self.view_count.setText(self.videoData.viewCount) self.skipWaitingButton.clicked.connect(self.skipWaiting) self.forceEncodingButton.clicked.connect(self.forceEncoding) self.pauseButton.clicked.connect(self.pauseResume) self.cancelButton.setText(T("cancel")) self.resolution.setText(self.downloadInfo.resolution) self.file.setText(self.downloadInfo.getAbsoluteFileName()) sizePolicy = self.skipWaitingButton.sizePolicy() sizePolicy.setRetainSizeWhenHidden(True) self.skipWaitingButton.setSizePolicy(sizePolicy) self.forceEncodingButton.setSizePolicy(sizePolicy) self.skipWaitingButton.hide() self.forceEncodingButton.hide() self.cancelButton.clicked.connect(self.cancel) self.openFolderButton.clicked.connect(self.openFolder) self.openFileButton.clicked.connect(self.openFile) self.openFileButton.hide() self.connectDownloader()
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 __init__(self, page=0): super().__init__(parent=App.getActiveWindow()) self.ignoreKey(QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter) self.autoClose.setChecked(DB.general.isAutoCloseEnabled()) self.streamFilename.setText(DB.templates.getStreamFilename()) self.videoFilename.setText(DB.templates.getVideoFilename()) self.clipFilename.setText(DB.templates.getClipFilename()) self.streamTemplateInfo.clicked.connect(self.showStreamTemplateInfo) self.videoTemplateInfo.clicked.connect(self.showVideoTemplateInfo) self.clipTemplateInfo.clicked.connect(self.showClipTemplateInfo) self.bookmarkList.addItems(DB.general.getBookmarks()) self.bookmarkList.itemSelectionChanged.connect(self.reloadButtons) self.newBookmark.returnPressed.connect(self.addBookmark) self.newBookmark.textChanged.connect(self.reloadButtons) self.addBookmarkButton.clicked.connect(self.addBookmark) self.insertBookmarkButton.clicked.connect(self.insertBookmark) self.removeBookmarkButton.clicked.connect(self.removeBookmark) self.language.addItems(Translator.getLanguageList()) self.language.setCurrentIndex(Translator.getLanguageKeyList().index(DB.localization.getLanguage())) self.language.currentIndexChanged.connect(self.setLanguage) self.timezone.addItems(DB.localization.getTimezoneList()) self.timezone.setCurrentIndex(DB.localization.getTimezoneIndex()) self.timezone.currentIndexChanged.connect(self.setTimezone) self.downloadEngineInfo.setHtml(Utils.getDocs("DownloadEngine", DB.localization.getLanguage())) self.downloadSpeed.valueChanged.connect(self.setDownloadSpeed) self.downloadSpeed.setRange(1, TaskConfig.MAX_THREAD_LIMIT) self.speedSpinBox.valueChanged.connect(self.setDownloadSpeed) self.speedSpinBox.setRange(1, TaskConfig.MAX_THREAD_LIMIT) self.setDownloadSpeed(DB.download.getDownloadSpeed()) self.recommendedSpeed.setText(TaskConfig.RECOMMENDED_THREAD_LIMIT) self.unmuteVideo.setChecked(DB.download.isUnmuteVideoEnabled()) self.updateTrack.setChecked(DB.download.isUpdateTrackEnabled()) if DownloadManager.isDownloaderRunning(): self.languageArea.setEnabled(False) self.timezoneArea.setEnabled(False) self.buttonBox.button(QtWidgets.QDialogButtonBox.Reset).setEnabled(False) else: self.restrictedLabel.hide() self.changesInfoLabel.hide() self.buttonBox.accepted.connect(self.saveSettings) self.buttonBox.button(QtWidgets.QDialogButtonBox.Reset).clicked.connect(self.resetSettings) self.tabWidget.setCurrentIndex(page) self.reloadButtons()
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)