def downloadPlaying(self): title = BBTagRemove(xbmc.getInfoLabel('Player.Title')) # xbmc.getInfoLabel('Player.Filenameandpath') url = xbmc.Player().getPlayingFile() thumbnail = xbmc.getInfoLabel('Player.Art(thumb)') extra = None if '|' in url: url, extra = url.rsplit('|', 1) url = url.rstrip('?') import time info = {'url': url, 'title': title, 'thumbnail': thumbnail, 'id': int(time.time()), 'media_type': 'video'} if extra: try: import urlparse for k, v in urlparse.parse_qsl(extra): if k.lower() == 'user-agent': info['user_agent'] = v break except: util.ERROR(hide_tb=True) util.LOG(repr(info), debug=True) import YDStreamExtractor YDStreamExtractor.handleDownload(info, bg=True)
def download_video(self): selection = xbmcgui.Dialog().select(heading=LANG(22080), list=[LANG(33003)]) if selection == 0: import YDStreamExtractor vid = YDStreamExtractor.getVideoInfo(self.listitem.getProperty("youtube_id"), quality=1) YDStreamExtractor.handleDownload(vid)
def download_video(self): selection = xbmcgui.Dialog().select(heading=LANG(22080), list=[LANG(33003)]) if selection == 0: youtube_id = self.listitem.getProperty("youtube_id") import YDStreamExtractor vid = YDStreamExtractor.getVideoInfo(youtube_id, quality=1) YDStreamExtractor.handleDownload(vid)
def _download(info, background=True): if background: YDStreamExtractor.handleDownload(info, bg=True) else: result = YDStreamExtractor.handleDownload(info, bg=False) if result: log_utils.log('Download complete: |%s|' % result.filepath) elif result.status != 'canceled': log_utils.log('Download failed: |%s|' % result.message, log_utils.LOGERROR) kodi.notify(msg=result.message, sound=True) else: log_utils.log('Download cancelled')
def _download(info, background=True): if background: YDStreamExtractor.handleDownload(info, bg=True) else: result = YDStreamExtractor.handleDownload(info, bg=False) if result: log_utils.log('Download complete: |%s|' % result.filepath) elif result.status != 'canceled': log_utils.log('Download failed: |%s|' % result.message, log_utils.LOGERROR) kodi.notify(msg=result.message, sound=True) else: log_utils.log('Download cancelled')
def start_download(): kb = xbmc.Keyboard('default', 'heading', False) kb.setDefault('') kb.setHeading(enter0) kb.setHiddenInput(False) kb.doModal() if (kb.isConfirmed()): try: url = kb.getText(kb) info = YDStreamExtractor.getVideoInfo(url) YDStreamExtractor.handleDownload(info, bg=True) except: xbmc.executebuiltin('Notification(%s, %s, %d, %s)' % (addonname, errorline2, time, infoicon)) start_menu() else: xbmc.executebuiltin('Notification(%s, %s, %d, %s)' % (addonname, errorline1, time, infoicon)) start_menu() xbmc.executebuiltin('xbmc.activatewindow(home)') sys.exit(0)
def download_video(youtube_id): vid = YDStreamExtractor.getVideoInfo(youtube_id, quality=1) YDStreamExtractor.handleDownload(vid)
def download_video(youtube_id): """ download youtube video with id *youtube_id """ vid = YDStreamExtractor.getVideoInfo(youtube_id, quality=1) YDStreamExtractor.handleDownload(vid)
folder = xbmcaddon.Addon(id='script.module.youtube.dl') savepath = folder.getSetting('last_download_path').decode('utf-8') path = xbmc.getInfoLabel('ListItem.FileNameAndPath') title = xbmc.getInfoLabel('ListItem.Title') listitem = xbmcgui.ListItem(path=path) listitem.setInfo(type="Video", infoLabels={"Title": title}) kodi_player = xbmc.Player() kodi_player.play(path, listitem) time.sleep(10) videoda = 0 while videoda == 0: try: file = kodi_player.getPlayingFile() if not file == "": videoda = 1 except: pass file = file.split("|")[0] try: info = YDStreamExtractor.getVideoInfo(file) YDStreamExtractor.handleDownload(info, bg=True) except: pass