def downloadMp4ByURL(self, stdscr, format): stdscr.addstr(0, 0, "Enter YouTube URL: (hit Ctrl-G to download)") editwin = curses.newwin(1,80, 2,1) rectangle(stdscr, 1,0, 1+1+1, 1+80+1) stdscr.refresh() box = Textbox(editwin) box.edit() url = box.gather() if format == "MP3 DOWNLOAD": Download.mp3Download(url, "test") elif format == "MP4 DOWNLOAD": Download.mp4Download(url, "test")
def showVideoDetails(self, stdscr, videoName, key): self.second_loop = False self.main_loop = False self.key = key self.videoName = videoName self.printVideoDetails(stdscr, self.videoName, self.key) while self.showVideo: key = stdscr.getch() if key == curses.KEY_ENTER or key in [10, 13]: webbrowser.open(self.rssFeeds[self.current_row][self.key][self.videoName][1]) elif key == curses.KEY_LEFT: self.second_loop = True self.showChannel(stdscr) elif key == curses.KEY_RIGHT: Download.mp4Download(self.rssFeeds[self.current_row][self.key][self.videoName][1], self.videoName) elif key == curses.KEY_DOWN: Download.mp3Download(self.rssFeeds[self.current_row][self.key][self.videoName][1], self.videoName) stdscr.clear() self.printVideoDetails(stdscr, self.videoName, self.key) stdscr.refresh()