コード例 #1
0
ファイル: App2.py プロジェクト: priyaihsan/pyeeltube
    def core_download_audio(self):
        try:
            self.file_size = 0

            # --- get path-temp on system based from Temporary moduyle --- #
            path = Temp.system_gettemp()
            # ------------------------------------------------------------ #
            print("Starting download audio...")
            eel.modal_update_status("Downloading audio only...")
            eel.modal_animation_download()
            self.get_audio_default().download(path)

            # --- add fileinfo to download history --- #
            self.add_to_history(path, "audio")
            # ---------------------------------------- #

            # --- add to history download --- #
            self.delete_after_download()
            # ------------------------------- #

            eel.modal_update_status("Ready")
            eel.modal_animation_ready()

            print("Download success.")
        except ValueError as ex:
            print(ex)
コード例 #2
0
ファイル: App2.py プロジェクト: priyaihsan/pyeeltube
    def delete_after_download(self):
        try:
            # --- global initialized --- #
            global history
            global video
            # -------------------------- #

            print("Prepare for cleaning temprorary file(s).")

            # --- adding delay on running the code --- #
            eel.modal_update_status("Cleaning temporary...")
            eel.modal_animation_loading()
            time.sleep(3.5)
            # ---------------------------------------- #

            # --- fetching video path, audio path from history dictionary --- #
            datapath = [
                self.history[cleansing(self.video.title)][x]
                for x in self.history[cleansing(self.video.title)]
            ]
            # --------------------------------------------------------------- #

            # --- removing datafile(s) if exist. (default=True) --- #
            for path in datapath:
                if os.path.isfile(path):
                    os.remove(path)
            # ----------------------------------------------------- #

        # --- raise Exception error --- #
        except Exception as ex:
            print(ex)
コード例 #3
0
ファイル: App2.py プロジェクト: priyaihsan/pyeeltube
        def history_audio():
            # --- joining path and title with static extension --- #
            video_path = os.path.join(path,
                                      cleansing(self.video.title) + ".mp4")
            audio_path = os.path.join(path,
                                      cleansing(self.video.title) + ".mp4")
            # ---------------------------------------------------- #

            # --- merging video audio and fixing video codec by ffmpeg --- #
            eel.modal_update_status("Converting...")
            eel.modal_animation_merging()
            self.merge(video_path, audio_path, "audio")
            # ------------------------------------------------------------ #

            # --- declare dummy History object --- #
            _history = History(self.video.title, video_path, audio_path)
            # ------------------------------------ #

            # --- assignment history to global history based dictionary datatype --- #
            self.history[_history.getKey] = _history.getValue
コード例 #4
0
    def core_download(self, quality):
        try:
            # --- global initialized --- #
            # global history
            # global file_size
            # global result
            # -------------------------- #
            self.file_size = 0

            # --- get path-temp on system based from Temprorary module --- #
            path = Temp.system_gettemp()
            # ------------------------------------------------------------ #

            # --- default is object. bool is False / resolution not identified --- #
            # --- regardless resolution is initialized when tried to download --- #
            if type(quality) != bool:
                print("Please wait until downloading finished...")

                # --- webm opus (160)kbps is priority --- #
                # --- get best audio to download --- #
                eel.modal_update_status("Downloading... (audio)")
                eel.modal_animation_download()
                self.get_audio_default().download(path, "audio")
                # ---------------------------------- #

                # --- determine file size --- #
                self.file_size = quality.filesize
                # --------------------------- #

                # (semi-core as core) with quality based to download (2nd) --- #
                eel.modal_update_status("Downloading... (video)")
                eel.modal_animation_download()
                quality.download(path)
                # ------------------------------------------------------------ #

                # --- core backend process --- #
                # --- adding datainfo to history dictionary --- #
                self.add_to_history(path, "video")
                # --------------------------------------------- #
                # --- immediately delete the temprorary file(s) after all downloaded --- #
                self.delete_after_download()
                # ---------------------------------------------------------------------- #

                eel.modal_update_status("Ready")
                eel.modal_animation_ready()

                print(f"{box.style(6,34,40)}Download completed.{box.end()}")
                print(f"{Fore.GREEN}Ready...{Fore.RESET}")

            # --- regardless resolution is not initialized when tried to download --- #
            else:
                print("can't download. not exist!")

        # --- raise Exception error --- #
        except Exception as ex:
            print(ex)