def play_video(item, VideoItem = None):
  if item.server == "torrent":
    if VideoItem is not None:
      from core import torrent_player
      torrent_player.download(item, VideoItem, True)
  else:
    guitools.play(item, VideoItem)
def play_video(item, VideoItem=None):
    if item.server == "torrent":
        if VideoItem is not None:
            from core import torrent_player
            torrent_player.download(item, VideoItem, True)
    else:
        guitools.play(item, VideoItem)
Esempio n. 3
0
def download(item):
    logger.info("[descargas.py] download")
    filepath = os.path.join(DOWNLOAD_PATH, item.title)
    video_urls, puedes, motivo = servertools.resolve_video_urls_for_playing(
        item.server, item.url, "", False)

    # Laúltima es la de mayor calidad, lo mejor para la descarga
    mediaurl = video_urls[len(video_urls) - 1][1]

    # Genera el NFO
    outfile = open(filepath + ".nfo", "w")
    outfile.write("<movie>\n")
    outfile.write("<title>(" + item.title + ")</title>\n")
    outfile.write("<originaltitle></originaltitle>\n")
    outfile.write("<rating>0.000000</rating>\n")
    outfile.write("<year>2009</year>\n")
    outfile.write("<top250>0</top250>\n")
    outfile.write("<votes>0</votes>\n")
    outfile.write("<outline></outline>\n")
    outfile.write("<plot>" + item.plot + "</plot>\n")
    outfile.write("<tagline></tagline>\n")
    outfile.write("<runtime></runtime>\n")
    outfile.write("<thumb>" + item.thumbnail + "</thumb>\n")
    outfile.write("<mpaa>Not available</mpaa>\n")
    outfile.write("<playcount>0</playcount>\n")
    outfile.write("<watched>false</watched>\n")
    outfile.write("<id>tt0432337</id>\n")
    outfile.write("<filenameandpath></filenameandpath>\n")
    outfile.write("<trailer></trailer>\n")
    outfile.write("<genre></genre>\n")
    outfile.write("<credits></credits>\n")
    outfile.write("<director></director>\n")
    outfile.write("<actor>\n")
    outfile.write("<name></name>\n")
    outfile.write("<role></role>\n")
    outfile.write("</actor>\n")
    outfile.write("</movie>")
    outfile.flush()
    outfile.close()

    # Descarga el thumbnail
    if item.thumbnail != "":
        try:
            downloadtools.downloadfile(item.thumbnail, filepath + ".tbn")
        except:
            logger.info("[descargas.py] error al descargar thumbnail")
            for line in sys.exc_info():
                logger.error("%s" % line)

    #Descarga el vídeo
    if item.server == "torrent":
        from core import torrent_player
        dev = torrent_player.download(item)
    else:
        dev = downloadtools.downloadbest(video_urls, item.title)
    return dev
Esempio n. 4
0
def download(item):
    logger.info("[descargas.py] download")
    filepath = os.path.join( DOWNLOAD_PATH,item.title)
    video_urls,puedes,motivo = servertools.resolve_video_urls_for_playing(item.server,item.url,"",False)
    
    # Laúltima es la de mayor calidad, lo mejor para la descarga
    mediaurl = video_urls[ len(video_urls)-1 ][1]

    # Genera el NFO
    outfile = open(filepath + ".nfo","w")
    outfile.write("<movie>\n")
    outfile.write("<title>("+item.title+")</title>\n")
    outfile.write("<originaltitle></originaltitle>\n")
    outfile.write("<rating>0.000000</rating>\n")
    outfile.write("<year>2009</year>\n")
    outfile.write("<top250>0</top250>\n")
    outfile.write("<votes>0</votes>\n")
    outfile.write("<outline></outline>\n")
    outfile.write("<plot>"+item.plot+"</plot>\n")
    outfile.write("<tagline></tagline>\n")
    outfile.write("<runtime></runtime>\n")
    outfile.write("<thumb>"+item.thumbnail+"</thumb>\n")
    outfile.write("<mpaa>Not available</mpaa>\n")
    outfile.write("<playcount>0</playcount>\n")
    outfile.write("<watched>false</watched>\n")
    outfile.write("<id>tt0432337</id>\n")
    outfile.write("<filenameandpath></filenameandpath>\n")
    outfile.write("<trailer></trailer>\n")
    outfile.write("<genre></genre>\n")
    outfile.write("<credits></credits>\n")
    outfile.write("<director></director>\n")
    outfile.write("<actor>\n")
    outfile.write("<name></name>\n")
    outfile.write("<role></role>\n")
    outfile.write("</actor>\n")
    outfile.write("</movie>")
    outfile.flush()
    outfile.close()
    
    # Descarga el thumbnail
    if item.thumbnail != "":
       try:
           downloadtools.downloadfile(item.thumbnail,filepath + ".tbn")
       except:
           logger.info("[descargas.py] error al descargar thumbnail")
           for line in sys.exc_info():
               logger.error( "%s" % line )
    
    #Descarga el vídeo           
    if item.server =="torrent":
      from core import torrent_player
      dev = torrent_player.download(item)
    else:
      dev = downloadtools.downloadbest(video_urls,item.title)   
    return dev