def main(): args = options() Y = mangareader(args.url) MANGA = Y.fetch_title_manga() # converte il nome del manga in formato utile per mangareader NAME = Y.convert_name(MANGA) LISTA = sorted(Y.fetch_chapters_manga(NAME)) stampa('Elenco capitoli trovati:') for chapter, number in LISTA: if check_chapter_number(args, int(number)): stampa('-> %s' % chapter) stampa('\nInizio a scaricare i capitoli') for chapter, number in LISTA: if check_chapter_number(args, int(number)): stampa('Scarico capitolo: %s ' % chapter) download_chapter(chapter)
if args.from_chapter <= number: return True else: return False if args.to_chapter: if number <= args.to_chapter: return True else: return False return True if __name__ == "__main__": args = options() Y = mangareader(args.url) MANGA = Y.fetch_title_manga() # converte il nome del manga in formato utile per mangareader NAME = Y.convert_name(MANGA) LISTA = Y.fetch_chapters_manga(NAME) LISTA.sort() # basic sort.. stampa('Elenco capitoli trovati:') for chapter, number in LISTA: if check_chapter_number(args, int(number)): stampa('-> %s' % chapter) stampa('\nInizio a scaricare i capitoli') for chapter, number in LISTA: if check_chapter_number(args, int(number)): stampa('Scarico capitolo: %s ' % chapter) download_chapter(chapter)
def main(): body = '' # fetch new links from website x = mangareader('http://www.mangareader.net/latest') for manga in store.find(Manga): name = x.convert_name(manga.name) links = x.fetch_chapters_manga(name) if links: for link, number in links: if not store.find(Chapter.link, Chapter.link == unicode(link)).count(): new_chapter = store.add(Chapter()) new_chapter.link = unicode(link) new_chapter.status = 0 new_chapter.id_manga = manga.id store.add(new_chapter) store.commit() store.flush() # download links with status 0 rows = store.find(Chapter, Chapter.status == 0) if rows.count(): stampa('Da Scaricare:') for row in rows: stampa(' %s' % row.link) for row in rows: # re-check status, just in case.. this_chap = store.find(Chapter, Chapter.id == row.id) if this_chap[0].status == 2: stampa('Status cambiato per %s' % row.link) continue row.status = 2 row.data = now() store.commit() store.flush() ## stampa('\nScarico %s' % row.link) if download_chapter(row.link): row.status = 1 row.data = now() row.manga.data = now() store.commit() store.flush() body += '\nScaricato %s:\n' % (row.link) else: body += '\nErrore nello scaricare %s:\n' % (row.link) # report links with status 0 rows = store.find(Chapter, Chapter.status == 0) if rows.count(): body += '\n\n###Da scaricare' for row in rows: body += '\nDa scaricare %s:\n' % (row.link) # report links with status 2 rows = store.find(Chapter, Chapter.status == 2) if rows.count(): body += '\n\n###Chapter in via di scaricamento' for row in rows: body += '\n --> %s:\n' % (row.link) if body: send_mail(body)