aboutsummaryrefslogtreecommitdiffstats
path: root/old/ytc
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-02-14 16:15:31 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-02-14 16:15:31 +0100
commite2b90b40333e35214f0b1c1e1f575bb688a99e74 (patch)
treecd33fb96ee850a2ac6c5d9d3cb51fb2be98cec60 /old/ytc
parentchore(crates/yt_dlp/wrappers/info_json): Add further fields (diff)
downloadyt-e2b90b40333e35214f0b1c1e1f575bb688a99e74.zip
chore(old): Remove
There is no need to include this old code any longer.
Diffstat (limited to 'old/ytc')
-rw-r--r--old/ytc/main.rs85
1 files changed, 0 insertions, 85 deletions
diff --git a/old/ytc/main.rs b/old/ytc/main.rs
deleted file mode 100644
index e1359f9..0000000
--- a/old/ytc/main.rs
+++ /dev/null
@@ -1,85 +0,0 @@
-// yt - A fully featured command line YouTube client
-//
-// Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de>
-// SPDX-License-Identifier: GPL-3.0-or-later
-//
-// This file is part of Yt.
-//
-// You should have received a copy of the License along with this program.
-// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-
-use std::{env, process::Command as StdCmd};
-
-use anyhow::{bail, Context, Result};
-use clap::Parser;
-use log::debug;
-use url::Url;
-use yt::{
- downloader::{Downloadable, Downloader},
- YtccListData,
-};
-
-use crate::args::{Args, Command};
-
-fn main() -> Result<()> {
- let args = Args::parse();
- cli_log::init_cli_log!();
-
- let playspec: Vec<Downloadable> = match args.subcommand {
- Command::Id { ids } => {
- let mut output = Vec::with_capacity(ids.len());
- for id in ids {
- debug!("Adding {}", id);
- let mut ytcc = StdCmd::new("ytcc");
- ytcc.args([
- "--output",
- "json",
- "list",
- "--watched",
- "--unwatched",
- "--attributes",
- "url",
- "--ids",
- id.to_string().as_str(),
- ]);
- let json = serde_json::from_slice::<Vec<YtccListData>>(
- &ytcc.output().context("Failed to get url from id")?.stdout,
- )
- .context("Failed to deserialize json output")?;
-
- if json.is_empty() {
- bail!("Could not find a video with id: {}", id);
- }
- assert_eq!(json.len(), 1);
- let json = json.first().expect("Has only one element");
-
- debug!("Id resolved to: '{}'", &json.url);
-
- output.push(Downloadable {
- url: Url::parse(&json.url)?,
- id: Some(json.id),
- })
- }
- output
- }
- Command::Url { urls } => {
- let mut output = Vec::with_capacity(urls.len());
- for url in urls {
- output.push(Downloadable {
- url: Url::parse(&url).context("Failed to parse url")?,
- id: None,
- })
- }
- output
- }
- };
-
- debug!("Initializing downloader");
- let downloader = Downloader::new(playspec)?;
-
- downloader
- .consume()
- .context("Failed to consume downloader")?;
-
- Ok(())
-}