From 6a8f415a02881b4a90e2c2d5848d65b41e5c6ab9 Mon Sep 17 00:00:00 2001 From: Jordan Sim-Smith Date: Fri, 13 Dec 2024 17:24:11 +1300 Subject: [PATCH] Ignore .DS_Store files when scanning for episodes watched --- immersion_tracker_api/script/sync_episodes.py | 5 +++++ .../immersiontracker/ImmersionTrackerE2ETest.java | 2 ++ .../java/com/jordansimsmith/testcontainers/LoadedImage.java | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/immersion_tracker_api/script/sync_episodes.py b/immersion_tracker_api/script/sync_episodes.py index b27dfdb..e9bb73e 100644 --- a/immersion_tracker_api/script/sync_episodes.py +++ b/immersion_tracker_api/script/sync_episodes.py @@ -6,6 +6,8 @@ import requests +SUPPORTED_EXTENSIONS = [".mkv", ".mp4"] + def main(): local_episodes_watched = find_local_episodes_watched() @@ -38,6 +40,9 @@ def find_local_episodes_watched(): if not os.path.isfile(os.path.join(watched, episode)): continue + if os.path.splitext(episode)[1] not in SUPPORTED_EXTENSIONS: + continue + episode = {"folder_name": show, "file_name": pathlib.Path(episode).stem} episodes.append(episode) diff --git a/immersion_tracker_api/src/test/java/com/jordansimsmith/immersiontracker/ImmersionTrackerE2ETest.java b/immersion_tracker_api/src/test/java/com/jordansimsmith/immersiontracker/ImmersionTrackerE2ETest.java index 0e6f5d8..35ae1f3 100644 --- a/immersion_tracker_api/src/test/java/com/jordansimsmith/immersiontracker/ImmersionTrackerE2ETest.java +++ b/immersion_tracker_api/src/test/java/com/jordansimsmith/immersiontracker/ImmersionTrackerE2ETest.java @@ -39,6 +39,8 @@ void scriptShouldSyncEpisodes() throws Exception { try (var show1Episode2RandomAccessFile = new RandomAccessFile(show1Episode2, "rw")) { show1Episode2RandomAccessFile.setLength(220 * 1024 * 1024); } + var dsStore = Path.of(watched1.getPath(), ".DS_Store").toFile(); + dsStore.createNewFile(); var show2 = Path.of(tmp.getPath(), "2 (123) Haikyuu Part 1").toFile(); show2.mkdir(); diff --git a/lib/testcontainers/src/main/java/com/jordansimsmith/testcontainers/LoadedImage.java b/lib/testcontainers/src/main/java/com/jordansimsmith/testcontainers/LoadedImage.java index e53bb8c..5326722 100644 --- a/lib/testcontainers/src/main/java/com/jordansimsmith/testcontainers/LoadedImage.java +++ b/lib/testcontainers/src/main/java/com/jordansimsmith/testcontainers/LoadedImage.java @@ -15,7 +15,8 @@ public static DockerImageName loadImage(String image, String loader) { var process = builder.start(); var code = process.waitFor(); if (code != 0) { - throw new RuntimeException("failed to load image:" + image); + var error = new String(process.getInputStream().readAllBytes()); + throw new RuntimeException("failed to load image: " + image + " with error: " + error); } } catch (IOException | InterruptedException e) { throw new RuntimeException(e);