def __init__(self): Manga.__init__(self, 'http://www.niceoppai.net') self.options['urlopen_args'].update({ 'raise404': True, 'raise503': True, 'raisebad': True, })
def get_manga(manga_name): doc_ref = db.collection(u'manga').document(manga_name) doc = doc_ref.get() if(doc.exists): manga_url = doc.to_dict()['url'] my_manga = Manga(name=manga_name, url=manga_url) my_manga.gen_list() chapter_list = [] for chapter in my_manga.chapters: chapter_list.append(chapter.link) res = {"name": my_manga.name, "url": my_manga.url, "links": chapter_list} return jsonify(res) else: res = {"okay": False, "message": "Manga Not Found"} return jsonify(res)
def get_series_url(self, data): if 'series_id' in data: return Manga.get_series_url(self, data) else: d = data d.update({'baseurl': self.baseurl}) return self.NEW_SERIES_URL % d
def get_page_url(self, data): if 'chapter_id' in data: return Manga.get_page_url(self, data) else: d = data d.update({'baseurl': self.baseurl}) return self.NEW_PAGE_URL % d
def __init__(self, client_id: str, client_secret: str): Authenticator.__init__(self, { 'client_id': client_id, 'client_secret': client_secret }) Session.__init__(self) self.anime, self.manga = Anime(), Manga()
def start(manga_csv: str, contact_csv: str) -> list: """This function is to be run at the start of the execution. It will retrieve information from the csv file and create the Manga instances with that information and return them in a list. """ with open(manga_csv, 'r') as csv_file1: csv_reader = csv.DictReader(csv_file1) list_of_mangas = [] for line1 in csv_reader: new_manga = Manga(line1['name'], line1['url'], line1['latest_chapter_url']) list_of_mangas.append(new_manga) # read the recipient information from contact_csv and store it into a dictionary # with the recipients email as the key contact_dict = {} with open(contact_csv, 'r') as contacts: csv_reader = csv.DictReader(contacts) for contact in csv_reader: contact_dict[contact['email']] = { 'email': contact['email'], 'first_name': contact['firstname'], 'last_name': contact['lastname'] } return list_of_mangas, contact_dict
def get_chapter(manga_name, chapter_number): doc_ref = db.collection(u'manga').document(manga_name) doc = doc_ref.get() if(doc.exists): manga_url = doc.to_dict()['url'] my_manga = Manga(name=manga_name, url=manga_url) my_manga.gen_list() chapter_url = my_manga.chapters[int(chapter_number)-1].link chapter_number = int(chapter_number) my_chapter = Chapter(chapter_number=chapter_number, link=chapter_url) my_chapter.gen_images() res = {"chapter_number": int( chapter_number), "okay": "true", "links": my_chapter.image_links} return jsonify(res) else: res = {"okay": "false", "message": "Chapter Not Found"} return jsonify(res)
def addManga(ignore=''): global mangas name=mangaAdd_entry.get().lower() temp = Manga(name) temp.update_chapterList() if len(temp.chapterList_updates)==0: #does this acctually exist? rmtree("files/"+temp.name) #if not exits, then delete what was made else: #update our manga list that we have for x in walk('files'): #same as up top that was to start it all out mangas=x[1] break for x in xrange(len(mangas)): #again, same as up top mangas[x]=Manga(mangas[x]) mangaList.delete(0,END) #clear out the old list for manga in mangas: #bring in the new list mangaList.insert(END,manga.name) mangaList.selection_set(0)#set the default to view at 0 viewManga() #show the info of the first one
def create_list(name: str): lst = [] name = str.upper(name) for el in soup.find_all("tr"): link = "" a = el.find("a", href=True) if a.getText().strip().find(name) != -1: link = a['href'] data = list(filter(None, format_text(el))) manga = Manga(data[0], data[1], data[2], link) lst.append(manga) return lst
def initialize_database(): db.create_all() manga_page = requests.get('http://mangastream.com/manga') manga_tree = html.fromstring(manga_page.content) mangas = manga_tree.xpath('//td/strong/a[@href]') for manga in mangas: mng = Manga(manga.text, manga.attrib['href']) db.session.add(mng) chapter_page = requests.get(mng.link) chapter_tree = html.fromstring(chapter_page.content) chapters = chapter_tree.xpath('//td/a[@href]') for chapter in chapters: ch = Chapter(chapter.text, chapter.attrib['href'], mng) db.session.add(ch) page_page = requests.get(ch.link) page_tree = html.fromstring(page_page.content) try: last_page = page_tree.xpath("//li/a[contains(text(), 'Last Page')]")[0] page_number = int(page_tree.xpath(last_page.text.split('(')[1].split(')')[0])) except: page_number = 1 for i in range(1, page_number): page_link = ch.link[:-1] + str(i) page_link_page = requests.get(page_link) page_link_tree = html.fromstring(page_link_page.content) image_link = page_link_tree.xpath("//div/a/img")[0] page = Page(i, 'http:' + image_link.attrib['src'], ch) db.session.add(page) print(mng.title, ch.title, page.link) db.session.commit()
def __init__(self,parent,name,*args,**kwargs): self.name=name self.manga=Manga(self.name) self.archive=archive(self.name) if not "relief" in kwargs: kwargs["relief"]=RAISED if not "borderwidth" in kwargs: kwargs["borderwidth"]=3 Frame.__init__(self,parent,*args,**kwargs) self.__PICTURE=Label(self,image=self.getImage()) self.__PICTURE.grid(row=0,column=0,sticky=N+S+E+W) self.grid_rowconfigure(0,weight=1) self.grid_columnconfigure(0,weight=1) self.__NAME=Label(self,text=self.name) self.__NAME.grid(row=1,column=0,sticky=S) self.__CHAPTERS=Label(self,text="{} Chapters".format(len(self.manga.chapterList_have))) self.__CHAPTERS.grid(row=2,column=0,sticky=S) self.inProgress=False #to tell if the button should say update or cancel in the lower menu self.downloadInProgress=False self.archivingInProgress=False
def __init__(self): Manga.__init__(self, 'http://manga.animea.net')
def run_script(name, chapters, path): manga = MangaDownload(name) MangaRight = Manga(manga.name, manga.link, chapters, path) MangaRight.download_chapters()
def __init__(self): Manga.__init__(self, 'http://ecchi-manga.net') self.options['urlopen_args'].update({ 'ignore500': True, })
def __init__(self): Manga.__init__(self, 'http://www.mangareader.net')
class MangaFrame(Frame): #self.name ==> name of the manga #self.manga ==> manga object that does the housekeeping like things for us #self.__PICTURE ==> Tkinter.Label that hols the image from self.manga.image and displays it #self.__NAME ==> Tkinter label that says the title of the manga #self.__CHAPTERS ==> Displays how many chapters we have def __init__(self,parent,name,*args,**kwargs): self.name=name self.manga=Manga(self.name) self.archive=archive(self.name) if not "relief" in kwargs: kwargs["relief"]=RAISED if not "borderwidth" in kwargs: kwargs["borderwidth"]=3 Frame.__init__(self,parent,*args,**kwargs) self.__PICTURE=Label(self,image=self.getImage()) self.__PICTURE.grid(row=0,column=0,sticky=N+S+E+W) self.grid_rowconfigure(0,weight=1) self.grid_columnconfigure(0,weight=1) self.__NAME=Label(self,text=self.name) self.__NAME.grid(row=1,column=0,sticky=S) self.__CHAPTERS=Label(self,text="{} Chapters".format(len(self.manga.chapterList_have))) self.__CHAPTERS.grid(row=2,column=0,sticky=S) self.inProgress=False #to tell if the button should say update or cancel in the lower menu self.downloadInProgress=False self.archivingInProgress=False def redraw(self): self.__PICTURE.config(image=self.manga.getImage()) self.manga.update_chapterList_have() self.__CHAPTERS.config(text="%d Chapters"%len(self.manga.chapterList_have)) if(self.numberOfUpdates()==0):self.__setBackgroundColor("light grey") else:self.__setBackgroundColor("green") def bind(self,EVENT_NAME,FUNCTION,ADD=None): # ===== PLEASE ADD TO ME ===== #all new elements this frame ever gets needs to be added to this list #or esle there will be dead spots where clicking does nothing #This must modify the event passed to the widgets so that it calls the frame parent and not the children Labels Frame.bind(self,EVENT_NAME,FUNCTION,ADD) #give the event to the function as if this Frame (aka self) called it #this way if the event is passed to the child, it is instead passed to the frame self.__PICTURE.bind(EVENT_NAME,lambda event: FUNCTION(self.__FIX_EVENT_FOR_BINDING(event)),ADD) self.__NAME.bind(EVENT_NAME,lambda event: FUNCTION(self.__FIX_EVENT_FOR_BINDING(event)),ADD) self.__CHAPTERS.bind(EVENT_NAME,lambda event: FUNCTION(self.__FIX_EVENT_FOR_BINDING(event)),ADD) def __FIX_EVENT_FOR_BINDING(self,event): #assigns ourselves as the calling widget and not any of our children for any event that happens event.widget=self #yes, equals self return event def __setBackgroundColor(self,color): self.config(bg=color) for x in self.winfo_children(): x.config(bg=color) def updateManga(self,LowerFrame): if self.inProgress:return #DONT LET US TRY TO UPDATE THE SAME WAY MULTIPLE TIMES if(self.manga.numberOfUpdates()==0):self.updateManga_check() #check online for updates self.inProgress=True self.LowerFrame=LowerFrame self.downloadInProgress=True self.thread=Thread(target=self.manga.download_updates) self.thread.daemon=True #if the main prog dies, it takes all the threads with it self.thread.start() self.after(10,self.checkUpdate) def updateManga_check(self): if self.inProgress:return #DONT LET US TRY TO UPDATE THE SAME WAY MULTIPLE TIMES self.inProgress=True self.manga.update_chapterList() #check online for updates self.inProgress=False self.redraw() #since our image got screwed with, lets redraw it def checkUpdate(self,*args): self.LowerFrame.redraw() #if something here changed, then make sure to make the user notice if(self.thread.is_alive()): self.after(50,self.checkUpdate) else: print "Finished Updating "+self.getName() self.inProgress=False self.downloadInProgress=False self.redraw() self.LowerFrame.redraw() #fix the updates button self.archiveManga() #we need to update the zip files return def archiveManga(self): if(self.inProgress):return self.inProgress=True self.archivingInProgress=True self.archive.update_chaptersHave() #set it up for things self.thread=Thread(target=self.archive.update_zipFiles) self.thread.daemon=True self.thread.start() self.after(10,self.checkArchive) def checkArchive(self): self.LowerFrame.redraw() if(self.thread.is_alive()): self.after(50,self.checkArchive) else: print "Finished Updating "+self.getName() self.archivingInProgress=False self.inProgress=False self.redraw() self.LowerFrame.redraw() return def cancelUpdate(self): if not self.inProgress:return #we arn't updating so there is no cancel self.manga.cancelCurrentDownload() #this puts up a stop flag and it will finish the chapter and then exit cleanly self.LowerFrame.redraw() def numberOfUpdates(self):return self.manga.numberOfUpdates() def numberOfChapters(self):return self.manga.numberOfChapters() def getStatus(self): if(self.downloadInProgress):return self.manga.getStatus() if(self.archivingInProgress):return self.archive.getStatus() return "" def getSummary(self):return self.manga.getSummary() def getName(self):return self.manga.getName() def getImage(self): self.image=self.manga.getImage() return self.image def getProgress(self): if(self.downloadInProgress): #returns a percentage of X of 100 of how far we are done try:chapterPercentage=(100/self.numberOfUpdates())*(self.manga.curtMangaDownloading()-1) except ZeroDivisionError: chapterPercentage=0 averageNumberOfImagesInAMangaChapter=30 try: imagePercentage=(100/(self.numberOfUpdates()*averageNumberOfImagesInAMangaChapter))*(self.manga.curtImageDownloading()-1) except ZeroDivisionError: imagePercentage=0 return chapterPercentage+imagePercentage if(self.archivingInProgress): return (100/self.numberOfChapters())*self.archive.curtChapter() return 0 #we are doing nothing so no progress
def __init__(self): Manga.__init__(self, 'http://www.nekopost.net')
def __init__(self): Manga.__init__(self, 'http://stoptazmo.com')
def get_page_filename(self, data): if 'volume' in data: return Manga.get_page_filename(self, data) d = data d.update({'baseurl': self.baseurl}) return os.path.join(data['series'], self.NV_PAGE_PATTERN % d)
def get_page_url(self, data): if 'volume' in data: return Manga.get_page_url(self, data) d = data d.update({'baseurl': self.baseurl}) return self.NV_PAGE_URL % d
def get_chapter_url(self, data): if 'volume' in data: return Manga.get_chapter_url(self, data) d = data d.update({'baseurl': self.baseurl}) return self.NV_CHAPTER_URL % d
def __init__(self): # Manga.__init__(self, 'http://www.mangafox.com') Manga.__init__(self, 'http://mangafox.me')
def __init__(self): Manga.__init__(self, 'http://www.doujins.org')
def __init__(self): Manga.__init__(self, 'http://www.otakuworks.com')
def test_check_new_release(self): """make sure that the method returns false """ NARUTO = Manga('Naruto', "https://w11.mangafreak.net/Manga/Naruto", 'http://images.mangafreak.net:8080/downloads/Naruto_700') self.assertFalse(NARUTO.check_new_release())
def __init__(self): Manga.__init__(self, 'http://www.manga-access.com')
miLibrero.agregaRevista( Revista(nombreR="National Geographic", articulosR="Fotografía", editorialR="Zinet Media Global", fechaEmision="noviembre 2017")) # Comic miLibrero.agregarComic( Comic(autor="Gerard Way", titulo="The umbrella academy", anio="2018", editorial="Dark Horse Comics")) # Manga miLibrero.agregarManga( Manga(autorM="Sui ishida", tituloM="Tokyo Ghoul: re", editorialM="Panni")) miLibrero.agregarManga( Manga(tituloM="Suicide boy", autorM="ParkGee", numeroM="57", tomoM="2", editorialM="Lezhin")) miLibrero.agregarManga( Manga(tituloM="Platinum end", autorM="anonimo", numeroM="35", tomoM="1", editorialM="Panni"))
def __init__(self): Manga.__init__(self, 'http://www.doujintoshokan.com', {'Cookie': 'filter=0'})
def __init__(self): Manga.__init__(self, 'http://manga.bleachexile.com')
def test_retrieve_latest_chapter_url(self): """make sure that the method retrieves the correct url """ NARUTO = Manga('Naruto', "https://w11.mangafreak.net/Manga/Naruto", 'http://images.mangafreak.net:8080/downloads/Naruto_700') chapter = int(NARUTO.retrieve_latest_chapter_url()[-3:]) self.assertEqual(chapter, 700)