mirror of
https://github.com/OMGeeky/twba_downloader.git
synced 2026-02-23 15:49:59 +01:00
fix some bugs & update
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
/target
|
||||
/.idea
|
||||
/.cargo
|
||||
data.db
|
||||
settings.toml
|
||||
|
||||
59
Cargo.lock
generated
59
Cargo.lock
generated
@@ -557,6 +557,27 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dotenvy"
|
||||
version = "0.15.7"
|
||||
@@ -1128,6 +1149,16 @@ version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.27.0"
|
||||
@@ -1389,6 +1420,12 @@ dependencies = [
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "option-ext"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
||||
|
||||
[[package]]
|
||||
name = "ordered-float"
|
||||
version = "3.9.2"
|
||||
@@ -1704,6 +1741,17 @@ dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"libredox",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.4"
|
||||
@@ -2250,6 +2298,15 @@ dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shellexpand"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da03fa3b94cc19e3ebfc88c4229c49d8f08cdbd1228870a45f0ffdf84988e14b"
|
||||
dependencies = [
|
||||
"dirs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.1"
|
||||
@@ -2941,6 +2998,7 @@ dependencies = [
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"shellexpand",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
@@ -2952,7 +3010,6 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "twba-local-db"
|
||||
version = "0.2.1"
|
||||
source = "git+https://github.com/OMGeeky/twitch_backup.local_db.git#7ad57a8bea84f2889b21ac337de8e36194d2fee7"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"sea-orm",
|
||||
|
||||
@@ -23,3 +23,4 @@ reqwest = "0.12.4"
|
||||
chrono = "0.4"
|
||||
futures = "0.3"
|
||||
futures-util = "0.3"
|
||||
shellexpand = "3.1"
|
||||
|
||||
@@ -33,7 +33,7 @@ async fn run() -> Result<()> {
|
||||
let conf = Conf::builder()
|
||||
.env()
|
||||
.file("./settings.toml")
|
||||
.file("/home/omgeeky/twba/config.toml")
|
||||
.file(shellexpand::tilde("~/twba/config.toml").to_string())
|
||||
.load()
|
||||
.map_err(|e| {
|
||||
error!("Failed to load config: {:?}", e);
|
||||
|
||||
@@ -36,12 +36,13 @@ impl TwitchClient {
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub async fn download_video<VideoId: DIntoString, QUALITY: DIntoString>(
|
||||
&self,
|
||||
id: i32,
|
||||
video_id: VideoId,
|
||||
quality: QUALITY,
|
||||
output_folder: &Path,
|
||||
) -> Result<PathBuf> {
|
||||
let video_id = video_id.into();
|
||||
let folder_path = output_folder.join(&video_id);
|
||||
let folder_path = output_folder.join(id.to_string());
|
||||
let final_path = output_folder.join(format!("{}.mp4", video_id));
|
||||
if final_path.exists() {
|
||||
return Err(DownloadFileError::TargetAlreadyExists(final_path).into());
|
||||
|
||||
Reference in New Issue
Block a user