Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

jamen
Copy link

@jamen jamen commented Oct 3, 2024

#154 proof of concept. movies/shows untested. defaults and other stuff not worked out.

image

with

"music": {
    "state_text": "by {artists}",
    "details_text": "{title}",
    "image_text": "on {album}"
},

} else if details.len() < 3 {
details += "‎‎‎";
if details_text.len() > 128 {
details_text = details_text.chars().take(128).collect();
}
Copy link
Owner

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));
Copy link
Owner

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(", "),
}
}
Copy link
Owner

@Radiicall Radiicall Oct 3, 2024

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

Comment on lines 46 to 52
/// 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>,
}
Copy link
Owner

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

@Radiicall Radiicall linked an issue Oct 6, 2024 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add custom formatting for RPC details and on-hover image text
2 participants