示例#1
0
def crearDirectorio(capitulo = Capitulo, manga = Manga):    
    stringCode = funciones.agregaCeros(capitulo.code, config.CONST_CANTIDAD_CERO_FOLDER)
    dirName = getMangaDownloadFolder(manga.uCode, "C%s"%stringCode)   
    dirName = funciones.decode(dirName)
    capitulo.folder = dirName
    #if capitulo.length > 0:
    makeDir(dirName)
    #else:
    #    log.error("El capítulo [%s] no tiene imágenes"%capitulo.code)
    return capitulo
示例#2
0
def obtenerCapitulos(manga = Manga, urlCapitulos = '', parametros = ParamDescarga):
    codCapituloIni = parametros.codCapitulo
    pat = re.compile('<select class="cbo_wpm_chp" onchange="[^"]+">(.+?)</select>')
    http = httplib2.Http()
    headers, body = http.request(urlCapitulos)
    li = pat.findall("%s"%body)
    listCapsRet = []
    lst=[]
    strOption = str(li[0])
    strOption = strOption.replace('selected="selected"', '')
    pat2 = re.compile('<option value="(.+?)" >(.+?)</option>')
    lstCaps = pat2.findall("%s"%strOption)
    total = len(lstCaps)
    totPre = len(str(total))
    manga.length = total
#    print lstCaps
#    exit(0)
    if(total > 1):        
        lstCaps = sorted(lstCaps, key=funciones.splittedname)
    if(codCapituloIni is not None):
        for cap in lstCaps:
            codCap = funciones.prefijo(cap[0], totPre)
            capIni = funciones.prefijo(str(codCapituloIni), totPre)
            codCap = funciones.decode(codCap)
            if(parametros.tipo == TYPE.UNIQUE and codCap == capIni):
                listCapsRet.append(cap)
                break
            if (codCap >= capIni and parametros.tipo != TYPE.UNIQUE):
                listCapsRet.append(cap)
    else:
        listCapsRet = lstCaps

    for cap in listCapsRet:
        capitulo = Capitulo(None, cap[1])
        capitulo.code = str(cap[0])
        capitulo.url = "%s%s/"%(manga.url, capitulo.code)
        lst.append(capitulo)        
    return lst, manga