This commit is contained in:
2026-04-17 16:35:46 +03:00
parent 0f2fe50eab
commit 56f04804cc
3 changed files with 28 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
#![allow(dead_code)]
use chrono::{Datelike, NaiveDate};
use regex::Regex;
use serde::Serialize;
use serde_json::json;
use std::collections::HashMap;
@@ -263,10 +264,17 @@ impl JobData {
fn_parts.push(channel.clone());
}
let outfile_name = transliterate(&fn_parts.join("_"), true)
let mut outfile_name = transliterate(&fn_parts.join("_"), true)
.replace(' ', "-")
.replace('\'', "");
// Если 3 и более дефисов подряд -> заменяем на один
let re = Regex::new(r"-{3,}").unwrap();
outfile_name = re.replace_all(&outfile_name, "-").to_string();
// Убираем дефисы в начале и конце
outfile_name = outfile_name.trim_matches('-').to_string();
Some(Self {
date: data_str,
time: time.clone(),