S3 song download (#260)
soaricarus_api CI / Rustfmt (push) Successful in 3m46s
soaricarus_api CI / Check (push) Successful in 5m3s
soaricarus_api CI / Test Suite (push) Successful in 6m21s
soaricarus_api CI / Clippy (push) Successful in 6m46s
soaricarus_api CI / build (push) Successful in 8m45s
pr CI / Test Suite (pull_request) Successful in 5m9s
soaricarus_api CI / Rustfmt (push) Successful in 3m46s
soaricarus_api CI / Check (push) Successful in 5m3s
soaricarus_api CI / Test Suite (push) Successful in 6m21s
soaricarus_api CI / Clippy (push) Successful in 6m46s
soaricarus_api CI / build (push) Successful in 8m45s
pr CI / Test Suite (pull_request) Successful in 5m9s
Reviewed-on: #260
This commit was merged in pull request #260.
This commit is contained in:
Generated
+49
-38
@@ -485,7 +485,7 @@ checksum = "221eaa237ddf1ca79b60d1372aad77e47f9c0ea5b3ce5099da8c61d027dc77b3"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -981,7 +981,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1018,7 +1018,7 @@ checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1053,7 +1053,7 @@ checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1341,7 +1341,7 @@ checksum = "2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2022,7 +2022,7 @@ checksum = "458ace39169e4b83c4f77ae3d42d5d1d11c422feef590219a97c973d3b524557"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2240,7 +2240,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2613,7 +2613,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"rust-embed-utils",
|
"rust-embed-utils",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2809,9 +2809,9 @@ checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.228"
|
version = "1.0.229"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_core",
|
"serde_core",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
@@ -2819,29 +2819,29 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_core"
|
name = "serde_core"
|
||||||
version = "1.0.228"
|
version = "1.0.229"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.228"
|
version = "1.0.229"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 3.0.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.150"
|
version = "1.0.151"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
|
checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itoa",
|
"itoa",
|
||||||
@@ -2981,8 +2981,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "simodels"
|
name = "simodels"
|
||||||
version = "0.11.3"
|
version = "0.11.4"
|
||||||
source = "git+ssh://git@git.kundeng.us/phoenix/simodels.git?tag=v0.11.3-main-fe9d101bd0-111#fe9d101bd019f91fe8c99c29721ccb0e6e90c92c"
|
source = "git+ssh://git@git.kundeng.us/phoenix/simodels.git?tag=v0.11.4#d6d719741945ef7719ab1db3e0ef3c617b5bb909"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"josekit",
|
"josekit",
|
||||||
"rand 0.10.2",
|
"rand 0.10.2",
|
||||||
@@ -3022,7 +3022,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "soaricarus_api"
|
name = "soaricarus_api"
|
||||||
version = "0.5.5"
|
version = "0.5.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"axum-extra",
|
"axum-extra",
|
||||||
@@ -3157,7 +3157,7 @@ dependencies = [
|
|||||||
"quote",
|
"quote",
|
||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"sqlx-macros-core",
|
"sqlx-macros-core",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3180,7 +3180,7 @@ dependencies = [
|
|||||||
"sqlx-mysql",
|
"sqlx-mysql",
|
||||||
"sqlx-postgres",
|
"sqlx-postgres",
|
||||||
"sqlx-sqlite",
|
"sqlx-sqlite",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
@@ -3311,6 +3311,17 @@ dependencies = [
|
|||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "3.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sync_wrapper"
|
name = "sync_wrapper"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
@@ -3325,7 +3336,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3367,7 +3378,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3378,7 +3389,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3392,9 +3403,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.53"
|
version = "0.3.55"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "18dfaaeddcb932337b5e7866ee7d0ce9b76d2fd092997146f187ec09b4558a50"
|
checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"deranged",
|
"deranged",
|
||||||
"num-conv",
|
"num-conv",
|
||||||
@@ -3412,9 +3423,9 @@ checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time-macros"
|
name = "time-macros"
|
||||||
version = "0.2.31"
|
version = "0.2.32"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c431b87111666e491a90baa837f914fb45cd5dc3c268591b0220ff5057f2085f"
|
checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-conv",
|
"num-conv",
|
||||||
"time-core",
|
"time-core",
|
||||||
@@ -3470,7 +3481,7 @@ checksum = "6328af13490e73a9b4694030fafd93f8c8c6a9dede33e821c3fc63eddf8042ba"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3586,7 +3597,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3726,7 +3737,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"regex",
|
"regex",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3841,7 +3852,7 @@ dependencies = [
|
|||||||
"bumpalo",
|
"bumpalo",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3988,7 +3999,7 @@ checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -4009,7 +4020,7 @@ checksum = "e2e817b7b52d0c7358d3246da9d69935ebb18116b2b102b4230dac079b4862f5"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4029,7 +4040,7 @@ checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -4050,7 +4061,7 @@ checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4083,7 +4094,7 @@ checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 2.0.119",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
+6
-6
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "soaricarus_api"
|
name = "soaricarus_api"
|
||||||
version = "0.5.5"
|
version = "0.5.6"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.95"
|
rust-version = "1.95"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@@ -10,8 +10,8 @@ description = "Core API for interacting with soaricarus"
|
|||||||
axum = { version = "0.8.9", features = ["multipart"] }
|
axum = { version = "0.8.9", features = ["multipart"] }
|
||||||
axum-extra = { version = "0.12.6", features = ["cookie"] }
|
axum-extra = { version = "0.12.6", features = ["cookie"] }
|
||||||
openssl = { version = "0.10.81", features = ["vendored"] }
|
openssl = { version = "0.10.81", features = ["vendored"] }
|
||||||
serde = { version = "1.0.228", features = ["derive"] }
|
serde = { version = "1.0.229", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.150" }
|
serde_json = { version = "1.0.151" }
|
||||||
tokio = { version = "1.52.3", features = ["full"] }
|
tokio = { version = "1.52.3", features = ["full"] }
|
||||||
tokio-util = { version = "0.7.18", features = ["io"] }
|
tokio-util = { version = "0.7.18", features = ["io"] }
|
||||||
tower = { version = "0.5.3", features = ["full"] }
|
tower = { version = "0.5.3", features = ["full"] }
|
||||||
@@ -19,15 +19,15 @@ tower-http = { version = "0.7.0", features = ["cors", "timeout"] }
|
|||||||
tracing-subscriber = "0.3.23"
|
tracing-subscriber = "0.3.23"
|
||||||
futures = { version = "0.3.32" }
|
futures = { version = "0.3.32" }
|
||||||
mime_guess = { version = "2.0.5" }
|
mime_guess = { version = "2.0.5" }
|
||||||
uuid = { version = "1.23.5", features = ["v4", "serde"] }
|
uuid = { version = "1.24.0", features = ["v4", "serde"] }
|
||||||
sqlx = { version = "0.9.0", features = ["postgres", "runtime-tokio", "tls-native-tls", "time", "uuid"] }
|
sqlx = { version = "0.9.0", features = ["postgres", "runtime-tokio", "tls-native-tls", "time", "uuid"] }
|
||||||
time = { version = "0.3.53", features = ["formatting", "macros", "parsing", "serde"] }
|
time = { version = "0.3.54", features = ["formatting", "macros", "parsing", "serde"] }
|
||||||
jsonwebtoken = { version = "10.3.0", features = ["rust_crypto"] }
|
jsonwebtoken = { version = "10.3.0", features = ["rust_crypto"] }
|
||||||
josekit = { version = "0.10.3" }
|
josekit = { version = "0.10.3" }
|
||||||
utoipa = { version = "5.5.0", features = ["axum_extras"] }
|
utoipa = { version = "5.5.0", features = ["axum_extras"] }
|
||||||
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
|
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
|
||||||
simeta = { git = "ssh://git@git.kundeng.us/phoenix/simeta.git", tag = "v0.6.1-main-b690995806-680" }
|
simeta = { git = "ssh://git@git.kundeng.us/phoenix/simeta.git", tag = "v0.6.1-main-b690995806-680" }
|
||||||
simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.3-main-fe9d101bd0-111" }
|
simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.4" }
|
||||||
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.0-main-d06c8fdf49-006" }
|
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.0-main-d06c8fdf49-006" }
|
||||||
labyrinth = { git = "ssh://git@git.kundeng.us/phoenix/labyrinth.git", tag = "v0.0.4" }
|
labyrinth = { git = "ssh://git@git.kundeng.us/phoenix/labyrinth.git", tag = "v0.0.4" }
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ CREATE TABLE IF NOT EXISTS "song" (
|
|||||||
date_created timestamptz DEFAULT now(),
|
date_created timestamptz DEFAULT now(),
|
||||||
filename TEXT NOT NULL,
|
filename TEXT NOT NULL,
|
||||||
directory TEXT NOT NULL,
|
directory TEXT NOT NULL,
|
||||||
|
file_key TEXT NOT NULL,
|
||||||
user_id UUID NULL
|
user_id UUID NULL
|
||||||
-- TODO: Add coverart id later. This will allow multiple songs to be linked to a single cover art
|
-- TODO: Add coverart id later. This will allow multiple songs to be linked to a single cover art
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ pub mod endpoint {
|
|||||||
|
|
||||||
let lr = labyrinth::Labyrinth { config: lab_config };
|
let lr = labyrinth::Labyrinth { config: lab_config };
|
||||||
let data = labyrinth::Data {
|
let data = labyrinth::Data {
|
||||||
raw_data: raw_data,
|
raw_data,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+97
-36
@@ -159,8 +159,14 @@ pub mod endpoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match song.save_to_filesystem() {
|
song.file_key = format!("processed/song/{}", song.filename);
|
||||||
Ok(_) => match repo::song::insert(&pool, &song).await {
|
let data_of_song = labyrinth::Data {
|
||||||
|
raw_data: song.data.clone(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
match lr.upload(&song.file_key, &data_of_song).await {
|
||||||
|
Ok(_resp) => match repo::song::insert(&pool, &song).await {
|
||||||
Ok((date_created, id)) => {
|
Ok((date_created, id)) => {
|
||||||
song.id = id;
|
song.id = id;
|
||||||
song.date_created = Some(date_created);
|
song.date_created = Some(date_created);
|
||||||
@@ -176,7 +182,7 @@ pub mod endpoint {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = err.to_string();
|
eprintln!("Error: {err:?}");
|
||||||
(
|
(
|
||||||
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
axum::Json(response),
|
axum::Json(response),
|
||||||
@@ -290,40 +296,90 @@ pub mod endpoint {
|
|||||||
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
|
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
|
||||||
) -> impl IntoResponse {
|
) -> impl IntoResponse {
|
||||||
match repo::song::get_song(&pool, &id).await {
|
match repo::song::get_song(&pool, &id).await {
|
||||||
Ok(song) => {
|
Ok(mut song) => {
|
||||||
let song_path = song.song_path().unwrap();
|
let lab_config = crate::util::maze::get_config();
|
||||||
let path = std::path::Path::new(&song_path);
|
let lr = labyrinth::Labyrinth { config: lab_config };
|
||||||
|
|
||||||
if !path.starts_with(&song.directory) || !path.exists() {
|
match lr.download(&song.file_key).await {
|
||||||
return Err((axum::http::StatusCode::NOT_FOUND, "File not found"));
|
Ok(data) => {
|
||||||
}
|
song.filename = simodels::song::generate_filename(
|
||||||
|
simodels::types::MusicType::FlacExtension,
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
// TODO: At some point, directory will no longer be needed with s3
|
||||||
|
song.directory = sienvy::environment::get_root_directory().value;
|
||||||
|
song.data = data;
|
||||||
|
|
||||||
let file = match tokio::fs::File::open(&path).await {
|
match song.save_to_filesystem() {
|
||||||
Ok(file) => file,
|
Ok(_) => {
|
||||||
Err(_) => return Err((axum::http::StatusCode::NOT_FOUND, "File not found")),
|
let song_path = song.song_path().unwrap();
|
||||||
};
|
let path = std::path::Path::new(&song_path);
|
||||||
|
|
||||||
let file_size = match file.metadata().await {
|
if !path.starts_with(&song.directory) || !path.exists() {
|
||||||
Ok(meta) => meta.len(),
|
return Err((
|
||||||
Err(_) => {
|
axum::http::StatusCode::NOT_FOUND,
|
||||||
return Err((
|
"File not found",
|
||||||
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
));
|
||||||
"Could not read file",
|
}
|
||||||
));
|
|
||||||
|
let file = match tokio::fs::File::open(&path).await {
|
||||||
|
Ok(file) => file,
|
||||||
|
Err(_) => {
|
||||||
|
return Err((
|
||||||
|
axum::http::StatusCode::NOT_FOUND,
|
||||||
|
"File not found",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let file_size = match file.metadata().await {
|
||||||
|
Ok(meta) => meta.len(),
|
||||||
|
Err(_) => {
|
||||||
|
return Err((
|
||||||
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
"Could not read file",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let mime = mime_guess::from_path(path).first_or_octet_stream();
|
||||||
|
let stream = tokio_util::io::ReaderStream::new(file);
|
||||||
|
|
||||||
|
let rep = axum::response::Response::builder()
|
||||||
|
.header("content-type", mime.to_string())
|
||||||
|
.header("accept-ranges", "bytes")
|
||||||
|
.header("content-length", file_size.to_string())
|
||||||
|
.body(axum::body::Body::from_stream(stream))
|
||||||
|
.unwrap();
|
||||||
|
match song.remove_from_filesystem() {
|
||||||
|
Ok(_) => Ok(rep),
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("Error: {err:?}");
|
||||||
|
Err((
|
||||||
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
"Could not read file",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("Error: {err:?}");
|
||||||
|
Err((
|
||||||
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
"Could not find file",
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
Err(err) => {
|
||||||
|
eprintln!("Error: {err:?}");
|
||||||
let mime = mime_guess::from_path(path).first_or_octet_stream();
|
Err((
|
||||||
let stream = tokio_util::io::ReaderStream::new(file);
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
"Could not find file",
|
||||||
let rep = axum::response::Response::builder()
|
))
|
||||||
.header("content-type", mime.to_string())
|
}
|
||||||
.header("accept-ranges", "bytes")
|
}
|
||||||
.header("content-length", file_size.to_string())
|
|
||||||
.body(axum::body::Body::from_stream(stream))
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
Ok(rep)
|
|
||||||
}
|
}
|
||||||
Err(_err) => Err((
|
Err(_err) => Err((
|
||||||
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
@@ -347,8 +403,11 @@ pub mod endpoint {
|
|||||||
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
||||||
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
|
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
|
||||||
) -> (axum::http::StatusCode, axum::response::Response) {
|
) -> (axum::http::StatusCode, axum::response::Response) {
|
||||||
|
let lab_config = crate::util::maze::get_config();
|
||||||
|
let lr = labyrinth::Labyrinth { config: lab_config };
|
||||||
|
|
||||||
match repo::song::get_song(&pool, &id).await {
|
match repo::song::get_song(&pool, &id).await {
|
||||||
Ok(song) => match simodels::song::io::to_data(&song) {
|
Ok(song) => match lr.download(&song.file_key).await {
|
||||||
Ok(data) => {
|
Ok(data) => {
|
||||||
let bytes = axum::body::Bytes::from(data);
|
let bytes = axum::body::Bytes::from(data);
|
||||||
let mut response = bytes.into_response();
|
let mut response = bytes.into_response();
|
||||||
@@ -397,6 +456,8 @@ pub mod endpoint {
|
|||||||
axum::Json<super::response::delete_song::Response>,
|
axum::Json<super::response::delete_song::Response>,
|
||||||
) {
|
) {
|
||||||
let mut response = super::response::delete_song::Response::default();
|
let mut response = super::response::delete_song::Response::default();
|
||||||
|
let lab_config = crate::util::maze::get_config();
|
||||||
|
let lr = labyrinth::Labyrinth { config: lab_config };
|
||||||
|
|
||||||
match repo::song::get_song(&pool, &id).await {
|
match repo::song::get_song(&pool, &id).await {
|
||||||
Ok(song) => {
|
Ok(song) => {
|
||||||
@@ -420,7 +481,7 @@ pub mod endpoint {
|
|||||||
match repo::coverart::delete_coverart(&pool, &coverart.id).await
|
match repo::coverart::delete_coverart(&pool, &coverart.id).await
|
||||||
{
|
{
|
||||||
Ok(deleted_coverart) => {
|
Ok(deleted_coverart) => {
|
||||||
match song.remove_from_filesystem() {
|
match lr.delete(&song.file_key).await {
|
||||||
Ok(_) => match coverart.remove_from_filesystem() {
|
Ok(_) => match coverart.remove_from_filesystem() {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
response.message = String::from(
|
response.message = String::from(
|
||||||
@@ -438,7 +499,7 @@ pub mod endpoint {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = err.to_string();
|
eprintln!("Error: {err:?}");
|
||||||
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
(axum::http::StatusCode::INTERNAL_SERVER_ERROR, axum::Json(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+73
-2
@@ -500,10 +500,82 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod sequence_flow {
|
mod sequence_flow {
|
||||||
|
pub const TEST_SONG_01_FILE_KEY: &str = "processed/song/track01.flac";
|
||||||
|
pub const TEST_SONG_02_FILE_KEY: &str = "processed/song/track02.flac";
|
||||||
|
|
||||||
|
pub struct SongBucket {
|
||||||
|
pub file_key: String,
|
||||||
|
pub path: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn upload_test_songs_to_bucket() {
|
||||||
|
let songs = vec![
|
||||||
|
SongBucket {
|
||||||
|
file_key: TEST_SONG_01_FILE_KEY.to_string(),
|
||||||
|
path: "tests/I/track01.flac".to_string(),
|
||||||
|
},
|
||||||
|
SongBucket {
|
||||||
|
file_key: TEST_SONG_02_FILE_KEY.to_string(),
|
||||||
|
path: "tests/I/track02.flac".to_string(),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
let lab_config = soaricarus_api::util::maze::get_config();
|
||||||
|
let lr = labyrinth::Labyrinth { config: lab_config };
|
||||||
|
|
||||||
|
for song in &songs {
|
||||||
|
let p = std::path::Path::new(&song.path);
|
||||||
|
match tokio::fs::File::open(p).await {
|
||||||
|
Ok(mut _file) => {
|
||||||
|
let data = labyrinth::Data {
|
||||||
|
filepath: song.path.clone(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
match lr.upload(&song.file_key, &data).await {
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: {err:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: {err:?}");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn delete_test_songs_from_bucket() {
|
||||||
|
let songs = vec![
|
||||||
|
SongBucket {
|
||||||
|
file_key: TEST_SONG_01_FILE_KEY.to_string(),
|
||||||
|
path: "tests/I/track01.flac".to_string(),
|
||||||
|
},
|
||||||
|
SongBucket {
|
||||||
|
file_key: TEST_SONG_02_FILE_KEY.to_string(),
|
||||||
|
path: "tests/I/track02.flac".to_string(),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
let lab_config = soaricarus_api::util::maze::get_config();
|
||||||
|
let lr = labyrinth::Labyrinth { config: lab_config };
|
||||||
|
|
||||||
|
for song in &songs {
|
||||||
|
match lr.delete(&song.file_key).await {
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: {err:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Flow for queueing song
|
// Flow for queueing song
|
||||||
pub async fn queue_song_flow(
|
pub async fn queue_song_flow(
|
||||||
app: &axum::Router,
|
app: &axum::Router,
|
||||||
) -> Result<(axum::response::Response, uuid::Uuid), axum::http::Error> {
|
) -> Result<(axum::response::Response, uuid::Uuid), axum::http::Error> {
|
||||||
|
upload_test_songs_to_bucket().await;
|
||||||
match super::request::song_queue_req(&app).await {
|
match super::request::song_queue_req(&app).await {
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
let resp = super::util::get_resp_data::<
|
let resp = super::util::get_resp_data::<
|
||||||
@@ -637,8 +709,6 @@ mod tests {
|
|||||||
song
|
song
|
||||||
);
|
);
|
||||||
|
|
||||||
eprintln!("Song: {:?}", song);
|
|
||||||
|
|
||||||
match queue_coverart_flow(&app, &song_queue_id).await {
|
match queue_coverart_flow(&app, &song_queue_id).await {
|
||||||
Ok(response) => Ok((response, song_queue_id)),
|
Ok(response) => Ok((response, song_queue_id)),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@@ -777,6 +847,7 @@ mod tests {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let _ = db_mgr::drop_database(&tm_pool, &db_name).await;
|
let _ = db_mgr::drop_database(&tm_pool, &db_name).await;
|
||||||
|
sequence_flow::delete_test_songs_from_bucket().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|||||||
+16
-3
@@ -6,8 +6,8 @@ pub async fn insert(
|
|||||||
) -> Result<(time::OffsetDateTime, uuid::Uuid), sqlx::Error> {
|
) -> Result<(time::OffsetDateTime, uuid::Uuid), sqlx::Error> {
|
||||||
let result = sqlx::query(
|
let result = sqlx::query(
|
||||||
r#"
|
r#"
|
||||||
INSERT INTO "song" (title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, filename, directory, user_id)
|
INSERT INTO "song" (title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, filename, directory, file_key, user_id)
|
||||||
VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) RETURNING date_created, id;
|
VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16) RETURNING date_created, id;
|
||||||
"#
|
"#
|
||||||
)
|
)
|
||||||
.bind(&song.title)
|
.bind(&song.title)
|
||||||
@@ -24,6 +24,7 @@ pub async fn insert(
|
|||||||
.bind(&song.audio_type)
|
.bind(&song.audio_type)
|
||||||
.bind(&song.filename)
|
.bind(&song.filename)
|
||||||
.bind(&song.directory)
|
.bind(&song.directory)
|
||||||
|
.bind(&song.file_key)
|
||||||
.bind(song.user_id)
|
.bind(song.user_id)
|
||||||
.fetch_one(pool)
|
.fetch_one(pool)
|
||||||
.await
|
.await
|
||||||
@@ -133,6 +134,10 @@ pub async fn get_song(
|
|||||||
.try_get("directory")
|
.try_get("directory")
|
||||||
.map_err(|_e| sqlx::Error::RowNotFound)
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
|
file_key: row
|
||||||
|
.try_get("file_key")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
date_created: Some(date_created_time),
|
date_created: Some(date_created_time),
|
||||||
user_id: row
|
user_id: row
|
||||||
.try_get("user_id")
|
.try_get("user_id")
|
||||||
@@ -228,6 +233,10 @@ pub async fn get_all_songs(pool: &sqlx::PgPool) -> Result<Vec<simodels::song::So
|
|||||||
.try_get("directory")
|
.try_get("directory")
|
||||||
.map_err(|_e| sqlx::Error::RowNotFound)
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
|
file_key: row
|
||||||
|
.try_get("file_key")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
date_created: Some(date_created_time),
|
date_created: Some(date_created_time),
|
||||||
user_id: row
|
user_id: row
|
||||||
.try_get("user_id")
|
.try_get("user_id")
|
||||||
@@ -254,7 +263,7 @@ pub async fn delete_song(
|
|||||||
r#"
|
r#"
|
||||||
DELETE FROM "song"
|
DELETE FROM "song"
|
||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
RETURNING id, title, artist, album, album_artist, genre, year, disc, track, track_count, disc_count, duration, audio_type, date_created, filename, directory, user_id
|
RETURNING id, title, artist, album, album_artist, genre, year, disc, track, track_count, disc_count, duration, audio_type, date_created, filename, directory, file_key, user_id
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.bind(id)
|
.bind(id)
|
||||||
@@ -332,6 +341,10 @@ pub async fn delete_song(
|
|||||||
.try_get("directory")
|
.try_get("directory")
|
||||||
.map_err(|_e| sqlx::Error::RowNotFound)
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
|
file_key: row
|
||||||
|
.try_get("file_key")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
date_created: Some(date_created_time),
|
date_created: Some(date_created_time),
|
||||||
user_id: row
|
user_id: row
|
||||||
.try_get("user_id")
|
.try_get("user_id")
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ CREATE TABLE IF NOT EXISTS "song" (
|
|||||||
date_created timestamptz DEFAULT now(),
|
date_created timestamptz DEFAULT now(),
|
||||||
filename TEXT NOT NULL,
|
filename TEXT NOT NULL,
|
||||||
directory TEXT NOT NULL,
|
directory TEXT NOT NULL,
|
||||||
|
file_key TEXT NOT NULL,
|
||||||
user_id UUID NULL
|
user_id UUID NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
-- Add migration script here
|
-- Add migration script here
|
||||||
INSERT INTO "song" (id, title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, date_created, filename, directory, user_id) VALUES('44cf7940-34ff-489f-9124-d0ec90a55af9', 'Hypocrite Like The Rest', 'Kuoth', 'Kuoth', 'I', 'Alternative Hip-Hop', 2020, 1, 1, 9, 1, 139, 'flac', '2020-01-01 13:00:00-05', 'track01.flac', 'tests/I', '47491f9b-725a-4ba4-b9a5-711e1be46670');
|
INSERT INTO "song" (id, title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, date_created, filename, directory, file_key, user_id)
|
||||||
INSERT INTO "coverart" (id, title, directory, filename, file_type, song_id) VALUES('996122cd-5ae9-4013-9934-60768d3006ed', 'I', 'tests/I', 'Coverart-1.jpg', 'jpeg', '44cf7940-34ff-489f-9124-d0ec90a55af9');
|
VALUES('44cf7940-34ff-489f-9124-d0ec90a55af9', 'Hypocrite Like The Rest', 'Kuoth', 'Kuoth', 'I', 'Alternative Hip-Hop', 2020, 1, 1, 9, 1, 139, 'flac', '2020-01-01 13:00:00-05', 'track01.flac', 'tests/I', 'processed/song/track01.flac', '47491f9b-725a-4ba4-b9a5-711e1be46670');
|
||||||
|
|
||||||
INSERT INTO "song" (id, title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, date_created, filename, directory, user_id) VALUES('94cf7940-34ff-489f-9124-d0ec90a55af4', 'It''s Too Late', 'Kuoth', 'Kuoth', 'I', 'Alternative Hip-Hop', 2020, 2, 1, 9, 1, 116, 'flac', '2020-01-01 13:01:00-05', 'track02.flac', 'tests/I', '47491f9b-725a-4ba4-b9a5-711e1be46670');
|
INSERT INTO "coverart" (id, title, directory, filename, file_type, song_id)
|
||||||
INSERT INTO "coverart" (id, title, directory, filename, file_type, song_id) VALUES('d96122cd-5ae9-4013-9934-60768d3006e9', 'I', 'tests/I', 'Coverart-2.jpg', 'jpeg', '94cf7940-34ff-489f-9124-d0ec90a55af4');
|
VALUES('996122cd-5ae9-4013-9934-60768d3006ed', 'I', 'tests/I', 'Coverart-1.jpg', 'jpeg', '44cf7940-34ff-489f-9124-d0ec90a55af9');
|
||||||
|
|
||||||
|
INSERT INTO "song" (id, title, artist, album_artist, album, genre, year, track, disc, track_count, disc_count, duration, audio_type, date_created, filename, directory, file_key, user_id)
|
||||||
|
VALUES('94cf7940-34ff-489f-9124-d0ec90a55af4', 'It''s Too Late', 'Kuoth', 'Kuoth', 'I', 'Alternative Hip-Hop', 2020, 2, 1, 9, 1, 116, 'flac', '2020-01-01 13:01:00-05', 'track02.flac', 'tests/I', 'processed/song/track02.flac', '47491f9b-725a-4ba4-b9a5-711e1be46670');
|
||||||
|
INSERT INTO "coverart" (id, title, directory, filename, file_type, song_id)
|
||||||
|
VALUES('d96122cd-5ae9-4013-9934-60768d3006e9', 'I', 'tests/I', 'Coverart-2.jpg', 'jpeg', '94cf7940-34ff-489f-9124-d0ec90a55af4');
|
||||||
|
|||||||
Reference in New Issue
Block a user