mirror of
https://framagit.org/veretcle/tootube.git
synced 2025-07-20 20:41:17 +02:00
feat: add the newly added video to playlists if any
This commit is contained in:
12
src/lib.rs
12
src/lib.rs
@@ -13,7 +13,7 @@ use peertube::{get_latest_video, get_max_resolution_dl};
|
||||
|
||||
mod youtube;
|
||||
pub use youtube::register;
|
||||
use youtube::{create_resumable_upload, now_kiss};
|
||||
use youtube::{add_video_to_playlists, create_resumable_upload, now_kiss};
|
||||
|
||||
async fn get_dl_video_stream(
|
||||
u: &str,
|
||||
@@ -22,7 +22,7 @@ async fn get_dl_video_stream(
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn run(config: Config) {
|
||||
pub async fn run(config: Config, pl: Vec<String>) {
|
||||
// Get the latest video object
|
||||
let latest_vid = get_latest_video(&config.peertube.base_url)
|
||||
.await
|
||||
@@ -40,7 +40,13 @@ pub async fn run(config: Config) {
|
||||
.await
|
||||
.unwrap_or_else(|e| panic!("Cannot retrieve the upload’s resumable id: {e}"));
|
||||
|
||||
now_kiss(pt_stream, &resumable_upload_url, &config.youtube)
|
||||
let yt_video_id = now_kiss(pt_stream, &resumable_upload_url, &config.youtube)
|
||||
.await
|
||||
.unwrap_or_else(|e| panic!("Cannot resume upload!: {e}"));
|
||||
|
||||
if !pl.is_empty() {
|
||||
add_video_to_playlists(&config.youtube, &yt_video_id, &pl)
|
||||
.await
|
||||
.unwrap_or_else(|e| panic!("Cannot add video to playlist(s): {e}"));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user