removed Emotes from code
I have removed the emotes from System.out.println and System.err.println as they did not show in windows CMD
This commit is contained in:
12
pom.xml
12
pom.xml
@@ -20,7 +20,7 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- ✅ JavaFX modules -->
|
||||
<!-- JavaFX modules -->
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
@@ -37,14 +37,14 @@
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ✅ YAML parsing -->
|
||||
<!-- YAML parsing -->
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ✅ XML support -->
|
||||
<!-- XML support -->
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
@@ -54,14 +54,14 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- ✅ Compiler plugin -->
|
||||
<!-- Compiler plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
</plugin>
|
||||
|
||||
<!-- ✅ Jar plugin for manifest -->
|
||||
<!-- Jar plugin for manifest -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
@@ -75,7 +75,7 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- ✅ Shade plugin to bundle everything -->
|
||||
<!-- Shade plugin to bundle everything -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
|
@@ -32,11 +32,11 @@ public class ConfigManager {
|
||||
Yaml yaml = new Yaml(new Constructor(Config.class, new LoaderOptions()));
|
||||
return yaml.load(in);
|
||||
} catch (Exception e) {
|
||||
System.err.println("❌ Failed to load config.yml: " + e.getMessage());
|
||||
System.err.println(" Failed to load config.yml: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("📝 Creating new config.yml...");
|
||||
System.out.println(" Creating new config.yml...");
|
||||
Config config = promptUserConfig();
|
||||
saveConfig(config);
|
||||
convertFallbackToPngIfNecessary(config);
|
||||
@@ -46,13 +46,13 @@ public class ConfigManager {
|
||||
private Config promptUserConfig() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
|
||||
System.out.print("🔗 Enter RadioDJ API URL (e.g., http://localhost:1234/playing): ");
|
||||
System.out.print(" Enter RadioDJ API URL (e.g., http://localhost:1234/playing): ");
|
||||
String apiUrl = scanner.nextLine().trim();
|
||||
|
||||
System.out.print("🖼️ Enter path to album art folder: ");
|
||||
System.out.print(" Enter path to album art folder: ");
|
||||
String artDir = scanner.nextLine().trim();
|
||||
|
||||
System.out.print("🧩 Enter filename of fallback album art (e.g., fallback.jpg): ");
|
||||
System.out.print(" Enter filename of fallback album art (e.g., fallback.jpg): ");
|
||||
String fallback = scanner.nextLine().trim();
|
||||
|
||||
int interval = promptForInterval(scanner);
|
||||
@@ -62,16 +62,16 @@ public class ConfigManager {
|
||||
|
||||
private int promptForInterval(Scanner scanner) {
|
||||
while (true) {
|
||||
System.out.print("⏱️ Enter metadata update interval (seconds): ");
|
||||
System.out.print(" Enter metadata update interval (seconds): ");
|
||||
String input = scanner.nextLine().trim();
|
||||
if (!input.isEmpty()) {
|
||||
try {
|
||||
return Integer.parseInt(input);
|
||||
} catch (NumberFormatException e) {
|
||||
System.out.println("⚠️ Please enter a valid number.");
|
||||
System.out.println(" Please enter a valid number.");
|
||||
}
|
||||
} else {
|
||||
System.out.println("⚠️ This field is required.");
|
||||
System.out.println(" This field is required.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,9 +87,9 @@ public class ConfigManager {
|
||||
|
||||
Yaml yaml = new Yaml(representer, options);
|
||||
yaml.dump(config, writer);
|
||||
System.out.println("✅ Config saved: " + configPath.getFileName());
|
||||
System.out.println(" Config saved: " + configPath.getFileName());
|
||||
} catch (IOException e) {
|
||||
System.err.println("❌ Failed to save config.yml: " + e.getMessage());
|
||||
System.err.println(" Failed to save config.yml: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,12 +103,12 @@ public class ConfigManager {
|
||||
BufferedImage image = ImageIO.read(jpgFile);
|
||||
if (image != null) {
|
||||
ImageIO.write(image, "png", pngFile);
|
||||
System.out.println("🎨 Converted fallback image to PNG: " + pngFile.getName());
|
||||
System.out.println(" Converted fallback image to PNG: " + pngFile.getName());
|
||||
config.setFallbackArtFilename(pngFile.getName());
|
||||
saveConfig(config); // Resave with updated filename
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("❌ Failed to convert fallback image: " + e.getMessage());
|
||||
System.err.println(" Failed to convert fallback image: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ public class MainApp {
|
||||
private static Path cacheFile;
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("🔊 RadioDJ Tuna Bridge starting up...");
|
||||
System.out.println(" RadioDJ Tuna Bridge starting up...");
|
||||
|
||||
initializePaths();
|
||||
ensureOutputFolder();
|
||||
@@ -37,40 +37,40 @@ public class MainApp {
|
||||
try {
|
||||
TrackInfo current = apiClient.fetchNowPlaying();
|
||||
if (current == null || current.getTitle().isBlank()) {
|
||||
System.out.println("⚠️ No track data received.");
|
||||
System.out.println(" No track data received.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastPlayed[0] == null || !current.equals(lastPlayed[0])) {
|
||||
System.out.println("🎶 New track detected: " + current.getTitle());
|
||||
System.out.println(" New track detected: " + current.getTitle());
|
||||
outputManager.writeOutputFiles(current);
|
||||
cacheManager.saveCache(current);
|
||||
lastPlayed[0] = current;
|
||||
} else {
|
||||
// System.out.println("⏳ No change — current track: " + current.getTitle());
|
||||
// System.out.println(" No change — current track: " + current.getTitle());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("🚫 Failed to fetch or process now playing data: " + e.getMessage());
|
||||
System.err.println(" Failed to fetch or process now playing data: " + e.getMessage());
|
||||
}
|
||||
};
|
||||
|
||||
int interval = Math.max(config.getUpdateIntervalSeconds(), 3);
|
||||
scheduler.scheduleAtFixedRate(pollingTask, 0, interval, TimeUnit.SECONDS);
|
||||
|
||||
System.out.println("⌨️ Press 0 + Enter to stop the app...");
|
||||
System.out.println(" Press 0 + Enter to stop the app...");
|
||||
|
||||
try (Scanner scanner = new Scanner(System.in)) {
|
||||
while (true) {
|
||||
String input = scanner.nextLine().trim();
|
||||
if ("0".equals(input)) {
|
||||
System.out.println("🛑 Shutdown requested. Closing...");
|
||||
System.out.println(" Shutdown requested. Closing...");
|
||||
scheduler.shutdownNow();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("❌ Error reading input: " + e.getMessage());
|
||||
System.err.println(" Error reading input: " + e.getMessage());
|
||||
}
|
||||
|
||||
System.exit(0);
|
||||
@@ -88,9 +88,9 @@ public class MainApp {
|
||||
if (!outFolder.exists()) {
|
||||
boolean created = outFolder.mkdirs();
|
||||
if (created) {
|
||||
System.out.println("📁 Created output folder: " + outputDir);
|
||||
System.out.println(" Created output folder: " + outputDir);
|
||||
} else {
|
||||
System.err.println("❌ Failed to create output folder. Check permissions.");
|
||||
System.err.println(" Failed to create output folder. Check permissions.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ public class MetadataCacheManager {
|
||||
return new TrackInfo(title, artist, album, albumArt);
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("⚠️ Failed to load last-played.xml: " + e.getMessage());
|
||||
System.err.println(" Failed to load last-played.xml: " + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class MetadataCacheManager {
|
||||
transformer.transform(input, output);
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("❌ Failed to save last-played.xml: " + e.getMessage());
|
||||
System.err.println(" Failed to save last-played.xml: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -25,13 +25,13 @@ public class OutputManager {
|
||||
writeTextFile("track-artist.txt", track.getArtist());
|
||||
writeTextFile("track-album.txt", track.getAlbum());
|
||||
} catch (IOException e) {
|
||||
System.err.println("❌ Failed writing metadata text files: " + e.getMessage());
|
||||
System.err.println(" Failed writing metadata text files: " + e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
convertAlbumArtToPng(track.getAlbumArt());
|
||||
} catch (Exception e) {
|
||||
System.err.println("❌ Failed converting album art: " + e.getMessage());
|
||||
System.err.println(" Failed converting album art: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,21 +39,21 @@ public class OutputManager {
|
||||
Path file = outputDir.resolve(fileName);
|
||||
Files.writeString(file, content != null ? content : "", StandardCharsets.UTF_8,
|
||||
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
|
||||
System.out.println("📄 Wrote file: " + file.getFileName());
|
||||
System.out.println(" Wrote file: " + file.getFileName());
|
||||
}
|
||||
|
||||
private void convertAlbumArtToPng(String albumArtFileName) {
|
||||
Path destination = outputDir.resolve("album-art.png");
|
||||
|
||||
if (albumArtFileName == null || albumArtFileName.isBlank()) {
|
||||
System.out.println("ℹ️ No album art in tag, using fallback.");
|
||||
System.out.println(" No album art in tag, using fallback.");
|
||||
convertFallbackToPng(destination);
|
||||
return;
|
||||
}
|
||||
|
||||
Path sourceFile = albumArtSourceFolder.resolve(albumArtFileName);
|
||||
if (!Files.exists(sourceFile)) {
|
||||
System.out.println("⚠️ Album art not found: " + sourceFile.getFileName() + ", using fallback.");
|
||||
System.out.println(" Album art not found: " + sourceFile.getFileName() + ", using fallback.");
|
||||
convertFallbackToPng(destination);
|
||||
return;
|
||||
}
|
||||
@@ -62,13 +62,13 @@ public class OutputManager {
|
||||
BufferedImage image = ImageIO.read(sourceFile.toFile());
|
||||
if (image != null) {
|
||||
ImageIO.write(image, "png", destination.toFile());
|
||||
System.out.println("🎨 Album art converted to PNG: " + destination.getFileName());
|
||||
System.out.println(" Album art converted to PNG: " + destination.getFileName());
|
||||
} else {
|
||||
System.out.println("⚠️ Could not read album art image, using fallback.");
|
||||
System.out.println(" Could not read album art image, using fallback.");
|
||||
convertFallbackToPng(destination);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("❌ Failed converting album art: " + e.getMessage());
|
||||
System.err.println(" Failed converting album art: " + e.getMessage());
|
||||
convertFallbackToPng(destination);
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class OutputManager {
|
||||
private void convertFallbackToPng(Path destination) {
|
||||
Path fallbackSource = outputDir.resolve(fallbackArtFilename);
|
||||
if (!Files.exists(fallbackSource)) {
|
||||
System.err.println("❌ Fallback art file is missing: " + fallbackSource);
|
||||
System.err.println(" Fallback art file is missing: " + fallbackSource);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,12 +84,12 @@ public class OutputManager {
|
||||
BufferedImage image = ImageIO.read(fallbackSource.toFile());
|
||||
if (image != null) {
|
||||
ImageIO.write(image, "png", destination.toFile());
|
||||
System.out.println("🖼️ Fallback album art converted to PNG.");
|
||||
System.out.println(" Fallback album art converted to PNG.");
|
||||
} else {
|
||||
System.err.println("❌ Could not read fallback image.");
|
||||
System.err.println(" Could not read fallback image.");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("❌ Failed to convert fallback art: " + e.getMessage());
|
||||
System.err.println(" Failed to convert fallback art: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user