From ddc1448acc9d151ecc24a542b1b2eff64c1cac70 Mon Sep 17 00:00:00 2001 From: Jakob Moser Date: Sat, 24 May 2025 15:51:04 +0200 Subject: [PATCH] Implement songs in unique dirs --- karaokatalog/Library.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/karaokatalog/Library.py b/karaokatalog/Library.py index c5c144b..28abce3 100644 --- a/karaokatalog/Library.py +++ b/karaokatalog/Library.py @@ -42,4 +42,12 @@ class Library: For deduplication, it is helpful to assume every song is in its own directory. This returns a sequence of songs filtered so that there are no two songs sharing the same base dir. This filtering is done arbitrarily. """ - raise NotImplementedError() # TODO Implement + unique_dirs: set[Path] = set() + songs_in_unique_dirs: list[Song] = [] + + for song in self.songs: + if song.dir not in unique_dirs: + songs_in_unique_dirs.append(song) + unique_dirs.add(song.dir) + + return tuple(songs_in_unique_dirs)