Package net.sf.jmp3renamer.plugins.Replaygain

Examples of net.sf.jmp3renamer.plugins.Replaygain.ProcessOutputReader


                    Runtime rt = Runtime.getRuntime();
                    String[] arguments = { path, params, file.getAbsolutePath() };
                    process = rt.exec(arguments);

                    // read from stdout and stderr and show results in gui
                    ProcessOutputReader por = toolFactory.createOutputReader(file, process, new ProgressCallback() {
                        @Override
                        public void setStatus(String status) {
                            table.setValueAt(status, row, 1);
                            table.repaint();
                        }

                        @Override
                        public void setProgress(int percentage) {
                            table.setValueAt(percentage+"%", row, 1);
                            table.repaint();
                        }
                    });
                    por.startReading();

                    // wait for the tool to terminate
                    int exitCode = process.waitFor();

                    // increase progrss bar
                    int percent = (int)((double)(i+1) / total * 100);
                    progress.setValue(percent);

                    // show errors
                    if (exitCode != 0) {
                        table.setValueAt(I18N.translate("error.replaygain", path), i, 1);
                        logger.warn(I18N.translate("error.replaygain", path));
                        logger.info(path + " exit code: " + exitCode);
                        // continue with next file
                        success = false;
                        continue;
                    }
                    table.setValueAt(por.getResult(), i, 1);
                } catch (Exception e) {
                    table.setValueAt("Unexpected error: " + e.getLocalizedMessage(), i, 1);
                    logger.warn("Unexpected error", e);
                    success = false;
                }
View Full Code Here

TOP

Related Classes of net.sf.jmp3renamer.plugins.Replaygain.ProcessOutputReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.