Ejemplo n.º 1
0
    def __getListEpisode(self):
        """ get list episode from next-episode """
        source = []
        if self.connectSuccess:
            source = self.__getSrcPage("track/?mode=Tree")
        if not source:
            return []

        src = source.split("stopTracking")
        listep = set()

        for i in src[1:]:
            lines = i.split("\n")
            resul = stop.search(lines[0])
            idshow = resul.group(1)
            iduser = resul.group(2)
            tv_name = resul.group(3).lower().replace("\\", "")
            if tv_name not in self.dict_bug:
                self.dict_bug[tv_name] = {}
                name = "_".join(tv_name.split(" ")).lower()
                self.dict_bug[tv_name]["default"] = name
            for i in lines:
                if ("hiddenValues_" + idshow) in i:
                    lepi = i.split('"')[3].split(",")[:-1]
                    for sxe in lepi:
                        idseason, idepisode = sxe.split("x")
                        epitv = episodeTV(
                            tv_name, idseason, idepisode, (idshow, iduser, idseason, idepisode), self.dict_bug[tv_name]
                        )
                        listep.add(epitv)
        listep = sorted(listep, key=attrgetter("tvshow_", "strSeason", "strEpisode"))

        return listep
Ejemplo n.º 2
0
 def findEpOnDisk(self):
     """ return episodes from disk """
     from os import listdir as oslistdir
     from operator import attrgetter
     from util.episodetv import episodeTV
     listep = set()
     
     for dirname in oslistdir('.'):
         try:
             filesInDir = oslistdir(dirname)
         except:
             continue
             # print dirname, "pas un dossier"
         for fileEpi in filesInDir:
             try:
                 tv_name = '_'.join(fileEpi.split('_')[:-1])
                 season_epi = fileEpi.split('_')[-1].split('.')[0]
                 idepi = season_epi[-2:]
                 idseason = season_epi[:-2]
                 epitv = episodeTV(tv_name, idseason, idepi)
                 listep.add(epitv)
             except:
                 print "problem with", fileEpi, "not an epi?"
             
             
     listep = sorted(listep, key=attrgetter('tvshow_', 'strSeason', 'strEpisode'))
     return listep
Ejemplo n.º 3
0
def downSubVid(videoname, options=""):
    """ down subtitle """

    interact = 0
    verbose = 0
    ##process arguments
    if (options):
        if ("i" in options):
            interact = 1
            verbose = 2
        if ("v" in options):
            verbose = 1

    query = '.'.join(videoname.split('/')[-1].split('.')[:-1]).split('_')
    tvshow = '_'.join(query[:-1])
    season = query[-1][:-2]
    episode = query[-1][-2:]

    epi = episodeTV(tvshow, season, episode)
    return downSub(epi, options)
Ejemplo n.º 4
0
        ext = ".flv" #ext[:4]
    if verbose:
        print final_url
    
    return (final_url, filename + ext, cook)

def getFile(source, dest, cook):    

    if (not os.path.isdir(dest.split('/')[0])):
        os.mkdir(dest.split('/')[0])
        
    os.system("wget -c " + source + " -O " + dest)

    return 0

if __name__ == "__main__":
    #flvdown("fringe", "3" , "1", "vi")
    option = ""
    if (len(sys.argv)>4):
        option = sys.argv[4] 
    episode = episodetv.episodeTV(sys.argv[1], sys.argv[2], sys.argv[3])
    url, dest, cook = flvdown(episode, option)
    if url:
        if option:
            print '\ndownloading file', url, 'to', dest
        getFile(url, dest, cook)
    else:
        print cook