From 3c2bbf68f05f1224c93383a7b776d12b23278b0b Mon Sep 17 00:00:00 2001 From: VC Date: Thu, 5 Oct 2023 09:37:17 +0200 Subject: [PATCH 1/4] fix: take last video --- src/peertube.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peertube.rs b/src/peertube.rs index 78c94a0..ca945f4 100644 --- a/src/peertube.rs +++ b/src/peertube.rs @@ -37,7 +37,7 @@ pub struct PeerTubeVideoStreamingPlaylistsFilesResolution { /// This gets the last video uploaded to the PeerTube server pub fn get_latest_video(u: &str) -> Result> { - let body = reqwest::blocking::get(format!("{}/api/v1/videos?count=1&sort=publishedAt", u))? + let body = reqwest::blocking::get(format!("{}/api/v1/videos?count=1&sort=-publishedAt", u))? .json::()?; let vid = get_video_detail(u, &body.data[0].uuid)?; From 9cf81ec9e5bbcd66a423301fe72a0216ce77d40d Mon Sep 17 00:00:00 2001 From: VC Date: Thu, 5 Oct 2023 09:37:55 +0200 Subject: [PATCH 2/4] fix: publish the entire content in case of failure --- src/youtube.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/youtube.rs b/src/youtube.rs index 77f2987..630e0c6 100644 --- a/src/youtube.rs +++ b/src/youtube.rs @@ -167,6 +167,6 @@ pub fn upload_video( if res.status().is_success() { Ok(()) } else { - Err(TootubeError::new(&format!("Cannot upload video: {:?}", res.text())).into()) + Err(TootubeError::new(&format!("Cannot upload video: {:?}", res.text()?)).into()) } } From bddfb446140246624fb6a38d1fb7c1ed975e39fd Mon Sep 17 00:00:00 2001 From: VC Date: Thu, 5 Oct 2023 09:47:41 +0200 Subject: [PATCH 3/4] chore: bump version to 0.2.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6a6cf83..d2b9336 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -976,7 +976,7 @@ dependencies = [ [[package]] name = "tootube" -version = "0.1.0" +version = "0.2.0" dependencies = [ "clap", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index b4cf450..de4e77b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tootube" authors = ["VC "] -version = "0.1.0" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From 9bb088cc5e7b1ba9bfa49f359991ef59f33cbece Mon Sep 17 00:00:00 2001 From: VC Date: Thu, 5 Oct 2023 09:47:50 +0200 Subject: [PATCH 4/4] doc: update README --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 447fde7..bfbe526 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,30 @@ +# What is it? + +This program takes the very last video published on a PeerTube instance and pushes it to a corresponding YouTube channel. + +# What the status of this? + +This is an early prototype not really suited for production purposes for now: +* it still relies way too much on pre-determined value to upload the video to YouTube +* it cannot determine the playlists it needs to put them in +* it cannot determine the recording date (believe me, I tried!) +* there are still a lot of static values that I would rather not have static (like the cache directory…) +* it is 100% sync, meaning it’s clearly not optimal for now and probably won’t be for the next releases + +So consider this a work in progress that will slowly get better with time + +# What does it do exactly? + +* it downloads the latest PeerTube video from an instance +* stores it in cache directory +* uploads it to YouTube + +# What doesn’t it do exactly? + +* it cannot register the original key (see below) +* it relies on a local cache despite the fact that it might well be possible to just download from PT/upload to YT at the same time (I don’t see why not in fact) +* it doesn’t retrieve ALL the original PeerTube video properties like licences, languages, categories, etc… again: early prototype + # Obtain Authorization Token from Google That the complicated part: