mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-31 03:02:24 +01:00
- Implement M3u output form with filename, type inclusion and filter fields - Implement STRM output form with directory, export style and advanced options - Implement HDHomeRun output form with device and output type selection - Add FromStr trait implementations for StrmExportStyle and TargetType enums - Update output_form.rs to route to new form components - Update module declarations in mod.rs This completes the form implementation for all output block types, allowing users to edit M3u, STRM and HDHomeRun configurations directly in the source editor UI.
49 lines
1.3 KiB
Rust
49 lines
1.3 KiB
Rust
use enum_iterator::Sequence;
|
|
use std::fmt::Display;
|
|
use std::str::FromStr;
|
|
|
|
#[derive( Debug, Copy, Clone, serde::Serialize, serde::Deserialize, Sequence,
|
|
PartialEq, Eq, Hash, Default)]
|
|
pub enum StrmExportStyle {
|
|
#[serde(rename = "kodi")]
|
|
#[default]
|
|
Kodi,
|
|
#[serde(rename = "plex")]
|
|
Plex,
|
|
#[serde(rename = "emby")]
|
|
Emby,
|
|
#[serde(rename = "jellyfin")]
|
|
Jellyfin,
|
|
}
|
|
|
|
impl StrmExportStyle {
|
|
const KODI: &'static str = "Kodi";
|
|
const PLEX: &'static str = "Plex";
|
|
const EMBY: &'static str = "Emby";
|
|
const JELLYFIN: &'static str = "Jellyfin";
|
|
}
|
|
|
|
impl Display for StrmExportStyle {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
|
write!(f, "{}", match *self {
|
|
Self::Kodi => Self::KODI,
|
|
Self::Plex => Self::PLEX,
|
|
Self::Emby => Self::EMBY,
|
|
Self::Jellyfin => Self::JELLYFIN,
|
|
})
|
|
}
|
|
}
|
|
|
|
impl FromStr for StrmExportStyle {
|
|
type Err = String;
|
|
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
match s {
|
|
Self::KODI => Ok(Self::Kodi),
|
|
Self::PLEX => Ok(Self::Plex),
|
|
Self::EMBY => Ok(Self::Emby),
|
|
Self::JELLYFIN => Ok(Self::Jellyfin),
|
|
_ => Err(format!("Unknown StrmExportStyle: {}", s))
|
|
}
|
|
}
|
|
} |