Merge branch 'rev3' into 'master'

Rev3

See merge request veretcle/tootube!4
This commit is contained in:
VC
2023-10-05 07:49:12 +00:00
5 changed files with 31 additions and 4 deletions

2
Cargo.lock generated
View File

@@ -976,7 +976,7 @@ dependencies = [
[[package]]
name = "tootube"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"clap",
"env_logger",

View File

@@ -1,7 +1,7 @@
[package]
name = "tootube"
authors = ["VC <veretcle+framagit@mateu.be>"]
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

View File

@@ -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 its clearly not optimal for now and probably wont 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 doesnt 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 dont see why not in fact)
* it doesnt retrieve ALL the original PeerTube video properties like licences, languages, categories, etc… again: early prototype
# Obtain Authorization Token from Google
That the complicated part:

View File

@@ -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<PeerTubeVideo, Box<dyn Error>> {
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::<PeerTubeVideos>()?;
let vid = get_video_detail(u, &body.data[0].uuid)?;

View File

@@ -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())
}
}