Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 6 initial release #362

Merged
merged 47 commits into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
42cec03
Mac OS Build
yermak Oct 29, 2021
d041e26
Merge branch 'issues/312_m4b_optimisatin' into macos
yermak Dec 13, 2021
1e8adde
Merge branch 'feature/318_force_reencoding' into macos
yermak Dec 13, 2021
4148a0c
moved os dependand tools and Dev plugs into Environment
yermak Dec 13, 2021
4608538
Merge branch 'development' into macos
yermak Dec 20, 2021
d7a7259
merge fixes
yermak Dec 20, 2021
e3172b7
fixed macos/windows environment issues
yermak Dec 20, 2021
eef4f07
fixed macos/windows environment issues
yermak Dec 20, 2021
bd62c63
fixed macos/windows environment issues
yermak Dec 20, 2021
1b0ba8f
Merge pull request #341 from yermak/macos
yermak Dec 20, 2021
6e1fd64
fixed version hack
yermak Dec 20, 2021
fd5d7bc
fixed version hack
yermak Dec 20, 2021
fa6300c
clean-up
yermak Dec 20, 2021
7177de8
clean-up
yermak Dec 20, 2021
344c18a
Merge pull request #342 from yermak/clean-up
yermak Dec 20, 2021
fa13b0f
fixed potential image name clash in temp files
yermak Dec 22, 2021
f85a14d
Merge pull request #344 from yermak/issue/343_artwork_conflict
yermak Dec 22, 2021
9dc738d
Fixed random io bug on iOS while searching artwork on samba network d…
yermak Dec 23, 2021
3e003a5
Fixed combining Parts
yermak Dec 23, 2021
f03f61c
Fixed splitting chapters
yermak Dec 23, 2021
843e697
Merge pull request #346 from yermak/issue/345_split_combine
yermak Dec 23, 2021
16af7b6
added Xodus database instead of property file, Moved genres to database
yermak Dec 24, 2021
2b9b105
moved presets to database
yermak Dec 24, 2021
5e63bf1
propperties moved to database
yermak Dec 24, 2021
62ec7e2
renamed properties into settings
yermak Dec 24, 2021
e6f2923
fixed NPE in loading properties from settings db
yermak Dec 25, 2021
6249091
adding lazy reencoding option and fixing optimisation error
yermak Dec 27, 2021
49d81b2
adding lazy reencoding option and fixing optimisation error
yermak Dec 27, 2021
7e7ad8b
Merge pull request #348
yermak Dec 27, 2021
b705e98
Merge pull request #350 from yermak/features/206_avoid_reencoding
yermak Dec 27, 2021
24572e2
adding progress for artwork and optimisation, fixed force reencoding
yermak Dec 28, 2021
0923da5
Merge pull request #351 from yermak/features/332_progress_for_art_wor…
yermak Dec 28, 2021
25be3d3
fixed preset saving behaviour
yermak Dec 28, 2021
5d83963
fixed preset saving behaviour
yermak Dec 28, 2021
955fb44
fixed preset saving behaviour
yermak Dec 28, 2021
622a381
fixed preset saving behaviour
yermak Dec 28, 2021
97922cf
Merge pull request #354 from yermak/issue/347_app_settings
yermak Dec 28, 2021
c59aea2
fixed #269
yermak Dec 28, 2021
61a88d7
Merge pull request #355 from yermak/issues/269_subtracks_single_file
yermak Dec 28, 2021
82c62bf
packaging jdk for xodus
yermak Dec 28, 2021
9c30da0
Merge pull request #356
yermak Dec 28, 2021
3fb7ad5
division by zero fix
yermak Dec 28, 2021
3e04887
Merge pull request #357
yermak Dec 28, 2021
db10c17
fixed optimsation issue with jpg art added as binary data
yermak Dec 29, 2021
bac8f37
Merge pull request #360
yermak Dec 29, 2021
cd3f709
version bump
yermak Dec 29, 2021
0208959
Merge pull request #361
yermak Dec 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clean-up
  • Loading branch information
yermak committed Dec 20, 2021
commit 7177de8404f61a88894463a2fe730eee284a0b63
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
<version>2.11.0</version>
<scope>compile</scope>
</dependency>

Expand All @@ -83,7 +83,7 @@
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.1.0</version>
<version>11.1.1</version>
<exclusions>
<exclusion>
<groupId>org.openjfx</groupId>
Expand All @@ -95,13 +95,13 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
<version>2.8.9</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1.1-jre</version>
<version>31.0.1-jre</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import org.controlsfx.control.Notifications;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.yermak.audiobookconverter.AppProperties;
import uk.yermak.audiobookconverter.Utils;
import uk.yermak.audiobookconverter.Version;
import uk.yermak.audiobookconverter.fx.ConversionContext;
import uk.yermak.audiobookconverter.fx.JfxEnv;
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/uk/yermak/audiobookconverter/ConversionGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,13 @@ public void launch(ListView<ProgressComponent> progressQueue, ProgressComponent
Chapter chapter = chapters.get(i);
String finalDesination = outputDestination;
if (chapters.size() > 1) {
finalDesination = finalDesination.replace("." + format.toString(), ", Chapter " + (i + 1) + "." + format.toString());
finalDesination = finalDesination.replace("." + format.toString(), ", Chapter " + (i + 1) + "." + format);
}
String finalName = new File(finalDesination).getName();
logger.debug("Adding conversion for chapter {}", finalName);

ConversionProgress conversionProgress = this.start(chapter, finalDesination);
Platform.runLater(() -> {
progressQueue.getItems().add(0, new ProgressComponent(conversionProgress));
});
Platform.runLater(() -> progressQueue.getItems().add(0, new ProgressComponent(conversionProgress)));

}
} else {
Expand All @@ -156,15 +154,13 @@ public void launch(ListView<ProgressComponent> progressQueue, ProgressComponent
Part part = parts.get(i);
String finalDesination = outputDestination;
if (parts.size() > 1) {
finalDesination = finalDesination.replace("." + format.toString(), ", Part " + (i + 1) + "." + format.toString());
finalDesination = finalDesination.replace("." + format.toString(), ", Part " + (i + 1) + "." + format);
}
String finalName = new File(finalDesination).getName();
logger.debug("Adding conversion for part {}", finalName);

ConversionProgress conversionProgress = this.start(part, finalDesination);
Platform.runLater(() -> {
progressQueue.getItems().add(0, new ProgressComponent(conversionProgress));
});
Platform.runLater(() -> progressQueue.getItems().add(0, new ProgressComponent(conversionProgress)));
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/main/java/uk/yermak/audiobookconverter/ConversionJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public void run() {

String tempFile = Utils.getTmp(jobId, outputDestination.hashCode(), conversionGroup.getWorkfileExtension());

File metaFile = null;
try {
// conversion.getOutputParameters().updateAuto(conversion.getMedia());

Expand Down Expand Up @@ -94,8 +93,6 @@ public void run() {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
error(e.getMessage() + "; " + sw.getBuffer().toString());
} finally {
FileUtils.deleteQuietly(metaFile);
}
}

Expand Down
9 changes: 4 additions & 5 deletions src/main/java/uk/yermak/audiobookconverter/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ protected String getAppPath() {
}

@Override
protected File getConfigFilePath(File file) {
protected File getConfigFilePath() {
return new File(getAppPath(), "Contents/app/path.properties");
}
},

LINUX {
@Override
protected File getConfigFilePath(File file) {
protected File getConfigFilePath() {
return new File("../lib/app/path.properties");

}
Expand Down Expand Up @@ -83,14 +83,13 @@ protected String getAppPath() {
return "";
}

protected File getConfigFilePath(File file) {
protected File getConfigFilePath() {
return new File("app/path.properties");
}

synchronized Properties loadAppProperties() {
if (properties.isEmpty()) {
File file = null;
file = getConfigFilePath(file);
File file = getConfigFilePath();

if (file.exists()) {
try (FileInputStream in = new FileInputStream(file)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ static void parseCue(MediaInfoBean mediaInfo, String cue) {
private static long parseCueTime(String substring) {
String cleanText = cleanText(substring);
String[] split = cleanText.split(":");
long time = 1000 * (Integer.parseInt(split[0]) * 60 + Integer.parseInt(split[1])) + Integer.parseInt(split[2]) * 1000 / 75;
return time;
return 1000 * (Integer.parseInt(split[0]) * 60 + Integer.parseInt(split[1])) + Integer.parseInt(split[2]) * 1000 / 75;
}

private static String cleanText(String text) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class FFMpegConcatenator {
private final ProgressCallback callback;
private ProgressParser progressParser;
private List<String> tmpFiles = new ArrayList<>();
private String fileListFileName;

public FFMpegConcatenator(ConversionJob conversionJob, String outputFileName, MetadataBuilder metadataBuilder, List<MediaInfo> media, ProgressCallback callback) {
this.conversionJob = conversionJob;
Expand All @@ -49,14 +48,12 @@ protected static File prepareFiles(long jobId, List<MediaInfo> media, String wor

public void concat() throws IOException, InterruptedException {
if (conversionJob.getStatus().isOver()) return;
fileListFileName = prepareFiles(conversionJob.jobId, media, conversionJob.getConversionGroup().getWorkfileExtension()).getAbsolutePath();
String fileListFileName = prepareFiles(conversionJob.jobId, media, conversionJob.getConversionGroup().getWorkfileExtension()).getAbsolutePath();

while (ProgressStatus.PAUSED.equals(conversionJob.getStatus())) Thread.sleep(1000);
callback.reset();
try {
progressParser = new TcpProgressParser(progress -> {
callback.converted(progress.out_time_ns / 1000000, progress.total_size);
});
progressParser = new TcpProgressParser(progress -> callback.converted(progress.out_time_ns / 1000000, progress.total_size));
progressParser.start();
} catch (URISyntaxException e) {
}
Expand All @@ -83,15 +80,15 @@ public void concat() throws IOException, InterruptedException {
while (!conversionJob.getStatus().isOver() && !finished) {
finished = process.waitFor(500, TimeUnit.MILLISECONDS);
}
logger.debug("Concat Out: {}", out.toString());
logger.error("Concat Error: {}", err.toString());
logger.debug("Concat Out: {}", out);
logger.error("Concat Error: {}", err);

if (process.exitValue() != 0) {
throw new ConversionException("Concatenation exit code " + process.exitValue() + "!=0", new Error(err.toString()));
}

if (!new File(outputFileName).exists()) {
throw new ConversionException("Concatenation failed, no output file:" + out.toString(), new Error(err.toString()));
throw new ConversionException("Concatenation failed, no output file:" + out, new Error(err.toString()));
}
} catch (Exception e) {
logger.error("Error during concatination of files:", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public String call() throws Exception {
while (!conversionJob.getStatus().isOver() && !finished) {
finished = process.waitFor(500, TimeUnit.MILLISECONDS);
}
logger.debug("ffmpeg out: {}", out.toString());
logger.warn("ffmpeg err: {}", err.toString());
logger.debug("ffmpeg out: {}", out);
logger.warn("ffmpeg err: {}", err);

DurationVerifier.ffMpegUpdateDuration(mediaInfo, outputFileName);
return outputFileName;
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/uk/yermak/audiobookconverter/FFMpegOptimizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ public class FFMpegOptimizer {
private String tempFile;
private final String outputFileName;

private final ProgressCallback callback;
private ProgressParser progressParser;


public FFMpegOptimizer(ConversionJob conversionJob, String tempFile, String outputFileName, ProgressCallback callback) {
this.conversionJob = conversionJob;
this.tempFile = tempFile;
this.outputFileName = outputFileName;
this.callback = callback;
}


Expand All @@ -45,7 +43,7 @@ public void moveResultingFile() {
}
}

private void optimize() throws IOException, InterruptedException {
private void optimize() throws InterruptedException {
if (conversionJob.getStatus().isOver()) return;
while (ProgressStatus.PAUSED.equals(conversionJob.getStatus())) Thread.sleep(1000);
// callback.reset();
Expand Down Expand Up @@ -88,15 +86,15 @@ private void optimize() throws IOException, InterruptedException {
while (!conversionJob.getStatus().isOver() && !finished) {
finished = process.waitFor(500, TimeUnit.MILLISECONDS);
}
logger.debug("Optimize Out: {}", out.toString());
logger.error("Optimize Error: {}", err.toString());
logger.debug("Optimize Out: {}", out);
logger.error("Optimize Error: {}", err);

if (process.exitValue() != 0) {
throw new ConversionException("Optimisation exit code " + process.exitValue() + "!=0", new Error(err.toString()));
}

if (!new File(Utils.getTmp(conversionJob.jobId, outputFileName.hashCode()+1, conversionJob.getConversionGroup().getWorkfileExtension())).exists()) {
throw new ConversionException("Optimisation failed, no output file:" + out.toString(), new Error(err.toString()));
throw new ConversionException("Optimisation failed, no output file:" + out, new Error(err.toString()));
}
} catch (Exception e) {
logger.error("Error during optimisation of resulting file:", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public ArtWork call() throws Exception {
while (!conversionGroup.isOver() && !finished) {
finished = process.waitFor(500, TimeUnit.MILLISECONDS);
}
FFMediaLoader.logger.debug("ArtWork Out: {}", out.toString());
FFMediaLoader.logger.error("ArtWork Error: {}", err.toString());
FFMediaLoader.logger.debug("ArtWork Out: {}", out);
FFMediaLoader.logger.error("ArtWork Error: {}", err);

ArtWorkBean artWorkBean = new ArtWorkBean(poster);
Platform.runLater(() -> {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/uk/yermak/audiobookconverter/MediaInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public interface MediaInfo extends Organisable {

void setChapter(Chapter chapter);

public Chapter getChapter();
Chapter getChapter();

public int getUID();
int getUID();
}


Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package uk.yermak.audiobookconverter;

import java.util.List;
import java.util.Objects;
import java.util.concurrent.Future;

public class MediaInfoProxy implements MediaInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void coverArt(String outputFileName) throws IOException, InterruptedExcep
}
}

public void updateSinglePoster(ArtWork poster, int index, String outputFileName) throws IOException, InterruptedException {
public void updateSinglePoster(ArtWork poster, int index, String outputFileName) {
Process process = null;
try {
ProcessBuilder artProcessBuilder = new ProcessBuilder(Environment.MP4ART,
Expand All @@ -53,15 +53,15 @@ public void updateSinglePoster(ArtWork poster, int index, String outputFileName)
while (!conversionJob.getStatus().isOver() && !finished) {
finished = process.waitFor(500, TimeUnit.MILLISECONDS);
}
logger.debug("mp4art out: {}", out.toString());
logger.warn("mp4art err: {}", err.toString());
logger.debug("mp4art out: {}", out);
logger.warn("mp4art err: {}", err);

if (process.exitValue() != 0) {
throw new ConversionException("ArtWork failed with code " + process.exitValue() + "!=0", new Error(err.toString()));
}

if (!new File(outputFileName).exists()) {
throw new ConversionException("ArtWork failed, no output file:" + out.toString(), new Error(err.toString()));
throw new ConversionException("ArtWork failed, no output file:" + out, new Error(err.toString()));
}
} catch (Exception e) {
logger.error("Failed to apply art work", e);
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/uk/yermak/audiobookconverter/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@ public static String renderPart(Part part, Map<String, Function<Part, Object>> c
ST partTemplate = new ST(g, partFormat);


context.forEach((key, value) -> {
partTemplate.add(key, value.apply(part));
});
context.forEach((key, value) -> partTemplate.add(key, value.apply(part)));

String result = partTemplate.render();
char[] toRemove = new char[]{':', '\\', '/', '>', '<', '|', '?', '*', '"'};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private void initialize() {
year.textProperty().addListener(o -> AudiobookConverter.getContext().getBookInfo().year().set(year.getText()));
comment.textProperty().addListener(o -> AudiobookConverter.getContext().getBookInfo().comment().set(comment.getText()));

AudiobookConverter.getContext().addContextDetachListener(observable -> Platform.runLater(() -> clearTags()));
AudiobookConverter.getContext().addContextDetachListener(observable -> Platform.runLater(this::clearTags));
}

private void updateTags(ObservableList<MediaInfo> media, boolean clear) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ public void movePosterUp(final Integer selected) {
}

public void addPosterIfMissingWithDelay(ArtWork artWork) {
Platform.runLater(() -> {
addPosterIfMissing(artWork);
});
Platform.runLater(() -> addPosterIfMissing(artWork));
}

public void addPosterIfMissing(ArtWork artWork) {
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/uk/yermak/audiobookconverter/fx/DialogHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static List<String> selectFilesDialog() {

Arrays.stream(FILE_EXTENSIONS).map(String::toUpperCase).forEach(filetypes::add);

fileChooser.setTitle("Select " + filetypes.toString() + " files for conversion");
fileChooser.setTitle("Select " + filetypes + " files for conversion");

fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Audio", Arrays.asList(toSuffixes("*.", FILE_EXTENSIONS))));

Expand All @@ -67,8 +67,7 @@ public static List<String> selectFilesDialog() {
File parentFile = firstFile.getParentFile();
AppProperties.setProperty("source.folder", parentFile.getAbsolutePath());
}
List<String> fileNames = collectFiles(files);
return fileNames;
return collectFiles(files);
}

public static List<String> selectFolderDialog() {
Expand All @@ -81,14 +80,13 @@ public static List<String> selectFolderDialog() {

Arrays.stream(FILE_EXTENSIONS).map(String::toUpperCase).forEach(filetypes::add);

directoryChooser.setTitle("Select folder with " + filetypes.toString() + " files for conversion");
directoryChooser.setTitle("Select folder with " + filetypes + " files for conversion");
File selectedDirectory = directoryChooser.showDialog(window);

if (selectedDirectory == null) return null;
AppProperties.setProperty("source.folder", selectedDirectory.getAbsolutePath());

List<String> fileNames = collectFiles(Collections.singleton(selectedDirectory));
return fileNames;
return collectFiles(Collections.singleton(selectedDirectory));
}

static List<String> collectFiles(Collection<File> files) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,9 @@ private void initialize() {
AudiobookConverter.getContext().setSpeed(Double.valueOf(newValue));
});
force.getSelectionModel().select(0);
force.valueProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observableValue, String oldValue, String newValue) {
if (newValue == null) return;
AudiobookConverter.getContext().getOutputParameters().setForce(FORCE.equals(newValue));
}
force.valueProperty().addListener((observableValue, oldValue, newValue) -> {
if (newValue == null) return;
AudiobookConverter.getContext().getOutputParameters().setForce(FORCE.equals(newValue));
});

outputFormatBox.getItems().addAll(Format.values());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
import javafx.scene.control.Spinner;
import javafx.scene.layout.GridPane;
import javafx.stage.Window;
import javafx.util.Callback;
import javafx.util.Pair;
import org.controlsfx.control.ToggleSwitch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.imageio.plugins.tiff.GeoTIFFTagSet;
import java.io.IOException;
import java.lang.invoke.MethodHandles;

Expand Down
Loading