Commit 560b36df authored by John's avatar John
Browse files

v1.0 srcDownload

parent ab00088b
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
# List of known working sources
+ mangairo
+ ~~mangairo~~ | raised cloudflare protection 
+ asura scans
+ reaper scans
+ nhentai

<span style="color:red"> <span style="font-size: medium; "> If you are experiencing issues with your source, it could indicate that it is utilizing a different structure or has raised its Cloudflare protection. </span> </span>

Keep in mind that you can request implementation of any source, although there is a possibility of rejection.
+47 −44
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ class SourceBase:

    def SetUrl(self, url):
        self.url = url
        self.CheckLink()

    def SetTitle(self, title):
        self.title = title
@@ -41,7 +42,7 @@ class SourceBase:

    def CheckLink(self):
        if 'https://' not in self.url:
            raise NotValidUrl(self.url)
            self.url = 'https://' + self.url

    def CheckFiles(self, path):

@@ -66,9 +67,13 @@ class SourceBase:
            return True
        else:
            return False
    @staticmethod
    def ClearDirectory(path):
        filelist = [f for f in os.listdir(path) if f.endswith(".jpg")]
        for f in filelist:
            os.remove(os.path.join(path, f))

    def FetchImageUrls(self, force_redownload: bool = False):
        if self.url:
        LOGGER.info('Scraping website for images')

        if not self.title:
@@ -87,6 +92,7 @@ class SourceBase:
            are_downloaded = self.CheckFiles(path_to_page_num)

        if are_downloaded is False:
            self.ClearDirectory(self.path)

            options = Options()
            # options.add_argument("--headless")
@@ -122,7 +128,6 @@ class SourceBase:
                raise ImagesNotFoundInRequest(self.image_urls)

            self.WebsiteExceptions()
                LOGGER.info(self.image_urls)
            self.DownloadImages()

    def WebsiteExceptions(self):
@@ -151,8 +156,6 @@ class SourceBase:

        self.SaveNumberOfPages(rf'{self.path}\pages.txt')

        LOGGER.info('Download complete')

    def run(self, url: str, force_redownload: bool, title: str = ''):
        self.SetUrl(url)
        if title:
+1 −0
Original line number Diff line number Diff line
@@ -320,6 +320,7 @@ class MainWindow(FramelessWindow):
            self.opening_dir = False
            LOGGER.exception(e)
            LOGGER.warning("Failed to load project from " + directory)
            LOGGER.warning("If you were trying to download images check IMPLEMENTED_SOURCES.md for more information")
            self.dl_manager.handleRunTimeException(self.tr('Failed to load project ') + directory, '')
            return
        
+10 −9
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ class SourceManager(SourceBase):
        title = self.config_pnl.src_title_flag
        url = self.config_pnl.src_link_flag
        force_redownload = self.config_pnl.src_force_download_flag
        if url:
            LOGGER.info(f'Force download set to {force_redownload}')
            LOGGER.info(f'Url set to {url}')
            LOGGER.info(f'Project title set to {title}')
@@ -25,4 +26,4 @@ class SourceManager(SourceBase):
            LOGGER.info(f'Project path set to {proj_path}')
            if proj_path:
                self.menu.openDir(proj_path)
                LOGGER.info('Download complete')