update crate names

This commit is contained in:
OMGeeky
2024-04-20 13:44:01 +02:00
parent d26c4ebad4
commit b5be5b29c3
7 changed files with 321 additions and 106 deletions

395
Cargo.lock generated
View File

@@ -200,15 +200,6 @@ dependencies = [
"rustc-demangle",
]
[[package]]
name = "backup-config"
version = "0.1.3"
source = "git+https://github.com/OMGeeky/backup_config.git#ba18de57f80ca3e59a1da612f7c8a9f3aaa403e1"
dependencies = [
"confique",
"serde",
]
[[package]]
name = "base64"
version = "0.13.1"
@@ -221,6 +212,12 @@ version = "0.21.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9"
[[package]]
name = "base64"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51"
[[package]]
name = "base64ct"
version = "1.6.0"
@@ -891,8 +888,8 @@ source = "git+https://github.com/OMGeeky/google-apis-rs.git?branch=scope-derives
dependencies = [
"base64 0.13.1",
"chrono",
"http",
"hyper",
"http 0.2.9",
"hyper 0.14.27",
"itertools 0.10.5",
"mime",
"serde",
@@ -911,8 +908,8 @@ source = "git+https://github.com/OMGeeky/google-apis-rs.git?branch=scope-derives
dependencies = [
"anyhow",
"google-apis-common",
"http",
"hyper",
"http 0.2.9",
"hyper 0.14.27",
"hyper-rustls",
"itertools 0.10.5",
"mime",
@@ -934,7 +931,7 @@ dependencies = [
"futures-core",
"futures-sink",
"futures-util",
"http",
"http 0.2.9",
"indexmap 1.9.3",
"slab",
"tokio",
@@ -942,6 +939,25 @@ dependencies = [
"tracing",
]
[[package]]
name = "h2"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069"
dependencies = [
"bytes",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
"http 1.1.0",
"indexmap 2.0.2",
"slab",
"tokio",
"tokio-util",
"tracing",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
@@ -1047,6 +1063,17 @@ dependencies = [
"itoa",
]
[[package]]
name = "http"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
dependencies = [
"bytes",
"fnv",
"itoa",
]
[[package]]
name = "http-body"
version = "0.4.5"
@@ -1054,7 +1081,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
dependencies = [
"bytes",
"http",
"http 0.2.9",
"pin-project-lite",
]
[[package]]
name = "http-body"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
dependencies = [
"bytes",
"http 1.1.0",
]
[[package]]
name = "http-body-util"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d"
dependencies = [
"bytes",
"futures-core",
"http 1.1.0",
"http-body 1.0.0",
"pin-project-lite",
]
@@ -1080,9 +1130,9 @@ dependencies = [
"futures-channel",
"futures-core",
"futures-util",
"h2",
"http",
"http-body",
"h2 0.3.21",
"http 0.2.9",
"http-body 0.4.5",
"httparse",
"httpdate",
"itoa",
@@ -1094,6 +1144,26 @@ dependencies = [
"want",
]
[[package]]
name = "hyper"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d"
dependencies = [
"bytes",
"futures-channel",
"futures-util",
"h2 0.4.4",
"http 1.1.0",
"http-body 1.0.0",
"httparse",
"itoa",
"pin-project-lite",
"smallvec",
"tokio",
"want",
]
[[package]]
name = "hyper-rustls"
version = "0.24.1"
@@ -1101,8 +1171,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97"
dependencies = [
"futures-util",
"http",
"hyper",
"http 0.2.9",
"hyper 0.14.27",
"log",
"rustls",
"rustls-native-certs",
@@ -1112,15 +1182,38 @@ dependencies = [
[[package]]
name = "hyper-tls"
version = "0.5.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
dependencies = [
"bytes",
"hyper",
"http-body-util",
"hyper 1.3.1",
"hyper-util",
"native-tls",
"tokio",
"tokio-native-tls",
"tower-service",
]
[[package]]
name = "hyper-util"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa"
dependencies = [
"bytes",
"futures-channel",
"futures-util",
"http 1.1.0",
"http-body 1.0.0",
"hyper 1.3.1",
"pin-project-lite",
"socket2 0.5.5",
"tokio",
"tower",
"tower-service",
"tracing",
]
[[package]]
@@ -1293,19 +1386,6 @@ version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f"
[[package]]
name = "local-db"
version = "0.2.1"
source = "git+https://github.com/OMGeeky/twitch_backup.local_db.git#0a15447f4d5e5093c27aa89936ecedfa9961e5be"
dependencies = [
"futures",
"sea-orm",
"sea-orm-migration",
"thiserror",
"tokio",
"tracing",
]
[[package]]
name = "lock_api"
version = "0.4.11"
@@ -1700,6 +1780,26 @@ dependencies = [
"sha2",
]
[[package]]
name = "pin-project"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.38",
]
[[package]]
name = "pin-project-lite"
version = "0.2.13"
@@ -1960,12 +2060,53 @@ dependencies = [
"encoding_rs",
"futures-core",
"futures-util",
"h2",
"http",
"http-body",
"hyper",
"h2 0.3.21",
"http 0.2.9",
"http-body 0.4.5",
"hyper 0.14.27",
"hyper-rustls",
"ipnet",
"js-sys",
"log",
"mime",
"once_cell",
"percent-encoding 2.3.0",
"pin-project-lite",
"rustls",
"rustls-native-certs",
"rustls-pemfile 1.0.3",
"serde",
"serde_json",
"serde_urlencoded",
"system-configuration",
"tokio",
"tokio-rustls",
"tower-service",
"url 2.4.1",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"winreg 0.50.0",
]
[[package]]
name = "reqwest"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10"
dependencies = [
"base64 0.22.0",
"bytes",
"encoding_rs",
"futures-core",
"futures-util",
"h2 0.4.4",
"http 1.1.0",
"http-body 1.0.0",
"http-body-util",
"hyper 1.3.1",
"hyper-tls",
"hyper-util",
"ipnet",
"js-sys",
"log",
@@ -1974,35 +2115,20 @@ dependencies = [
"once_cell",
"percent-encoding 2.3.0",
"pin-project-lite",
"rustls",
"rustls-native-certs",
"rustls-pemfile",
"rustls-pemfile 2.1.2",
"serde",
"serde_json",
"serde_urlencoded",
"sync_wrapper",
"system-configuration",
"tokio",
"tokio-native-tls",
"tokio-rustls",
"tower-service",
"url 2.4.1",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"winreg",
]
[[package]]
name = "reqwest-backoff"
version = "0.1.2"
source = "git+https://github.com/OMGeeky/twba_reqwest_backoff.git#ee5cdac90fa6079d1aa6c17b1f8c49e0e3a75cb0"
dependencies = [
"chrono",
"reqwest",
"thiserror",
"tokio",
"tracing",
"url 2.4.1",
"winreg 0.52.0",
]
[[package]]
@@ -2124,7 +2250,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
dependencies = [
"openssl-probe",
"rustls-pemfile",
"rustls-pemfile 1.0.3",
"schannel",
"security-framework",
]
@@ -2138,6 +2264,22 @@ dependencies = [
"base64 0.21.5",
]
[[package]]
name = "rustls-pemfile"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d"
dependencies = [
"base64 0.22.0",
"rustls-pki-types",
]
[[package]]
name = "rustls-pki-types"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247"
[[package]]
name = "rustls-webpki"
version = "0.101.6"
@@ -2527,9 +2669,9 @@ dependencies = [
[[package]]
name = "smallvec"
version = "1.11.1"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "socket2"
@@ -2632,7 +2774,7 @@ dependencies = [
"percent-encoding 2.3.0",
"rust_decimal",
"rustls",
"rustls-pemfile",
"rustls-pemfile 1.0.3",
"serde",
"serde_json",
"sha2",
@@ -2867,6 +3009,12 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "sync_wrapper"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
[[package]]
name = "system-configuration"
version = "0.5.1"
@@ -3067,6 +3215,28 @@ dependencies = [
"serde",
]
[[package]]
name = "tower"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
dependencies = [
"futures-core",
"futures-util",
"pin-project",
"pin-project-lite",
"tokio",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tower-layer"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
[[package]]
name = "tower-service"
version = "0.3.2"
@@ -3141,6 +3311,66 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
[[package]]
name = "twba-backup-config"
version = "0.1.3"
source = "git+https://github.com/OMGeeky/backup_config.git#88645945830d3076478827503fef43541a2f047e"
dependencies = [
"confique",
"serde",
]
[[package]]
name = "twba-local-db"
version = "0.2.1"
source = "git+https://github.com/OMGeeky/twitch_backup.local_db.git#3cbb175182d5f01b150ca07ad184ef99315f45c5"
dependencies = [
"futures",
"sea-orm",
"sea-orm-migration",
"thiserror",
"tokio",
"tracing",
]
[[package]]
name = "twba-reqwest-backoff"
version = "0.1.2"
source = "git+https://github.com/OMGeeky/twba_reqwest_backoff.git#916e98a2e6cfda593b23bc4e76b137cb92660463"
dependencies = [
"chrono",
"reqwest 0.12.4",
"thiserror",
"tokio",
"tracing",
"url 2.4.1",
]
[[package]]
name = "twba-uploader"
version = "0.1.0"
dependencies = [
"anyhow",
"chrono",
"futures",
"futures-util",
"google-youtube3",
"lazy_static",
"reqwest 0.11.22",
"serde",
"serde_json",
"shellexpand",
"strfmt",
"thiserror",
"tokio",
"tracing",
"tracing-subscriber",
"twba-backup-config",
"twba-local-db",
"twba-reqwest-backoff",
"yup-oauth2",
]
[[package]]
name = "typenum"
version = "1.17.0"
@@ -3198,31 +3428,6 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "uploader"
version = "0.1.0"
dependencies = [
"anyhow",
"backup-config",
"chrono",
"futures",
"futures-util",
"google-youtube3",
"lazy_static",
"local-db",
"reqwest",
"reqwest-backoff",
"serde",
"serde_json",
"shellexpand",
"strfmt",
"thiserror",
"tokio",
"tracing",
"tracing-subscriber",
"yup-oauth2",
]
[[package]]
name = "url"
version = "1.7.2"
@@ -3491,6 +3696,16 @@ dependencies = [
"windows-sys",
]
[[package]]
name = "winreg"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"
dependencies = [
"cfg-if",
"windows-sys",
]
[[package]]
name = "wyz"
version = "0.5.1"
@@ -3509,14 +3724,14 @@ dependencies = [
"async-trait",
"base64 0.13.1",
"futures",
"http",
"hyper",
"http 0.2.9",
"hyper 0.14.27",
"hyper-rustls",
"itertools 0.10.5",
"log",
"percent-encoding 2.3.0",
"rustls",
"rustls-pemfile",
"rustls-pemfile 1.0.3",
"seahash",
"serde",
"serde_json",

View File

@@ -1,14 +1,14 @@
[package]
name = "uploader"
name = "twba-uploader"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
backup-config = { version = "0.1.2", git = "https://github.com/OMGeeky/backup_config.git" }
local-db = { version = "0.2", git = "https://github.com/OMGeeky/twitch_backup.local_db.git" }
reqwest-backoff = { version = "0.1", git = "https://github.com/OMGeeky/twba_reqwest_backoff.git" }
twba-backup-config = { version = "0.1.2", git = "https://github.com/OMGeeky/backup_config.git" }
twba-local-db = { version = "0.2", git = "https://github.com/OMGeeky/twitch_backup.local_db.git" }
twba-reqwest-backoff = { version = "0.1", git = "https://github.com/OMGeeky/twba_reqwest_backoff.git" }
tracing-subscriber = "0.3"

View File

@@ -3,9 +3,9 @@ use crate::CONF;
use anyhow::{anyhow, Context};
use google_youtube3::api::Scope;
use lazy_static::lazy_static;
use local_db::entities::video_upload::{ActiveModel as VideoUploadActiveModel, UploadStatus};
use local_db::prelude::*;
use local_db::re_exports::sea_orm::{
use twba_local_db::entities::video_upload::{ActiveModel as VideoUploadActiveModel, UploadStatus};
use twba_local_db::prelude::*;
use twba_local_db::re_exports::sea_orm::{
ActiveModelTrait, ActiveValue, ColumnTrait, DatabaseConnection, EntityTrait, IntoActiveModel,
Order, QueryFilter, QueryOrder,
};
@@ -255,7 +255,7 @@ impl UploaderClient {
let mut clients = HashMap::new();
let users = local_db::get_watched_users(&db).await?;
let users = twba_local_db::get_watched_users(&db).await?;
for user in users {
let user_id = user.id.to_string();
let client = youtube::YoutubeClient::new(&YOUTUBE_DEFAULT_SCOPES, Some(user)).await?;

View File

@@ -16,8 +16,8 @@ use google_youtube3::{
hyper_rustls::{HttpsConnector, HttpsConnectorBuilder},
Error as YoutubeError,
};
use local_db::entities::videos::Model;
use local_db::prelude::{UsersModel, VideosModel};
use twba_local_db::entities::videos::Model;
use twba_local_db::prelude::{UsersModel, VideosModel};
use tokio::fs;
use tracing::instrument;

View File

@@ -1,6 +1,6 @@
use crate::prelude::*;
use anyhow::anyhow;
use backup_config::Conf;
use twba_backup_config::Conf;
use std::{
fmt::{Debug, Formatter},
future::Future,

View File

@@ -4,7 +4,7 @@ pub enum UploaderError {
LoadConfig(#[source] anyhow::Error),
#[error("Some error with the database")]
OpenDatabase(#[from] local_db::re_exports::sea_orm::DbErr),
OpenDatabase(#[from] twba_local_db::re_exports::sea_orm::DbErr),
#[error("Error with some Youtube operation: {0} ")]
YoutubeError(#[source] google_youtube3::Error),

View File

@@ -1,5 +1,5 @@
#![allow(unused)]
use backup_config::prelude::*;
use twba_backup_config::prelude::*;
use lazy_static::lazy_static;
use prelude::*;
@@ -28,7 +28,7 @@ lazy_static! {
.file(shellexpand::tilde("~/twba/config.toml").into_owned())
.load()
.map_err(|e| UploaderError::LoadConfig(e.into()))
.expect("to load config");
.expect("Failed to load config");
}
#[tokio::main]
async fn main() -> Result<()> {
@@ -53,9 +53,9 @@ async fn run() -> Result<()> {
debug!("{:?}", x);
trace!("creating db-connection with db url: {}", &CONF.db_url);
let db = local_db::open_database(Some(&CONF.db_url)).await?;
let db = twba_local_db::open_database(Some(&CONF.db_url)).await?;
trace!("migrating db");
local_db::migrate_db(&db).await?;
twba_local_db::migrate_db(&db).await?;
// local_db::print_db(&db).await?;
trace!("creating client");