def on_btn_test_music_player_program_clicked (self, btn_test_music_player_program): """ """ play_command = self.entry_music_player_program.get_text() process = subprocess.Popen(play_command, shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE) # Wait a bit to kwnon if the process failed inmediatily time.sleep(0.2) returncode = process.poll() title = _("Music player test") if returncode: error_message = _("Cannot open music player:\n\n") stdout = ''.join(process.stdout.readlines()).replace("&","&") stderr = ''.join(process.stderr.readlines()).replace("&","&") error_message = "%s%s%s" % (error_message, stdout, stderr) message.error(title, error_message, self.dialog_settings) else: ok_message = _("The player '%s' works!") % play_command message.info(title, ok_message, self.dialog_settings)
def on_btn_test_music_player_program_clicked( self, btn_test_music_player_program): """ """ play_command = self.entry_music_player_program.get_text() process = subprocess.Popen(play_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # Wait a bit to kwnon if the process failed inmediatily time.sleep(0.2) returncode = process.poll() title = _("Music player test") if returncode: error_message = _("Cannot open music player:\n\n") stdout = ''.join(process.stdout.readlines()).replace("&", "&") stderr = ''.join(process.stderr.readlines()).replace("&", "&") error_message = "%s%s%s" % (error_message, stdout, stderr) message.error(title, error_message, self.dialog_settings) else: ok_message = _("The player '%s' works!") % play_command message.info(title, ok_message, self.dialog_settings)
def update_selected_iters(self): """ Retrieve all the mp3 paths selected with changes pending to update and update them tags. Rename the files if File column have changes. """ APPLOG.info("Update selected mp3 paths with pending changes") # Initialize updates counter total_files_updated = 0 # Gets the mp3 paths to update selected_mp3_paths = self.get_selected_mp3_files() mp3_paths_to_update = self.mp3_store.pending_files_to_update(selected_mp3_paths) if mp3_paths_to_update: # Initialize the progressbar self.progressbarbox.set_property('visible',True) self.progressbarbox.set_new_bar(len(mp3_paths_to_update)) for mp3 in mp3_paths_to_update: # Check if the action is not cancelled if not self.progressbarbox.cancel_action: # Refresh the progressbar self.progressbarbox.next(_("Updating %s...") % mp3) # Update Mp3 tag and rename the filename is_updated = self.mp3_store.update(mp3) # Rename Mp3 file is_renamed = False new_mp3 = self.mp3_store.rename(mp3) if new_mp3: is_renamed = True if mp3 != new_mp3: self.update_mp3_path(mp3,new_mp3) mp3 = new_mp3 if is_updated and is_renamed: self.mp3_store.remove_for_update(mp3) APPLOG.info("'%s' successfully saved" % mp3) total_files_updated += 1 elif not is_updated: APPLOG.info("'%s' not saved" % mp3) message.error(_("Save Mp3 changes"), _("Error while saving Mp3 %s metadata") % mp3, self.get_toplevel()) elif not is_renamed: APPLOG.info("'%s' not renamed" % mp3) message.error(_("Save Mp3 changes"), _("Error while renaming Mp3 %s") % mp3, self.get_toplevel()) else: APPLOG.warning("Save process cancelled") self.progressbarbox.cancel_message() time.sleep(CANCEL_ACTION_SLEEP) break # Hide the progressbar self.progressbarbox.set_property('visible',False) else: APPLOG.info("No changes pending on the selected mp3 files") message.info(_("Update Mp3 files"), _("No changes pending on the selected Mp3 Files."), self.get_toplevel()) return total_files_updated