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 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: 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)?; 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()) } }