-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: formatting activity text #155
Conversation
} else if details.len() < 3 { | ||
details += ""; | ||
if details_text.len() > 128 { | ||
details_text = details_text.chars().take(128).collect(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The else if
here is really important, these have to be kept
|
||
self.discord_ipc_client.set_activity(activity)?; | ||
|
||
return Ok(format!("{} | {}", details, state)); | ||
return Ok(format!("{} | {}", state_text, details_text)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
details before state, details is the top line and state is the bottom line
.genres | ||
.as_ref() | ||
.unwrap_or(&vec!["".to_string()]) | ||
.join(", "), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a new function instead of breaking the old one, you could use a simple match statement based on the type of media being played to select which one to use.
Also image text should stay the same as before on types that dont benefit from it like Movie, LiveTv, Book and Episode. Only AudioBook and Music need that line.
The default can also be the old large_image_text with the version number
/// Contains configuration for Music/Movie display. | ||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] | ||
pub struct DisplayOptions { | ||
/// Display is where you tell the program what should be displayed. | ||
pub display: Option<Vec<String>>, | ||
/// Separator is what should be between the artist(s) and the `display` options. | ||
pub separator: Option<String>, | ||
pub state_text: Option<String>, | ||
pub details_text: Option<String>, | ||
pub image_text: Option<String>, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have doc lines ///
and image_text should probably be large_image_text, there is another one called small_image_text that gets used when you pause content
Sorry, I got a little busy. Will revisit this later today. |
Also a good point made @hozarho in #154 (comment) is that it should still support the old format so configs dont have to be replaced. #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct DisplayOptions {
/// Display is where you tell the program what should be displayed.
pub display: Option<DisplayFormat>,
/// Separator is what should be between the artist(s) and the `display` options.
pub separator: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(untagged)]
pub enum DisplayFormat {
Vec(Vec<String>),
Struct(DisplayLines),
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct DisplayLines {
/// remember docs
pub title: Option<String>,
pub desc1: Option<String>,
pub desc2: Option<String>,
} The names can be different, this is just an example of how it would be done |
Closing in favor of #165 |
#154 proof of concept. movies/shows untested. defaults and other stuff not worked out.
with