//! Movie versions and parts (Jellyfin "multiple versions" and "stacking"). //! //! A movie with one video file stays flat (`/Title (rok) [tmdbid].ext`). //! The moment a second file is added it is promoted to its own folder, where //! every file starts with the folder's exact name: //! //! ```text //! /Title (rok) [tmdbid]/ //! Title (rok) [tmdbid].ext (default version, bare name) //! Title (rok) [tmdbid] - 3D HSBS.ext (another version) //! ``` //! //! or, for a film split across files, `Title (rok) [tmdbid]-part1.ext`, `-part2`… //! A folder holds either versions or parts, never both. use std::fs; use std::path::{Path, PathBuf}; use super::{FileManager, LibraryKind, is_media_file}; use crate::core::error::{CoreError, CoreResult}; use crate::core::file::{File, now_iso}; use crate::core::movie::{ DEFAULT_VERSION_LABEL, normalize_3d_label, normalize_part_label, part_label, }; use crate::core::naming::{is_canonical_pool_stem, parse_3d_format}; use crate::core::paths; use crate::core::series::looks_like_series_folder; use crate::core::subtitles; const PARTS_AND_VERSIONS_MIX: &str = "Film může mít buď díly (přehrají se za sebou), nebo verze (alternativy jako 2D/3D, 4K) — ne obojí v jedné složce. Uprav popisek, nebo nejdřív odeber soubory toho druhého druhu."; /// How a film's files are laid out. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum GroupMode { /// One file in the library root. Flat, /// A folder of alternatives. Versions, /// A folder of pieces played back to back. Parts, } /// Filename of one version in a movie folder: the default version is bare /// ``, a part `-part`, anything else /// ` -