mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-06-24 21:25:23 +00:00
rs-terminal: add volume
argument to play
command
This commit is contained in:
parent
471c780785
commit
3fa46af0bd
2 changed files with 16 additions and 2 deletions
|
@ -259,6 +259,7 @@ impl<'a> FCastSession<'a> {
|
||||||
time: Option<f64>,
|
time: Option<f64>,
|
||||||
speed: Option<f64>,
|
speed: Option<f64>,
|
||||||
headers: Option<HashMap<String, String>>,
|
headers: Option<HashMap<String, String>>,
|
||||||
|
volume: Option<f64>,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
match self.state {
|
match self.state {
|
||||||
SessionState::Connected(ProtoVersion::V2) => {
|
SessionState::Connected(ProtoVersion::V2) => {
|
||||||
|
@ -278,7 +279,7 @@ impl<'a> FCastSession<'a> {
|
||||||
url,
|
url,
|
||||||
content,
|
content,
|
||||||
time,
|
time,
|
||||||
volume: Some(1.0),
|
volume,
|
||||||
speed,
|
speed,
|
||||||
headers,
|
headers,
|
||||||
metadata: None,
|
metadata: None,
|
||||||
|
|
|
@ -135,6 +135,14 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
.help("Custom request headers in key:value format")
|
.help("Custom request headers in key:value format")
|
||||||
.required(false)
|
.required(false)
|
||||||
.multiple_occurrences(true),
|
.multiple_occurrences(true),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("volume")
|
||||||
|
.short('v')
|
||||||
|
.long("volume")
|
||||||
|
.value_name("VOLUME")
|
||||||
|
.help("The desired volume")
|
||||||
|
.takes_value(true)
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
|
@ -301,6 +309,11 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
.collect::<HashMap<String, String>>()
|
.collect::<HashMap<String, String>>()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let volume = match play_matches.value_of("volume") {
|
||||||
|
Some(v) => v.parse::<f64>().ok(),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
#[allow(unused_assignments)]
|
#[allow(unused_assignments)]
|
||||||
let mut url = None;
|
let mut url = None;
|
||||||
let mut content = None;
|
let mut content = None;
|
||||||
|
@ -340,7 +353,7 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
content = Some(buffer);
|
content = Some(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
session.send_play_message(mime_type, url, content, time, speed, headers)?;
|
session.send_play_message(mime_type, url, content, time, speed, headers, volume)?;
|
||||||
} else if let Some(seek_matches) = matches.subcommand_matches("seek") {
|
} else if let Some(seek_matches) = matches.subcommand_matches("seek") {
|
||||||
let seek_message = SeekMessage::new(match seek_matches.value_of("timestamp") {
|
let seek_message = SeekMessage::new(match seek_matches.value_of("timestamp") {
|
||||||
Some(s) => s.parse::<f64>()?,
|
Some(s) => s.parse::<f64>()?,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue