From 80ec6773d174a99d5d47a4a30f8d394d3bc89045 Mon Sep 17 00:00:00 2001 From: OMGeeky Date: Sat, 17 Jun 2023 17:54:38 +0200 Subject: [PATCH] move out constant definitions & document them --- src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index b747fe4..bbd42dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -758,8 +758,14 @@ pub fn get_video_title_from_twitch_video( Ok(res) } +/// The maximum length a youtube video can have const MAX_VIDEO_TITLE_LENGTH: usize = 100; +/// the length my prefix might be (not necessarily all are used) const PREFIX_LENGTH: usize = 24; +/// The length of the separator between the prefix & the title +const SEPARATOR_LEN: usize = 1; +/// The length of the ... that gets put at the end if it is shortened +const DOTDOTDOT_LEN: usize = 3; pub fn get_playlist_title_from_twitch_video(video: &data::VideoData) -> Result { trace!("get playlist title from twitch video"); @@ -776,7 +782,6 @@ pub fn get_playlist_title_from_twitch_video(video: &data::VideoData) -> Result>(title: S) -> Result { let title = title.into(); - const SEPARATOR_LEN: usize = 1; if title.len() > MAX_VIDEO_TITLE_LENGTH - PREFIX_LENGTH - SEPARATOR_LEN { let shortened = format!( "{}...",