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:
minster586
2025-07-16 05:02:09 -04:00
parent 540eedba94
commit 32b56b56d7
5 changed files with 42 additions and 42 deletions

12
pom.xml
View File

@@ -20,7 +20,7 @@
</properties> </properties>
<dependencies> <dependencies>
<!-- JavaFX modules --> <!-- JavaFX modules -->
<dependency> <dependency>
<groupId>org.openjfx</groupId> <groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId> <artifactId>javafx-controls</artifactId>
@@ -37,14 +37,14 @@
<version>${javafx.version}</version> <version>${javafx.version}</version>
</dependency> </dependency>
<!-- YAML parsing --> <!-- YAML parsing -->
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
<version>2.2</version> <version>2.2</version>
</dependency> </dependency>
<!-- XML support --> <!-- XML support -->
<dependency> <dependency>
<groupId>xerces</groupId> <groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId> <artifactId>xercesImpl</artifactId>
@@ -54,14 +54,14 @@
<build> <build>
<plugins> <plugins>
<!-- Compiler plugin --> <!-- Compiler plugin -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version> <version>3.11.0</version>
</plugin> </plugin>
<!-- Jar plugin for manifest --> <!-- Jar plugin for manifest -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
@@ -75,7 +75,7 @@
</configuration> </configuration>
</plugin> </plugin>
<!-- Shade plugin to bundle everything --> <!-- Shade plugin to bundle everything -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>

View File

@@ -32,11 +32,11 @@ public class ConfigManager {
Yaml yaml = new Yaml(new Constructor(Config.class, new LoaderOptions())); Yaml yaml = new Yaml(new Constructor(Config.class, new LoaderOptions()));
return yaml.load(in); return yaml.load(in);
} catch (Exception e) { } 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(); Config config = promptUserConfig();
saveConfig(config); saveConfig(config);
convertFallbackToPngIfNecessary(config); convertFallbackToPngIfNecessary(config);
@@ -46,13 +46,13 @@ public class ConfigManager {
private Config promptUserConfig() { private Config promptUserConfig() {
Scanner scanner = new Scanner(System.in); 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(); 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(); 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(); String fallback = scanner.nextLine().trim();
int interval = promptForInterval(scanner); int interval = promptForInterval(scanner);
@@ -62,16 +62,16 @@ public class ConfigManager {
private int promptForInterval(Scanner scanner) { private int promptForInterval(Scanner scanner) {
while (true) { while (true) {
System.out.print("⏱️ Enter metadata update interval (seconds): "); System.out.print(" Enter metadata update interval (seconds): ");
String input = scanner.nextLine().trim(); String input = scanner.nextLine().trim();
if (!input.isEmpty()) { if (!input.isEmpty()) {
try { try {
return Integer.parseInt(input); return Integer.parseInt(input);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
System.out.println("⚠️ Please enter a valid number."); System.out.println(" Please enter a valid number.");
} }
} else { } 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 yaml = new Yaml(representer, options);
yaml.dump(config, writer); yaml.dump(config, writer);
System.out.println(" Config saved: " + configPath.getFileName()); System.out.println(" Config saved: " + configPath.getFileName());
} catch (IOException e) { } 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); BufferedImage image = ImageIO.read(jpgFile);
if (image != null) { if (image != null) {
ImageIO.write(image, "png", pngFile); 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()); config.setFallbackArtFilename(pngFile.getName());
saveConfig(config); // Resave with updated filename saveConfig(config); // Resave with updated filename
} }
} catch (IOException e) { } catch (IOException e) {
System.err.println(" Failed to convert fallback image: " + e.getMessage()); System.err.println(" Failed to convert fallback image: " + e.getMessage());
} }
} }
} }

View File

@@ -14,7 +14,7 @@ public class MainApp {
private static Path cacheFile; private static Path cacheFile;
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("🔊 RadioDJ Tuna Bridge starting up..."); System.out.println(" RadioDJ Tuna Bridge starting up...");
initializePaths(); initializePaths();
ensureOutputFolder(); ensureOutputFolder();
@@ -37,40 +37,40 @@ public class MainApp {
try { try {
TrackInfo current = apiClient.fetchNowPlaying(); TrackInfo current = apiClient.fetchNowPlaying();
if (current == null || current.getTitle().isBlank()) { if (current == null || current.getTitle().isBlank()) {
System.out.println("⚠️ No track data received."); System.out.println(" No track data received.");
return; return;
} }
if (lastPlayed[0] == null || !current.equals(lastPlayed[0])) { 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); outputManager.writeOutputFiles(current);
cacheManager.saveCache(current); cacheManager.saveCache(current);
lastPlayed[0] = current; lastPlayed[0] = current;
} else { } else {
// System.out.println(" No change — current track: " + current.getTitle()); // System.out.println(" No change — current track: " + current.getTitle());
} }
} catch (Exception e) { } 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); int interval = Math.max(config.getUpdateIntervalSeconds(), 3);
scheduler.scheduleAtFixedRate(pollingTask, 0, interval, TimeUnit.SECONDS); 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)) { try (Scanner scanner = new Scanner(System.in)) {
while (true) { while (true) {
String input = scanner.nextLine().trim(); String input = scanner.nextLine().trim();
if ("0".equals(input)) { if ("0".equals(input)) {
System.out.println("🛑 Shutdown requested. Closing..."); System.out.println(" Shutdown requested. Closing...");
scheduler.shutdownNow(); scheduler.shutdownNow();
break; break;
} }
} }
} catch (Exception e) { } catch (Exception e) {
System.err.println(" Error reading input: " + e.getMessage()); System.err.println(" Error reading input: " + e.getMessage());
} }
System.exit(0); System.exit(0);
@@ -88,9 +88,9 @@ public class MainApp {
if (!outFolder.exists()) { if (!outFolder.exists()) {
boolean created = outFolder.mkdirs(); boolean created = outFolder.mkdirs();
if (created) { if (created) {
System.out.println("📁 Created output folder: " + outputDir); System.out.println(" Created output folder: " + outputDir);
} else { } else {
System.err.println(" Failed to create output folder. Check permissions."); System.err.println(" Failed to create output folder. Check permissions.");
} }
} }
} }

View File

@@ -39,7 +39,7 @@ public class MetadataCacheManager {
return new TrackInfo(title, artist, album, albumArt); return new TrackInfo(title, artist, album, albumArt);
} catch (Exception e) { } 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; return null;
} }
} }
@@ -65,7 +65,7 @@ public class MetadataCacheManager {
transformer.transform(input, output); transformer.transform(input, output);
} catch (Exception e) { } 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());
} }
} }

View File

@@ -25,13 +25,13 @@ public class OutputManager {
writeTextFile("track-artist.txt", track.getArtist()); writeTextFile("track-artist.txt", track.getArtist());
writeTextFile("track-album.txt", track.getAlbum()); writeTextFile("track-album.txt", track.getAlbum());
} catch (IOException e) { } catch (IOException e) {
System.err.println(" Failed writing metadata text files: " + e.getMessage()); System.err.println(" Failed writing metadata text files: " + e.getMessage());
} }
try { try {
convertAlbumArtToPng(track.getAlbumArt()); convertAlbumArtToPng(track.getAlbumArt());
} catch (Exception e) { } 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); Path file = outputDir.resolve(fileName);
Files.writeString(file, content != null ? content : "", StandardCharsets.UTF_8, Files.writeString(file, content != null ? content : "", StandardCharsets.UTF_8,
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
System.out.println("📄 Wrote file: " + file.getFileName()); System.out.println(" Wrote file: " + file.getFileName());
} }
private void convertAlbumArtToPng(String albumArtFileName) { private void convertAlbumArtToPng(String albumArtFileName) {
Path destination = outputDir.resolve("album-art.png"); Path destination = outputDir.resolve("album-art.png");
if (albumArtFileName == null || albumArtFileName.isBlank()) { 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); convertFallbackToPng(destination);
return; return;
} }
Path sourceFile = albumArtSourceFolder.resolve(albumArtFileName); Path sourceFile = albumArtSourceFolder.resolve(albumArtFileName);
if (!Files.exists(sourceFile)) { 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); convertFallbackToPng(destination);
return; return;
} }
@@ -62,13 +62,13 @@ public class OutputManager {
BufferedImage image = ImageIO.read(sourceFile.toFile()); BufferedImage image = ImageIO.read(sourceFile.toFile());
if (image != null) { if (image != null) {
ImageIO.write(image, "png", destination.toFile()); 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 { } 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); convertFallbackToPng(destination);
} }
} catch (IOException e) { } catch (IOException e) {
System.err.println(" Failed converting album art: " + e.getMessage()); System.err.println(" Failed converting album art: " + e.getMessage());
convertFallbackToPng(destination); convertFallbackToPng(destination);
} }
} }
@@ -76,7 +76,7 @@ public class OutputManager {
private void convertFallbackToPng(Path destination) { private void convertFallbackToPng(Path destination) {
Path fallbackSource = outputDir.resolve(fallbackArtFilename); Path fallbackSource = outputDir.resolve(fallbackArtFilename);
if (!Files.exists(fallbackSource)) { if (!Files.exists(fallbackSource)) {
System.err.println(" Fallback art file is missing: " + fallbackSource); System.err.println(" Fallback art file is missing: " + fallbackSource);
return; return;
} }
@@ -84,12 +84,12 @@ public class OutputManager {
BufferedImage image = ImageIO.read(fallbackSource.toFile()); BufferedImage image = ImageIO.read(fallbackSource.toFile());
if (image != null) { if (image != null) {
ImageIO.write(image, "png", destination.toFile()); 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 { } else {
System.err.println(" Could not read fallback image."); System.err.println(" Could not read fallback image.");
} }
} catch (IOException e) { } catch (IOException e) {
System.err.println(" Failed to convert fallback art: " + e.getMessage()); System.err.println(" Failed to convert fallback art: " + e.getMessage());
} }
} }
} }