Skip to content

Commit

Permalink
Fix broken arg and unclear help
Browse files Browse the repository at this point in the history
  • Loading branch information
AlyoshaVasilieva committed Feb 7, 2022
1 parent 390b264 commit a75d039
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cbc-sl"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
authors = ["Malloc Voidstar <[email protected]>"]
license = "Apache-2.0"
Expand Down
11 changes: 6 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct Args {
/// List available Olympics streams
#[clap(short = 'l', long = "list", conflicts_with_all(&["url", "replays"]))]
list: bool,
/// List available Olympics replays, may only be recent streams
/// List available Olympics replays (at most 24 are shown)
#[clap(short = 'a', long = "replays", conflicts_with_all(&["url", "list"]))]
replays: bool,
/// Streamlink log level
Expand Down Expand Up @@ -176,7 +176,7 @@ enum VidState {
}

impl MpxItem {
fn to_human(&self, state: VidState) -> String {
fn to_human(&self, state: VidState, full_urls: bool) -> String {
let air = self.air_date();
let now = Local::now();
let text =
Expand All @@ -199,7 +199,8 @@ impl MpxItem {
};
// bright white: white
// white: light gray
format!("{} - {}{}", self.id, note, self.title)
let prefix = if full_urls { "https://www.cbc.ca/player/play/" } else { "" };
format!("{}{} - {}{}", prefix, self.id, note, self.title)
}

fn air_date(&self) -> DateTime<Local> {
Expand Down Expand Up @@ -231,13 +232,13 @@ fn main() -> Result<()> {
let agent = ab.build();
if args.list {
for item in get_live_and_upcoming(&agent)?.data.mpx_items {
println!("{}", item.to_human(VidState::LiveOrUpcoming));
println!("{}", item.to_human(VidState::LiveOrUpcoming, args.full_urls));
}
return Ok(());
}
if args.replays {
for item in get_replays(&agent)?.data.mpx_items {
println!("{}", item.to_human(VidState::Replay));
println!("{}", item.to_human(VidState::Replay, args.full_urls));
}
return Ok(());
}
Expand Down

0 comments on commit a75d039

Please sign in to comment.