Files
tuliprox/shared/src/model
zachhideandGitHub 0cbe08b307 fix(strm): name every flat/tmdb movie version after the folder it lands in (#787)
* fix(strm): name every flat/tmdb version after the folder it lands in

Under `flat: true` the movie folder is deduplicated by TMDB id, but
`final_filename` was derived from each item's own provider title before the
folder-reuse branch. Providers routinely list the same film twice with the tag
written two ways, so the second listing landed in the first listing's folder
under a name that does not start with the folder name.

That is precisely the condition Jellyfin's Emby.Naming VideoListResolver checks
in IsEligibleForMultiVersion: the file name must start with the folder name, and
the remainder must be empty or start with '-', '_', '.', or a [bracketed] token.
Any ineligible file makes GetVideosGroupedByVersion return the folder's videos
ungrouped, so *every* file in it becomes a separate movie.

The first item to claim a flat folder now also fixes the file name for every
item that follows it into that folder. The existing add_quality_to_filename
suffix, or the existing [Version id#N] collision suffix when the qualities tie,
is what keeps the versions apart. Kodi and Emby shared the same defect and are
fixed with them.

* fix(quality): classify resolution from the frame, not its height alone

VideoResolution was bucketed from ffprobe's height only. Widescreen releases keep
the full raster width but encode fewer active lines, so a 2.40:1 film mastered at
1080p (1920x796) was tagged '720p HD', and a 2.40:1 UHD master (3840x1600) was
tagged '1440p QHD'.

Classify both axes and keep the higher tier. Height still decides on its own when
the width is missing, which also keeps anamorphic frames (1440x1080) correct.

* fix(strm): drop the category from flat movie file names

The category suffix was added to flat movie file names 'to avoid collisions',
but with folder reuse now naming files after their folder, the only files that
can collide are versions of the same movie -- same TMDB folder, same quality
string -- and the existing [Version id#N] pass already separates those.

It is not free: Jellyfin and Emby render whatever follows the folder name as the
version label, so the category was showing up in the version picker next to the
quality. Removing it makes the label read as the quality alone.

Items without a TMDB id keep the category, because it is what makes their folder
unique -- but they now carry it in the file name as well. Previously the folder
got '[Category]' while the file did not, so the file name did not start with the
folder name and version detection was broken for exactly those items.

* fix(strm): keep the version label when the writer truncates a long name

The [Version id#N] suffix is the only thing separating two versions that share a
base and a quality string, but it was appended last and the writer truncates the
file stem to 250 chars -- so for a long enough title the suffix was cut off, both
versions resolved to the same path, and the second silently overwrote the first.
The collision detector could not see it either, since it compares untruncated
names.

Trim the shared base to fit instead, so the label always survives. The 250-char
limit is now a named constant used by both the naming and the writing side.

Also hoist the per-item flag lookups out of the naming loop and drop a redundant
HashSet lookup (insert already reports whether the entry was present).

* docs: scope the no-tmdb category note to jellyfin/emby
2026-07-15 09:38:21 +02:00
..
2026-04-03 16:23:15 +02:00
2026-04-22 17:58:33 +02:00
2026-04-03 16:23:15 +02:00
2026-04-10 20:36:24 +02:00
2026-06-15 14:09:31 +02:00
2026-06-08 19:29:45 +02:00
2026-06-18 16:03:09 +02:00
2026-06-18 16:03:09 +02:00
2026-03-21 05:29:59 +01:00
2026-06-08 19:29:45 +02:00
2026-06-15 14:09:31 +02:00
2026-06-18 16:03:09 +02:00
2026-06-15 14:09:31 +02:00