def pause(self, isPlayingVideo): controlNzbget = __addon__.getSetting('controlNzbget') # can be either 'Audio', 'Video' or 'Audio or Video' pauseWhenAudio = controlNzbget.startswith('Audio') # catches both 'Audio' and 'Audio or Video' pauseWhenVideo = controlNzbget.endswith('Video') # catches both 'Video' and 'Audio or Video' if ((isPlayingVideo and pauseWhenVideo) or (not isPlayingVideo and pauseWhenAudio)): username = __addon__.getSetting('username') password = __addon__.getSetting('password') hostname = __addon__.getSetting('hostname') port = __addon__.getSetting('port') pauseDownload = __addon__.getSetting('pauseDownload') pausePostProcessing = __addon__.getSetting('pausePostProcessing') pauseScan = __addon__.getSetting('pauseScan') self.isPauseRegister1 = __addon__.getSetting('pauseRegister') == '1' server = ServerProxy('http://%s:%s@%s:%s/xmlrpc' % (username, password, hostname, port)) if (pauseDownload): if (self.isPauseRegister1): server.pausedownload() else: server.pausedownload2() self.isDownloadPaused = True log('Pause downloading') if (pausePostProcessing): self.isPostProcessingPaused = True server.pausepost() log('Pause post processing') if (pauseScan): server.pausescan() self.isScanPaused = True log('Pause scanning of incoming nzb-directory')