You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
717 B
Rust
37 lines
717 B
Rust
|
2 years ago
|
|
||
|
|
pub struct SongMetadata
|
||
|
|
{
|
||
|
|
pub name: String,
|
||
|
|
pub artist: String,
|
||
|
|
pub album: String,
|
||
|
|
}
|
||
|
|
impl SongMetadata
|
||
|
|
{
|
||
|
|
fn new() -> SongMetadata
|
||
|
|
{
|
||
|
|
SongMetadata {
|
||
|
|
name: "NONE".to_string(),
|
||
|
|
artist: "NONE".to_string(),
|
||
|
|
album: "NONE".to_string(),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
pub fn get_song_metadata() -> SongMetadata
|
||
|
|
{
|
||
|
|
const COM_START: String = "playerctl --player=strawberry ";
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
fn run_command(command: &str) -> String
|
||
|
|
{
|
||
|
|
let output = Command::new("sh")
|
||
|
|
.arg("-c")
|
||
|
|
.arg(command)
|
||
|
|
.output()
|
||
|
|
.expect("Failed to run the command");
|
||
|
|
str::from_utf8(&output.stdout).expect("Failed to convert command result to utf8 string").to_string()
|
||
|
|
|
||
|
|
}
|