diff --git a/.gitignore b/.gitignore index 4a3b37d..68c2dd3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ +.idea + /target + config.toml diff --git a/src/module/recorder.rs b/src/module/recorder.rs index adb0a50..ac5f91e 100644 --- a/src/module/recorder.rs +++ b/src/module/recorder.rs @@ -478,10 +478,13 @@ impl YTAStatus { } // New versions of ytarchive prepend a timestamp to the output - let line = if self.version == Some("0.3.2".into()) - && line.len() > 20 - && line.chars().nth(4) == Some('/') - { + // Sample line + // 2024/04/16 16:25:31 + lazy_static! { + static ref TIMESTAMP_RE: Regex = Regex::new(r"^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}") + .expect("Failed to compile regex for detecting yta output timestamp"); + } + let line = if line.len() > 20 && TIMESTAMP_RE.is_match(line) { line[20..].trim() } else { line