From a22b3019f8a894d0cabf497c72c7a5bfb918057e Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 19 Apr 2026 10:54:36 +0100 Subject: [PATCH 1/2] [openapi] add generated files to ignore list --- .gitattributes | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..9b1affa7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# Mark generated files from openapi/components.yaml +browser3/src/types.ts linguist-generated=true +browser3/src/schemas.ts linguist-generated=true +player3/src/types.ts linguist-generated=true +player3/src/schemas.ts linguist-generated=true +processmedia3/pm3/lib/types.py linguist-generated=true From 213b2c424fdeae29077570dc0dd46f05dfcc865e Mon Sep 17 00:00:00 2001 From: Allan Callaghan Date: Sun, 19 Apr 2026 10:54:36 +0100 Subject: [PATCH 2/2] Added `source` filename to `tracks.json` --- browser3/src/schemas.ts | 7 +++++++ browser3/src/types.ts | 2 ++ openapi/components.yaml | 5 +++++ player3/src/schemas.ts | 7 +++++++ player3/src/types.ts | 2 ++ processmedia3/pm3/lib/track.py | 1 + processmedia3/pm3/lib/types.py | 1 + processmedia3/tests/test_list_changes.py | 6 ++++++ 8 files changed, 31 insertions(+) diff --git a/browser3/src/schemas.ts b/browser3/src/schemas.ts index 4a5dc612..b6e77306 100644 --- a/browser3/src/schemas.ts +++ b/browser3/src/schemas.ts @@ -58,6 +58,13 @@ export const TrackSchema = { } } } + }, + "sources": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of source files for the track" } } } as const; diff --git a/browser3/src/types.ts b/browser3/src/types.ts index 65c7c1e2..13ae236b 100644 --- a/browser3/src/types.ts +++ b/browser3/src/types.ts @@ -24,6 +24,8 @@ export interface components { image: components["schemas"]["Attachment"][]; subtitle: components["schemas"]["Attachment"][]; }; + /** @description List of source files for the track */ + sources?: string[]; }; Attachment: { /** @description Attachment variant name */ diff --git a/openapi/components.yaml b/openapi/components.yaml index f873ec55..8e2eaed3 100644 --- a/openapi/components.yaml +++ b/openapi/components.yaml @@ -57,6 +57,11 @@ components: type: array items: $ref: "#/components/schemas/Attachment" + sources: + type: array + items: + type: string + description: List of source files for the track Attachment: type: object diff --git a/player3/src/schemas.ts b/player3/src/schemas.ts index 4a5dc612..b6e77306 100644 --- a/player3/src/schemas.ts +++ b/player3/src/schemas.ts @@ -58,6 +58,13 @@ export const TrackSchema = { } } } + }, + "sources": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of source files for the track" } } } as const; diff --git a/player3/src/types.ts b/player3/src/types.ts index 65c7c1e2..13ae236b 100644 --- a/player3/src/types.ts +++ b/player3/src/types.ts @@ -24,6 +24,8 @@ export interface components { image: components["schemas"]["Attachment"][]; subtitle: components["schemas"]["Attachment"][]; }; + /** @description List of source files for the track */ + sources?: string[]; }; Attachment: { /** @description Attachment variant name */ diff --git a/processmedia3/pm3/lib/track.py b/processmedia3/pm3/lib/track.py index 7fa17ef9..75479369 100644 --- a/processmedia3/pm3/lib/track.py +++ b/processmedia3/pm3/lib/track.py @@ -172,4 +172,5 @@ def to_json(self) -> TrackDict: image=attachments[MediaType.IMAGE], ), tags=tags, + sources=sorted(map(str, self.sources)), ) diff --git a/processmedia3/pm3/lib/types.py b/processmedia3/pm3/lib/types.py index a87302a2..faf8d376 100644 --- a/processmedia3/pm3/lib/types.py +++ b/processmedia3/pm3/lib/types.py @@ -61,3 +61,4 @@ class Track(TypedDict): duration: float tags: dict[str, list[str]] attachments: Attachments + sources: NotRequired[list[str]] diff --git a/processmedia3/tests/test_list_changes.py b/processmedia3/tests/test_list_changes.py index 8052bbb9..ac8250e2 100644 --- a/processmedia3/tests/test_list_changes.py +++ b/processmedia3/tests/test_list_changes.py @@ -23,6 +23,7 @@ def test_same(self) -> None: {"mime": "text/srt", "variant": "Default", "path": "subs.srt"}, ], }, + "sources": ["test1.txt", "test.srt", "test1.mp4"], } t2: TrackDict = { "id": "track1", @@ -40,6 +41,7 @@ def test_same(self) -> None: {"mime": "text/srt", "variant": "Default", "path": "subs.srt"}, ], }, + "sources": ["test1.txt", "test.srt", "test1.mp4"], } self.assertEqual(list_changes(t1, t2), None) @@ -61,6 +63,7 @@ def test_diff_tags_subtitles(self) -> None: {"mime": "text/srt", "variant": "Default", "path": "subs1.srt"}, ], }, + "sources": ["test1.txt", "test.srt", "test1.mp4"], } t2: TrackDict = { "id": "track1", @@ -78,6 +81,7 @@ def test_diff_tags_subtitles(self) -> None: {"mime": "text/srt", "variant": "Default", "path": "subs2.srt"}, ], }, + "sources": ["test1.txt", "test.srt", "test1.mp4"], } self.assertEqual(list_changes(t1, t2), "tags (artist, title), subtitle") @@ -98,6 +102,7 @@ def test_diff_new(self) -> None: "image": [], "subtitle": [], }, + "sources": ["test1.txt", "test.srt", "test1.mp4"], } t2: TrackDict = { "id": "track1", @@ -113,5 +118,6 @@ def test_diff_new(self) -> None: "image": [], "subtitle": [], }, + "sources": ["test1.txt", "test.srt", "test1.mp4"], } self.assertEqual(list_changes(t1, t2), None)