Exemple #1
0
Fichier : File.py Projet : ag-sd/py
 def __init__(self, file, url=None):
     self.file = file
     self.file_name = os.path.split(file)[1]
     self.url = url
     mime_type = _mime_database.mimeTypeForFile(file)
     os_info = os.stat(file)
     self.file_size = os_info.st_size
     self.access_time = os_info.st_atime
     self.modify_time = os_info.st_mtime
     self.create_time = os_info.st_ctime
     self.mime_type_name = mime_type.name()
     self.mime_type_icon_name = mime_type.iconName()
     self.status = EncoderStatus.READING_METADATA
     self.output_file_dir = TransCodaSettings.get_output_dir()
     self.encoder = TransCodaSettings.get_encoder_name()
     self.encoder_props = TransCodaSettings.get_encoder(
     ) if self.encoder is not None else None
     self.output_file = ""
     self.update_output_file()
     self.history_result = None
     self.encode_start_time = None
     self.encode_end_time = None
     self.encode_output_size = None
     self.encode_command = None
     self.encode_percent = None
     self.encode_messages = None
     self.encode_cpu_time = None
     self.encode_compression_ratio = None
     self.meta_data = {}
Exemple #2
0
 def settings_changed(self, setting, _):
     valid_keys = {SettingsKeys.encoder_path}
     if setting in valid_keys:
         self.encoder.setText(TransCodaSettings.get_encoder_name())
     self.tool_bar.set_encode_state(file_count=self.main_panel.row_count(),
                                    encoder_name=TransCodaSettings.get_encoder_name(),
                                    output_dir=TransCodaSettings.get_output_dir())
Exemple #3
0
 def jobs_complete_event(self, all_results, time_taken):
     self.progressbar.setValue(self.progressbar.maximum())
     self.executor = None
     self.statusBar().showMessage(f"Processed {len(all_results)} files in {time_taken} seconds", msecs=400)
     self.set_window_title()
     self.tool_bar.encoding_finished(file_count=self.main_panel.row_count(),
                                     encoder_name=TransCodaSettings.get_encoder_name(),
                                     output_dir=TransCodaSettings.get_output_dir())
     self.reset_timer()
Exemple #4
0
 def files_changed_event(self, is_added, files):
     if is_added:
         self.statusBar().showMessage("Scanning files please wait...")
         scanner = CommonUtils.FileScanner(files, recurse=True, is_qfiles=True)
         self.statusBar().showMessage(f"Loading files into {TransCoda.__APP_NAME__}")
         # Add files first
         total_added = self.main_panel.add_files(scanner.files)
         # Fetch and enrich with metadata
         batches = []
         for batch in CommonUtils.batch(list(scanner.files), batch_size=20):
             retriever = FileMetaDataExtractor(batch, batch_size=len(batch))
             retriever.signals.result.connect(self.result_received_event)
             batches.append(retriever)
         # UX
         self.begin_tasks(batches, f"Fetching meta-data for {total_added} files", total_added)
     self.tool_bar.set_encode_state(file_count=self.main_panel.row_count(),
                                    encoder_name=TransCodaSettings.get_encoder_name(),
                                    output_dir=TransCodaSettings.get_output_dir())
Exemple #5
0
    def init_ui(self):
        encoder_name = TransCodaSettings.get_encoder_name()
        self.main_panel.set_items(TransCodaSettings.get_encode_list())
        self.main_panel.files_changed_event.connect(self.files_changed_event)
        self.main_panel.menu_item_event.connect(self.action_event)
        self.tool_bar.set_encode_state(file_count=self.main_panel.row_count(),
                                       encoder_name=encoder_name,
                                       output_dir=TransCodaSettings.get_output_dir())
        self.tool_bar.button_pressed.connect(self.action_event)
        self.addToolBar(QtCore.Qt.LeftToolBarArea, self.tool_bar)
        self.setCentralWidget(self.main_panel)
        self.statusBar().addPermanentWidget(QVLine())
        if encoder_name:
            self.encoder.setText(TransCodaSettings.get_encoder_name())
        else:
            self.encoder.setText("No encoder selected.")
        self.terminal_btn.setIcon(TransCoda.theme.ico_terminal)
        self.terminal_btn.setFlat(True)
        self.terminal_btn.setToolTip("Show Encoder Logs")
        self.terminal_btn.clicked.connect(self.show_encode_logs)
        self.statusBar().addPermanentWidget(self.encoder, 0)
        self.statusBar().addPermanentWidget(QVLine())
        self.statusBar().addPermanentWidget(self.progressbar, 0)
        self.statusBar().addPermanentWidget(self.terminal_btn, 0)

        self.setMinimumSize(800, 600)
        self.setWindowTitle(TransCoda.__APP_NAME__)
        self.setWindowIcon(TransCoda.theme.ico_app_icon)
        self.timer.timeout.connect(self.timer_timeout_event)
        self.timer.setInterval(6000)
        self.timer.setSingleShot(True)
        TransCodaSettings.settings.settings_change_event.connect(self.settings_changed)
        TransCodaSettings.settings.load_ui(self, TransCoda.logger)
        self.show()
        # Executed after the show, where all dimensions are calculated
        self.progressbar.setFixedWidth(self.progressbar.width())
        self.progressbar.setVisible(False)
Exemple #6
0
Fichier : File.py Projet : ag-sd/py
 def output_dir_changed(self):
     self.output_file_dir = TransCodaSettings.get_output_dir()
     self.update_output_file()