ephraim / lcurse

Python script to have a "curse" compatible client for linux
The Unlicense
51 stars 24 forks source link

Fix for "Update Catalog" #70

Closed jokust closed 5 years ago

jokust commented 5 years ago

Workaround for Curse's "Enjoy this mod? Support the mod author!" dialog, which interrupts the normal catalog update process.

Philmore971 commented 5 years ago

I modified waitdlg.py with a closed to solution of vellistaulan and the program run. But stop at 99%, don't write or modify the file addon-catalog.json I look for a solution because no warning from the program. And sorry for my bad english :-)

Philmore971 commented 5 years ago

The code modifications of vellistaulan don't work for me. With this code is ok :+1: Please don't forget to supress just to show the change

    def retrievePartialListOfAddons(self, page):
        response = OpenWithRetry("http://www.curseforge.com/wow/addons?page={}".format(page))
        soup = BeautifulSoup(response.read(), "lxml")
        **str = "/download"**
        # Curse returns a soft-500
        if soup.find_all("h2", string="Error"):
            print("Server-side error while getting addon list.")
        lastpage = 1
        if page == 1:
            pager = soup.select("ul.b-pagination-list.paging-list.j-tablesorter-pager.j-listing-pagination li")
            if pager:
                lastpage = int(pager[len(pager) - 2].contents[0].contents[0])
        projects = soup.select("li.project-list-item")  # li .title h4 a")
        self.addonsMutex.lock()
        for project in projects:
            links=project.select("a.button--download")
            texts=project.select("a h2")
            for text in texts:
                nome=text.string.replace('\\r','').replace('\\n','').strip()
                break
            for link in links:
                **if str in link:
                    href=link.get("href").replace("/download",'')
                else:
                    href=link.get("href")**
            self.addons.append([nome, "http://www.curseforge.com{}".format(href)])
        self.progress.emit(len(self.addons))
        self.addonsMutex.unlock()
        self.sem.release()
        return lastpage
ephraim commented 5 years ago

Fixed by the patch of seirl.