def download_file(url, title):
    path = addon.getSetting('download')
    if path == "":
        xbmc.executebuiltin("XBMC.Notification(%s,%s,10000,%s)"
                %(language(30000), language(30010), icon))
        addon.openSettings()
        path = addon.getSetting('download')
    if path == "":
        return
    addon_log('######### Download #############')
    file_downloader = downloader.SimpleDownloader()
    if ' - ' in title:
        title = title.split(' - ', 1)[1]
    invalid_chars = ['>', '<', '*', '/', '\\', '?', '.']
    for i in invalid_chars:
        title = title.replace(i, '')
    name = title.replace(' ', '_')
    name += url.rsplit('/', 1)[1]
    if not '.' in name:
        if 'zip' in name.lower():
            name += '.zip'
        elif 'm3u' in name.lower():
            name += '.m3u'
        elif 'whole_directory' in name.lower():
            name += '.zip'

    params = {"url": url, "download_path": path, "Title": title}
    addon_log(str(params))
    file_downloader.download(name, params)
    addon_log('################################')
示例#2
0
文件: utils.py 项目: bialagary/mw
def download(name, url):
    my_addon = xbmcaddon.Addon()
    desty = my_addon.getSetting('downloads_folder')
    if not xbmcvfs.exists(desty):
        xbmcvfs.mkdir(desty)

    title = name
    name = re.sub('[^-a-zA-Z0-9_.() ]+', '', name)
    name = name.rstrip('.')
    ext = os.path.splitext(urlparse.urlparse(url).path)[1][1:]
    if not ext in ['mp4', 'mkv', 'flv', 'avi', 'mpg', 'mp3']: ext = 'mp4'
    filename = name + '.' + ext

    dest = os.path.join(desty, filename)
    new = my_addon.getSetting('new_downloader')
    if new == 'false':
        from lib.modules import commondownloader
        commondownloader.download(url, dest, 'Croatia On Demand')
    else:
        content = int(urllib.urlopen(url).info()['Content-Length'])
        size = 1024 * 1024
        mb = content / (1024 * 1024)
        if xbmcgui.Dialog().yesno('Croatia On Demand - Potvrda preuzimanja',
                                  filename, 'Veličina datoteke je %dMB' % mb,
                                  'Nastaviti s preuzimanjem?', 'Nastavi',
                                  'Prekini') == 1:
            return
        import SimpleDownloader as downloader
        downloader = downloader.SimpleDownloader()
        params = {"url": url, "download_path": desty, "Title": title}
        downloader.download(filename, params)
def download_video(source, url):
    import SimpleDownloader
    sd = SimpleDownloader.SimpleDownloader()
    playable_url = _get_playable_url(source, url)
    if source == 'apple.com':
        sd.common.USERAGENT = 'QuickTime'
        playable_url = playable_url.split('|')[0]
    elif source == 'youtube.com':
        plugin.notify(msg=_('download_not_possible'))
        return
    download_path = plugin.get_setting('download_path')
    while not download_path:
        try_again = xbmcgui.Dialog().yesno(_('no_download_path'),
                                           _('want_set_now'))
        if not try_again:
            return
        plugin.open_settings()
        download_path = plugin.get_setting('download_path')
    filename = playable_url.split('?')[0].split('/')[-1]
    if filename == 'makeplaylist.dll':
        filename = playable_url.split('=')[-1]  # yahoo...
    params = {'url': playable_url, 'download_path': download_path}
    sd.download(filename, params)
    downloads = plugin.get_storage('downloads')
    downloads[url] = xbmc.translatePath(download_path + filename)
    downloads.sync()
def downloadLiveLeakVideo(id):
    downloader = SimpleDownloader.SimpleDownloader()
    content = opener.open("http://www.liveleak.com/view?i=" + id).read()
    match = re.compile('<title>LiveLeak.com - (.+?)</title>',
                       re.DOTALL).findall(content)
    global ll_downDir
    while not ll_downDir:
        xbmc.executebuiltin('XBMC.Notification(Download:,Liveleak ' +
                            translation(30186) + '!,5000)')
        addon.openSettings()
        ll_downDir = addon.getSetting("ll_downDir")
    url = getLiveLeakStreamUrl(id)
    filename = ""
    try:
        filename = (''.join(c for c in unicode(match[0], 'utf-8')
                            if c not in '/\\:?"*|<>')).strip()
    except:
        filename = id
    filename += ".mp4"
    if not os.path.exists(os.path.join(ll_downDir, filename)):
        params = {"url": url, "download_path": ll_downDir}
        downloader.download(filename, params)
    else:
        xbmc.executebuiltin('XBMC.Notification(Download:,' +
                            translation(30185) + '!,5000)')
示例#5
0
def download(artist, track):
    data = getTrack(artist, track)
    loader = downloader.SimpleDownloader()
    params = {
        'url': data['url'],
        'download_path': plugin.get_setting('Download Path')
    }
    loader.download('%s - %s.mp3' % (artist, track), params)
示例#6
0
def download(params):
    fileUrl = client.get_full_url(urllib.unquote_plus(params['file_url']))
    fileName = fileUrl.split('/')[-1]
    download_params = {
        'url': fileUrl,
        'download_path': __settings__.getSetting('Download Path')
    }
    client = downloader.SimpleDownloader()
    client.download(fileName, download_params)
示例#7
0
 def downloadVideo(self, video):
     ok = True    
     try:
         my_downloader = downloader.SimpleDownloader()
         params = {"videoid": "1", "video_url": video[self.PARAM_VIDEO_ID], "Title": video[self.PARAM_VIDEO_NAME]}
         my_downloader.downloadVideo(params)            
         
     except Exception,msg:
         print_exc("Error downloadVideo : %s", msg)
         xbmc.executebuiltin("XBMC.Notification(%s,%s)"%("ERROR downloadVideo ",msg))  
示例#8
0
def download(params):
    dir = addon.getSetting('DownloadDir')
    if not os.path.exists(dir):
        xbmcMessage('Неверный путь для загрузки', 7000)

    url = site_url + urllib.unquote(params['href'])
    name = urllib.unquote_plus(params['title'])

    dl = downloader.SimpleDownloader()
    dl.download(name.decode('UTF-8'), {'url': url, 'download_path': dir})
    def intializePlugin(self):
        import cookielib
        import urllib2
        sys.modules["__main__"].cookiejar = cookielib.LWPCookieJar()
        sys.modules["__main__"].opener = urllib2.build_opener(
            urllib2.HTTPCookieProcessor(sys.modules["__main__"].cookiejar))
        urllib2.install_opener(sys.modules["__main__"].opener)

        sys.argv = ["something", -1, "something_else"]
        import CommonFunctions
        reload(CommonFunctions)
        sys.modules["__main__"].common = CommonFunctions
        sys.modules["__main__"].common.log = sys.modules["__main__"].xbmc.log
        sys.modules["__main__"].settingsDL.load_strings(
            "./resources/settings.xml")
        sys.modules["__main__"].xbmcaddon.Addon.return_value = sys.modules[
            "__main__"].settingsDL
        sys.modules["__main__"].xbmcvfs.exists.return_value = True

        import SimpleDownloader
        sys.modules["__main__"].downloader = SimpleDownloader.SimpleDownloader(
        )
        sys.modules["__main__"].xbmcvfs.exists.return_value = False
        import YouTubePluginSettings
        sys.modules[
            "__main__"].pluginsettings = YouTubePluginSettings.YouTubePluginSettings(
            )
        import YouTubeUtils
        sys.modules["__main__"].utils = YouTubeUtils.YouTubeUtils()
        import YouTubeStorage
        sys.modules["__main__"].storage = YouTubeStorage.YouTubeStorage()
        import YouTubeCore
        sys.modules["__main__"].core = YouTubeCore.YouTubeCore()
        sys.modules["__main__"].core.getVideoIdStatusFromCache = Mock()
        sys.modules[
            "__main__"].core.getVideoIdStatusFromCache.return_value = []
        import YouTubeLogin
        sys.modules["__main__"].login = YouTubeLogin.YouTubeLogin()
        import YouTubeFeeds
        sys.modules["__main__"].feeds = YouTubeFeeds.YouTubeFeeds()
        import YouTubeSubtitleControl
        sys.modules[
            "__main__"].subtitles = YouTubeSubtitleControl.YouTubeSubtitleControl(
            )
        import YouTubePlayer
        sys.modules["__main__"].player = YouTubePlayer.YouTubePlayer()
        import YouTubeScraper
        sys.modules["__main__"].scraper = YouTubeScraper.YouTubeScraper()
        import YouTubePlaylistControl
        sys.modules[
            "__main__"].playlist = YouTubePlaylistControl.YouTubePlaylistControl(
            )
        import YouTubeNavigation
        self.navigation = YouTubeNavigation.YouTubeNavigation()
示例#10
0
def downloadVideo(item, downloadPath):
    if item.get_moving_data().has_key('videoStreamUrl'):
        import SimpleDownloader as downloader  # @UnresolvedImport
        downloader = downloader.SimpleDownloader()
        videoUrl = item.get_moving_data()['videoStreamUrl'].partition('|')[0]
        params = {"url": videoUrl, "download_path": downloadPath}
        downloader.download(item.get_xbmc_list_item_obj().getLabel(), params)
    else:
        displayDialogMessage("Download failure!",
                             "Unable to resolve video URL.",
                             "Please try again with different source.")
示例#11
0
def download_season(url):
    import SimpleDownloader as downloader
    downloader = downloader.SimpleDownloader()
    downloader.dbg = False

    series_id = urllib.unquote_plus(params["series_id"])

    season_id = urllib.unquote_plus(params["season_id"])

    page = getData(url=DOMAIN + "/ajax/watch",
                   timeout=0,
                   postData="episodeList=true&serie=" + series_id +
                   "&season=" + season_id)

    episodes = json.loads(page)
    if episodes is None or (len(episodes) == 0):
        xbmcgui.Dialog().ok('Error occurred', "לא נמצאו פרקים לעונה")
        return
    print "Download sdarot series=" + series_id + " season=" + season_id + " #episodes=" + str(
        len(episodes))
    for i in range(0, len(episodes)):
        epis = str(episodes[i]['episode'])
        finalVideoUrl, VID = getFinalVideoUrl(series_id,
                                              season_id,
                                              epis,
                                              url,
                                              silent=True)
        if finalVideoUrl == None:
            continue

        print "Downloading:" + str(finalVideoUrl)
        fileName = 'S' + str(season_id).zfill(2) + 'E' + str(epis).zfill(
            2) + '_' + str(VID) + '.mp4'
        download_path = os.path.join(path, str(series_id))
        if not os.path.exists(download_path):
            os.makedirs(download_path)

        finalFileName = os.path.join(download_path, fileName)
        if not os.path.isfile(finalFileName):
            #progress = xbmcgui . DialogProgress ( )
            #progress.create ( "XBMC ISRAEL" , "Downloading " , '' , 'Please Wait' )

            try:
                #downloader . download ( finalVideoUrl , download_path , progress )
                downloaderParams = {
                    "url": finalVideoUrl,
                    "download_path": download_path
                }
                downloader.download(fileName, downloaderParams, async=True)
            except Exception, e:
                print str(e)
                pass
示例#12
0
def downloadVideo(url, title):
    valid_chars = "-_.() %s%s" % (string.ascii_letters, string.digits)
    video_url, subtitles = scrapVideo(url)
    params = {}
    params["url"] = video_url
    downloadPath = yleAreenaAddon.addon.getSetting('download-path')
    if downloadPath == None or downloadPath == '':
        return
    params["download_path"] = downloadPath

    filename = "%s.mp4" % (''.join(c for c in title if c in valid_chars))
    #filename = 'test.mp4'
    xbmc.log(filename + "  " + str(params))
    dw = downloader.SimpleDownloader()
    dw.download(filename, params)
示例#13
0
    def initializePlugin(self):
        import CommonFunctions
        sys.modules["__main__"].common = CommonFunctions
        sys.modules["__main__"].common.log = sys.modules["__main__"].xbmc.log
        sys.modules["__main__"].xbmcaddon.Addon.return_value = sys.modules[
            "__main__"].settings
        sys.modules["__main__"].xbmcvfs.exists.return_value = True

        import SimpleDownloader
        sys.modules["__main__"].downloader = SimpleDownloader.SimpleDownloader(
        )

        import cookielib
        import urllib2
        sys.modules["__main__"].cookiejar = cookielib.LWPCookieJar()
        opener = urllib2.build_opener(
            urllib2.HTTPCookieProcessor(sys.modules["__main__"].cookiejar))
        urllib2.install_opener(opener)

        sys.argv = ["something", -1, "something_else"]

        import VimeoUtils
        sys.modules["__main__"].utils = VimeoUtils.VimeoUtils()

        import VimeoLogin
        sys.modules["__main__"].login = VimeoLogin.VimeoLogin()

        import VimeoCore
        sys.modules["__main__"].core = VimeoCore.VimeoCore()

        import VimeoStorage
        sys.modules["__main__"].storage = VimeoStorage.VimeoStorage()

        import VimeoFeeds
        sys.modules["__main__"].feeds = VimeoFeeds.VimeoFeeds()

        import VimeoPlayer
        sys.modules["__main__"].player = VimeoPlayer.VimeoPlayer()

        import VimeoPlaylistControl
        sys.modules[
            "__main__"].playlist = VimeoPlaylistControl.VimeoPlaylistControl()

        import VimeoNavigation
        self.navigation = VimeoNavigation.VimeoNavigation()
示例#14
0
def downloadVideo(url, title):
    valid_chars = "-_.() %s%s" % (string.ascii_letters, string.digits)
    videoUrl = scrapVideoLink(url)

    downloadPath = ruutu.addon.getSetting('download-path')
    if downloadPath is None or downloadPath == '':
        return
    downloadPath += url.split('/')[-2]
    if not os.path.exists(downloadPath):
        os.makedirs(downloadPath)

    filename = "%s %s" % (''.join(
        c for c in title if c in valid_chars), videoUrl.split(':')[-1])

    params = {"url": videoUrl, "download_path": downloadPath}
    xbmc.log(url + " " + filename + "   " + str(params))
    dw = downloader.SimpleDownloader()
    dw.download(filename, params)
def download_trailer(local_path, remote_url, trailer_id):
     # if remote_url is None, trailer is already downloaded, do nothing
    if not remote_url:
        return
    sd = SimpleDownloader.SimpleDownloader()
    if '?|User-Agent=' in remote_url:
        remote_url, useragent = remote_url.split('?|User-Agent=')
        # Override User-Agent because SimpleDownloader doesn't support that
        # native. Downloading from apple requires QT User-Agent
        sd.common.USERAGENT = useragent
    download_path, filename = os.path.split(local_path)
    params = {'url': remote_url,
              'download_path': download_path}
    # start the download in background
    sd.download(filename, params)
    # set the setting - if the download is not finished but playback is tried,
    # the check isfile will fail and it won't be there before finish
    plugin.set_setting(trailer_id, local_path)
    __log('start downloading: %s to path: %s' % (filename, download_path))
示例#16
0
    def downloadVideo(self, video):
        ok = True

        my_downloader = downloader.SimpleDownloader()
        try:
            if my_downloader.isRTMPInstalled():
                url = video[self.PARAM_VIDEO_ID]

                if isinstance(self.PARSER, LiveParser):
                    hd, params = self.PARSER.decode_link(hd)

                    params["download_path"] = self.DOWNLOADDIR
                    params["Title"] = video[self.PARAM_VIDEO_NAME]
                    params["use_rtmpdump"] = True

                else:
                    params = {
                        "url": url,
                        "download_path": self.DOWNLOADDIR,
                        "Title": video[self.PARAM_VIDEO_NAME]
                    }

                name = "%s.mp4" % (video[self.PARAM_VIDEO_NAME])
                my_downloader.download(name, params, False)

            else:
                print("You must install rtmpdump")
                xbmc.executebuiltin(
                    "XBMC.Notification(%s,%s)" %
                    ("ERROR downloadVideo", "You must install rtmpdump"))

        except Exception, msg:
            print("Error downloadVideo : %s", msg)
            print_exc()
            item = my_downloader._getNextItemFromQueue()

            if item is not None:
                (item_id, item) = item
                my_downloader._removeItemFromQueue(item_id)

            xbmc.executebuiltin("XBMC.Notification(%s,%s)" %
                                ("ERROR downloadVideo", msg))
def downloadVideo(id):
    downloader = SimpleDownloader.SimpleDownloader()
    content = getUrl2("http://www.dailymotion.com/embed/video/"+id)
    match = re.compile('<title>(.+?)</title>', re.DOTALL).findall(content)
    global downloadDir
    if not downloadDir:
        xbmc.executebuiltin('XBMC.Notification(Download:,'+translation(30110)+'!,5000)')
        return    
    url = getStreamUrl(id)
    filename = ""
    try:
        filename = (''.join(c for c in unicode(match[0], 'utf-8') if c not in '/\\:?"*|<>')).strip()
    except:
        filename = id
    filename+=".mp4"
    if not os.path.exists(os.path.join(downloadDir, filename)):
        params = { "url": url, "download_path": downloadDir }
        downloader.download(filename, params)
    else:
        xbmc.executebuiltin('XBMC.Notification(Download:,'+translation(30109)+'!,5000)')
示例#18
0
def downloadImage(url, title):
    downloader = SimpleDownloader.SimpleDownloader()
    global downDir
    while not downDir:
        xbmc.executebuiltin('XBMC.Notification(Download:,' +
                            translation(30186) + '!,5000)')
        addon.openSettings()
        downDir = addon.getSetting("downDir")
    try:
        filename = (''.join(
            c for c in unicode(title, 'utf-8')
            if c not in '/\\:?"*|<>')).strip() + "." + url.split(".")[-1]
    except:
        filename = url.split("/")[-1]
    if not os.path.exists(os.path.join(downDir, filename)):
        params = {"url": url, "download_path": downDir}
        downloader.download(filename, params)
    else:
        xbmc.executebuiltin('XBMC.Notification(Download:,' +
                            translation(30185) + '!,5000)')
示例#19
0
def download_file(stream_url, title):
    """ thanks/credit to TheCollective for SimpleDownloader module"""
    path = addon.getSetting('download')
    if path == "":
        xbmc.executebuiltin("Notification(%s,%s,10000,%s)"
                            % (language(30038), language(30037), addon_icon))
        addon.openSettings()
        path = addon.getSetting('download')
    if path == "":
        return
    addon_log('######### Download #############')
    file_downloader = Downloader.SimpleDownloader()
    invalid_chars = ['>', '<', '*', '/', '\\', '?', '.']
    for i in invalid_chars:
        title = title.replace(i, '')
    name = '%s.%s' % (title.replace(' ', '_'), stream_url.split('.')[-1])
    addon_log('Title: %s - Name: %s' % (title, name))
    download_params = {"url": stream_url, "download_path": path, "Title": title}
    addon_log(str(download_params))
    file_downloader.download(name, download_params)
    addon_log('################################')
示例#20
0
def download_trailer(download_url, play_url):
    import SimpleDownloader
    sd = SimpleDownloader.SimpleDownloader()
    sd.common.USERAGENT = USER_AGENT
    download_path = plugin.get_setting('trailer_download_path')
    while not download_path:
        try_again = xbmcgui.Dialog().yesno(
            _('no_download_path'),
            _('want_set_now')
        )
        if not try_again:
            return
        plugin.open_settings()
        download_path = plugin.get_setting('trailer_download_path')
    filename = download_url.split('/')[-1]
    params = {
        'url': download_url,
        'download_path': download_path
    }
    sd.download(filename, params)
    downloads = plugin.get_storage('downloads')
    downloads[play_url] = xbmc.translatePath(download_path + filename)
    downloads.sync()
示例#21
0
ADDON_NAME = addon.getAddonInfo('name')
REAL_SETTINGS = xbmcaddon.Addon(id=addnon_id)
ADDON_SETTINGS = REAL_SETTINGS.getAddonInfo('profile')
MediaList_LOC = xbmc.translatePath(os.path.join(ADDON_SETTINGS,'MediaList.xml'))
STRM_LOC = xbmc.translatePath(os.path.join(ADDON_SETTINGS,'STRM_LOC'))
profile = xbmc.translatePath(addon.getAddonInfo('profile').decode('utf-8'))
home = xbmc.translatePath(addon.getAddonInfo('path').decode('utf-8'))
favorites = os.path.join(profile, 'favorites')
history = os.path.join(profile, 'history')
dialog = xbmcgui.Dialog()
icon = os.path.join(home, 'icon.png')
iconRemove = os.path.join(home, 'iconRemove.png')
FANART = os.path.join(home, 'fanart.jpg')
source_file = os.path.join(home, 'source_file')
functions_dir = profile
downloader = downloader.SimpleDownloader()
debug = addon.getSetting('debug')

if os.path.exists(favorites) == True:
    FAV = open(favorites).read()
else: FAV = []
if os.path.exists(favorites) == True:
    FAV = open(favorites).read()
else: FAV = []

DIRS = []
STRM_LOC = xbmc.translatePath(addon.getSetting('STRM_LOC'))

def requestItem(file, fletype='video'):
    utils.addon_log("requestItem") 
    json_query = ('{"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["thumbnail","fanart","title","year","mpaa","imdbnumber","description","season","episode","playcount","genre","duration","runtime","showtitle","album","artist","plot","plotoutline","tagline","tvshowid"]}, "id": 1}')
    # import urlresolver                      # @UnresolvedImport
    # import metahandler                      # @UnresolvedImport
    # from metahandler import metahandlers    # @UnresolvedImport
    # for obj in dir(metahandlers):
    #     print obj
    #
    # print urlresolver.resolve('https://www.youtube.com/watch?v=EiOglTERPEo')

    # print importador.getServicesFor('script.module.simple.downloader')
    # importador.initService('script.module.simple.downloader')
    # a, b, c = arunner.run('plugin://plugin.video.youtube/?action=play_video&videoid=EiOglTERPEo')
    # url = c.getProperty('path')
    # url = 'https://r4---sn-buu-hp5l.googlevideo.com/videoplayback?sparams=dur%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&ip=181.49.95.60&mn=sn-buu-hp5l&sver=3&id=o-AApZxS37lQbi16dRPKNx7d3ErIMj8_z6uk0NkDFd9V56&mm=31&expire=1460025286&ms=au&mt=1460003528&mv=m&pl=22&upn=99Dq5s58WAs&itag=22&source=youtube&signature=61241BFA7BD5528EA1F4F63C8D2583AFE49FF435.98F74D1CF12D7047A3C4D00D9F776509B96DF3BD&requiressl=yes&mime=video%2Fmp4&dur=2811.750&ipbits=0&initcwndbps=432500&fexp=9416891%2C9418642%2C9419452%2C9420452%2C9422596%2C9423348%2C9423794%2C9426927%2C9427902%2C9428398%2C9431117%2C9431841%2C9431849%2C9432435%2C9433115%2C9433294%2C9433463&key=yt6&lmt=1429169029996832&ratebypass=yes'
    url = r'file:///C:/Users/Alex%20Montes%20Barrios/Pictures/Friends/Fotos%20de%20KIKI/224302_10150240242472578_5694922_n.jpg'
    filename = 'downloadertest.mp4'
    params = {'url': url, 'download_path': 'c:/testFiles/downloads'}
    import SimpleDownloader
    smpDwn = SimpleDownloader.SimpleDownloader()
    smpDwn.download(filename, params)  # import xbmc, xbmcaddon

    # res = xbmc.translatePath('special://skin')
    # addon = xbmcaddon.Addon('plugin.video.youtube')
    # res = addon.getAddonInfo('path')
    # res = addon.getLocalizedString(30009)
    # res = addon.getSetting('kodion.support.alternative_player')

    # arunner.run('plugin://script.common.plugin.cache/?')
    # worker = Thread(target=arunner.run, args=('plugin://script.common.plugin.cache/?',))
    # worker.start()
    pass
示例#23
0
 def LaunchDownload(self):
     try:
         launching = True
         step = 0
         progress_launch = xbmcgui.DialogProgress()
         progress_launch.create('Séquence de lancement video')
         #Boucle lancement d'une video
         while launching:
             if progress_launch.iscanceled():
                 progress_launch.close()
                 launching = False
                 time.sleep(0.1)
             #ETAPE 0  : démarrage
             if step == 0:
                 try:
                     progress_launch.update(0, 'Démarrage...')
                     step = 1
                     time.sleep(0.1)
                 except:
                     print_exc()
                     progress_launch.close()
                     xbmc.executebuiltin(
                         'XBMC.Notification("StreamLauncher","Erreur lors de la création du lanceur",5000)'
                     )
                     launching = False
                     time.sleep(0.1)
             #ETAPE 1 : définition de videoPlayerUrl --> url qui sera téléchargée
             if step == 1:
                 try:
                     #si débridage
                     if self.needdebrid:
                         progress_launch.update(10, 'Débridage...')
                         self.debridurl = urlresolver.HostedMediaFile(
                             url=self.linkurl).resolve()
                         progress_launch.update(
                             30, 'Définition de l\'url de la video lue...')
                         if self.debridurl:
                             self.videoPlayerUrl = self.debridurl
                             step = 2
                             time.sleep(0.1)
                         else:
                             progress_launch.close()
                             xbmc.executebuiltin(
                                 'XBMC.Notification("StreamLauncher","Erreur lors du débridage de la video",5000)'
                             )
                             launching = False
                             time.sleep(0.1)
                     # si non débridage
                     elif not self.needdebrid:
                         progress_launch.update(30,
                                                'Définition de l\'url...')
                         self.videoPlayerUrl = self.linkurl
                         step = 2
                         time.sleep(0.1)
                 except:
                     print_exc()
                     progress_launch.close()
                     xbmc.executebuiltin(
                         'XBMC.Notification("StreamLauncher","Erreur lors de la définition de l\'url de la video lue",5000)'
                     )
                     launching = False
                     time.sleep(0.1)
             #ETAPE 2 : Définition et création du répertoire local
             if step == 2:
                 try:
                     progress_launch.update(35, 'Répertoire local...')
                     #Si lien fait appel à un autre plugin :
                     if self.videoPlayerUrl[:6] == 'plugin':
                         progress_launch.update(
                             90, 'Lancement d\'un autre plugin XBMC...')
                         progress_launch.close()
                         launching = False
                         time.sleep(0.1)
                         xbmc.executebuiltin('XBMC.RunPlugin(' +
                                             self.videoPlayerUrl + ')')
                     #Sinon répertoire de destination :
                     else:
                         self.videolocalfolder, self.videolocalname, self.extension = self.getVideoLocalTree(
                             self.videoPlayerUrl, self.dlfolder)
                         progress_launch.update(50,
                                                'Répertoire local OK...')
                         step = 3
                         time.sleep(0.1)
                 except:
                     print_exc()
                     progress_launch.close()
                     xbmc.executebuiltin(
                         'XBMC.Notification("StreamLauncher","Erreur lors de l\'envoie de l\'url définie à XBMC",5000)'
                     )
                     launching = False
                     time.sleep(0.1)
             #ETAPE 3 : création de l'instance du downloader
             if step == 3:
                 try:
                     progress_launch.update(60, 'Downloader...')
                     #création de l'instance du downloader (SimpleDownloader)
                     import SimpleDownloader as simpledownloader
                     self.downloader = simpledownloader.SimpleDownloader()
                     params = {
                         "url": self.videoPlayerUrl,
                         "download_path": self.videolocalfolder,
                         "Title": self.infos['Title']
                     }
                     progress_launch.update(80, 'Downloader OK...')
                     step = 4
                     time.sleep(0.1)
                 except:
                     print_exc()
                     progress_launch.close()
                     xbmc.executebuiltin(
                         'XBMC.Notification("StreamLauncher","Erreur lors de la création de l\'instance du downloader",5000)'
                     )
                     launching = False
                     time.sleep(0.1)
             #ETAPE 4 : Download
             if step == 4:
                 try:
                     progress_launch.update(90,
                                            'Lancement du téléchargement')
                     self.downloader.download(self.videolocalname, params)
                     xbmcplugin.endOfDirectory(int(sys.argv[1]),
                                               succeeded=True)
                     progress_launch.close()
                     launching = False
                     time.sleep(0.1)
                 except:
                     print_exc()
                     progress_launch.close()
                     xbmc.executebuiltin(
                         'XBMC.Notification("StreamLauncher","Erreur lors de lancement du téléchargement",5000)'
                     )
                     launching = False
                     time.sleep(0.1)
     except:
         print_exc()