mirror of
https://framagit.org/veretcle/tootube.git
synced 2025-07-21 13:24:19 +02:00
Merge branch 'rev3' into 'master'
Rev3 See merge request veretcle/tootube!4
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -976,7 +976,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tootube"
|
name = "tootube"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tootube"
|
name = "tootube"
|
||||||
authors = ["VC <veretcle+framagit@mateu.be>"]
|
authors = ["VC <veretcle+framagit@mateu.be>"]
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
27
README.md
27
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
|
# Obtain Authorization Token from Google
|
||||||
|
|
||||||
That the complicated part:
|
That the complicated part:
|
||||||
|
@@ -37,7 +37,7 @@ pub struct PeerTubeVideoStreamingPlaylistsFilesResolution {
|
|||||||
|
|
||||||
/// This gets the last video uploaded to the PeerTube server
|
/// This gets the last video uploaded to the PeerTube server
|
||||||
pub fn get_latest_video(u: &str) -> Result<PeerTubeVideo, Box<dyn Error>> {
|
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>()?;
|
.json::<PeerTubeVideos>()?;
|
||||||
|
|
||||||
let vid = get_video_detail(u, &body.data[0].uuid)?;
|
let vid = get_video_detail(u, &body.data[0].uuid)?;
|
||||||
|
@@ -167,6 +167,6 @@ pub fn upload_video(
|
|||||||
if res.status().is_success() {
|
if res.status().is_success() {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(TootubeError::new(&format!("Cannot upload video: {:?}", res.text())).into())
|
Err(TootubeError::new(&format!("Cannot upload video: {:?}", res.text()?)).into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user