def image(manga,chapter=1,page=0): nextPage = int(page) + 1 nextChapter = int(chapter) + 1 nextPageUrl = '/'+manga+'/'+str(chapter)+'/'+str(nextPage) nextChapterUrl = '/'+manga+'/'+str(nextChapter)+'/0' imgUrl = mfetcher.get_page_url_from_coordinates(manga,chapter,page) nextImgUrl = mfetcher.get_page_url_from_coordinates(manga,chapter,nextPage) templatePage = ''' <html> <head> </head> <body> <a href="{{nextPageUrl}}"> <img style="width:100%" src="{{imgUrl}}" /> </a> <br /> <br /> Powered by <a href="http://mangaeden.com">mangaeden.com</a> </body> </html> ''' nextUrl = nextPageUrl if nextImgUrl == None: nextUrl = nextChapterUrl return template(templatePage,nextPageUrl=nextUrl, imgUrl=imgUrl)
chapter = sys.argv[3] if len(sys.argv) > 4: page = sys.argv[4] if command == "update": mfetcher.updateMangaDb() sys.exit(0) if command == "fetch": mfetcher.fetch(manga_name, chapter) sys.exit(0) if command == "url": url = mfetcher.get_page_url_from_coordinates(manga_name, chapter, page) print url sys.exit(0) # r = requests.get(base_mangaeden_url + "/0?p=1") # for manga in r.json()["manga"]: # print manga["a"], "\t", manga["i"] except SystemExit, e: sys.exit(e) except: e = sys.exc_info()[1] print e sys.exit(1)