mirror of
https://github.com/tsirysndr/music-player.git
synced 2026-01-08 20:58:07 -05:00
don't wrap database connection inside Mutex
This commit is contained in:
200
Cargo.lock
generated
200
Cargo.lock
generated
@@ -137,7 +137,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -270,7 +270,7 @@ dependencies = [
|
||||
"actix-router",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -281,7 +281,7 @@ checksum = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -508,7 +508,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -624,7 +624,7 @@ dependencies = [
|
||||
"proc-macro-crate 1.3.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
@@ -822,7 +822,7 @@ checksum = "25f9db3b38af870bf7e5cc649167533b493928e50744e2c30ae350230b414670"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -833,7 +833,7 @@ checksum = "e4655ae1a7b0cdf149156f780c5bf3f1352bc53cbd9e0a361a7ef7b22947e965"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -863,7 +863,7 @@ checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1012,7 +1012,7 @@ dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1094,7 +1094,7 @@ dependencies = [
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"shlex",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1200,7 +1200,7 @@ dependencies = [
|
||||
"borsh-schema-derive-internal",
|
||||
"proc-macro-crate 0.1.5",
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1211,7 +1211,7 @@ checksum = "186b734fa1c9f6743e90c95d7233c9faab6360d1a96d4ffa19d9cfd1e9350f8a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1222,7 +1222,7 @@ checksum = "99b7ff1008316626f485991b960ade129253d4034014616b94f309a15366cc49"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1280,7 +1280,7 @@ checksum = "13e576ebe98e605500b3c8041bb888e966653577172df6dd97398714eb30b9bf"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1509,7 +1509,7 @@ dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1947,7 +1947,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"smallvec",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1957,7 +1957,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1967,7 +1967,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2036,7 +2036,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"scratch",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2053,7 +2053,7 @@ checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2087,7 +2087,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2101,7 +2101,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2112,7 +2112,7 @@ checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835"
|
||||
dependencies = [
|
||||
"darling_core 0.13.4",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2123,7 +2123,7 @@ checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685"
|
||||
dependencies = [
|
||||
"darling_core 0.14.3",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2169,7 +2169,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustc_version 0.4.0",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2372,7 +2372,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
@@ -2411,7 +2411,7 @@ checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
@@ -2577,9 +2577,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.26"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84"
|
||||
checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
@@ -2592,9 +2592,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.26"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5"
|
||||
checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
@@ -2602,15 +2602,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.26"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
|
||||
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.26"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e"
|
||||
checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
@@ -2630,9 +2630,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.26"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531"
|
||||
checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
|
||||
|
||||
[[package]]
|
||||
name = "futures-lite"
|
||||
@@ -2651,26 +2651,26 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.26"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70"
|
||||
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.26"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364"
|
||||
checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.26"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366"
|
||||
checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
|
||||
|
||||
[[package]]
|
||||
name = "futures-timer"
|
||||
@@ -2684,9 +2684,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.26"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1"
|
||||
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
@@ -2904,7 +2904,7 @@ dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3044,7 +3044,7 @@ dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3202,7 +3202,7 @@ dependencies = [
|
||||
"markup5ever",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3975,7 +3975,7 @@ checksum = "3d0d19de3efdb768ecdccb6e904eb4c089ee9c1b59684d09218802e16cae8cc7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4583,6 +4583,7 @@ dependencies = [
|
||||
"async-graphql",
|
||||
"async-graphql-actix-web",
|
||||
"dirs",
|
||||
"futures",
|
||||
"futures-util",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
@@ -4786,7 +4787,7 @@ checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4860,7 +4861,7 @@ dependencies = [
|
||||
"proc-macro-crate 1.3.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5004,7 +5005,7 @@ dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5172,7 +5173,7 @@ dependencies = [
|
||||
"pest_meta",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5259,7 +5260,7 @@ dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5273,7 +5274,7 @@ dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5311,7 +5312,7 @@ checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5442,7 +5443,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e97e3215779627f01ee256d2fad52f3d95e8e1c11e9fc6fd08f7cd455d5d5c78"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5473,7 +5474,7 @@ dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
@@ -5496,9 +5497,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.51"
|
||||
version = "1.0.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
|
||||
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -5551,7 +5552,7 @@ dependencies = [
|
||||
"prost",
|
||||
"prost-types",
|
||||
"regex",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"tempfile",
|
||||
"which",
|
||||
]
|
||||
@@ -5566,7 +5567,7 @@ dependencies = [
|
||||
"itertools",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5672,7 +5673,7 @@ checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5698,9 +5699,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.23"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
|
||||
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -5943,7 +5944,7 @@ checksum = "ff26ed6c7c4dfc2aa9480b86a60e3c7233543a270a680e10758a507c5a4ce476"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5998,7 +5999,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rust-embed-utils",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
@@ -6297,7 +6298,7 @@ dependencies = [
|
||||
"heck 0.3.3",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6341,7 +6342,7 @@ dependencies = [
|
||||
"heck 0.3.3",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
@@ -6353,7 +6354,7 @@ checksum = "7d7f0cae2e7ebb2affc378c40bc343c8197181d601d6755c3e66f1bd18cac253"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6376,7 +6377,7 @@ dependencies = [
|
||||
"heck 0.3.3",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6398,7 +6399,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6515,7 +6516,7 @@ checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6557,7 +6558,7 @@ checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6591,7 +6592,7 @@ dependencies = [
|
||||
"darling 0.13.4",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6613,7 +6614,7 @@ checksum = "74064874e9f6a15f04c1f3cb627902d0e6b410abbf36668afa873c61889f1763"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6954,7 +6955,7 @@ dependencies = [
|
||||
"sha2 0.10.6",
|
||||
"sqlx-core",
|
||||
"sqlx-rt",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"url",
|
||||
]
|
||||
|
||||
@@ -7023,7 +7024,7 @@ dependencies = [
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7039,7 +7040,7 @@ dependencies = [
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sha1 0.6.1",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7109,7 +7110,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7343,6 +7344,17 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "0.1.2"
|
||||
@@ -7357,7 +7369,7 @@ checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
@@ -7408,7 +7420,7 @@ dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7653,7 +7665,7 @@ dependencies = [
|
||||
"heck 0.4.1",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"tauri-codegen",
|
||||
"tauri-utils",
|
||||
]
|
||||
@@ -7789,7 +7801,7 @@ checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7916,7 +7928,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"standback",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7972,7 +7984,7 @@ checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8102,7 +8114,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"prost-build",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8195,7 +8207,7 @@ checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8588,7 +8600,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@@ -8622,7 +8634,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
@@ -8757,7 +8769,7 @@ checksum = "eaebe196c01691db62e9e4ca52c5ef1e4fd837dcae27dae3ada599b5a8fd05ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8865,7 +8877,7 @@ version = "0.39.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba01f98f509cb5dc05f4e5fc95e535f78260f15fea8fe1a8abdd08f774f1cee7"
|
||||
dependencies = [
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
"windows-tokens",
|
||||
]
|
||||
|
||||
@@ -9114,7 +9126,7 @@ checksum = "6505e6815af7de1746a08f69c69606bb45695a17149517680f3b2149713b19a3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -27,7 +27,7 @@ pub async fn setup_new_params(
|
||||
Arc<Mutex<UnboundedSender<PlayerCommand>>>,
|
||||
Arc<Mutex<UnboundedReceiver<PlayerCommand>>>,
|
||||
Arc<Mutex<Tracklist>>,
|
||||
Arc<tokio::sync::Mutex<Database>>,
|
||||
Database,
|
||||
SocketAddr,
|
||||
String,
|
||||
) {
|
||||
@@ -50,7 +50,7 @@ pub async fn setup_new_params(
|
||||
let addr: SocketAddr = format!("0.0.0.0:{}", port).parse().unwrap();
|
||||
let url = format!("http://{}:{}", settings.host, port);
|
||||
|
||||
let db = Arc::new(tokio::sync::Mutex::new(Database::new().await));
|
||||
let db = Database::new().await;
|
||||
|
||||
return (
|
||||
backend,
|
||||
|
||||
@@ -37,7 +37,7 @@ async fn play() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -95,7 +95,7 @@ async fn pause() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -150,7 +150,7 @@ async fn stop() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -203,7 +203,7 @@ async fn next() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -256,7 +256,7 @@ async fn prev() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -310,7 +310,7 @@ async fn current() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
|
||||
@@ -39,7 +39,7 @@ async fn add() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -86,7 +86,7 @@ async fn list() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
|
||||
@@ -9,7 +9,7 @@ use music_player_storage::{
|
||||
searcher::Searcher,
|
||||
Database,
|
||||
};
|
||||
use music_player_types::types::{self, RemoteCoverUrl, RemoteTrackUrl};
|
||||
use music_player_types::types::{RemoteCoverUrl, RemoteTrackUrl};
|
||||
use sea_orm::{ActiveModelTrait, ActiveValue};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
@@ -56,9 +56,13 @@ impl LibraryQuery {
|
||||
.collect());
|
||||
}
|
||||
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let results = TrackRepository::new(db.lock().await.get_connection())
|
||||
.find_all(filter, 100)
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let results = TrackRepository::new(db.get_connection())
|
||||
.find_all(
|
||||
filter,
|
||||
Some(offset.unwrap_or(0) as u64),
|
||||
limit.unwrap_or(100) as u64,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(results.into_iter().map(Into::into).collect())
|
||||
@@ -99,10 +103,9 @@ impl LibraryQuery {
|
||||
.collect());
|
||||
}
|
||||
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
|
||||
let results = ArtistRepository::new(db.lock().await.get_connection())
|
||||
.find_all(filter)
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let results = ArtistRepository::new(db.get_connection())
|
||||
.find_all(filter, offset.map(|x| x as u64), limit.map(|x| x as u64))
|
||||
.await?;
|
||||
|
||||
Ok(results.into_iter().map(Into::into).collect())
|
||||
@@ -144,10 +147,9 @@ impl LibraryQuery {
|
||||
.collect());
|
||||
}
|
||||
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
|
||||
let results = AlbumRepository::new(db.lock().await.get_connection())
|
||||
.find_all(filter)
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let results = AlbumRepository::new(db.get_connection())
|
||||
.find_all(filter, offset.map(|x| x as u64), limit.map(|x| x as u64))
|
||||
.await?;
|
||||
|
||||
Ok(results.into_iter().map(Into::into).collect())
|
||||
@@ -175,11 +177,9 @@ impl LibraryQuery {
|
||||
.with_remote_cover_url(base_url.as_str()));
|
||||
}
|
||||
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
|
||||
let track = TrackRepository::new(db.lock().await.get_connection())
|
||||
.find(&id)
|
||||
.await?;
|
||||
let track = TrackRepository::new(db.get_connection()).find(&id).await?;
|
||||
|
||||
Ok(track.into())
|
||||
}
|
||||
@@ -207,11 +207,9 @@ impl LibraryQuery {
|
||||
.into());
|
||||
}
|
||||
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
|
||||
let artist = ArtistRepository::new(db.lock().await.get_connection())
|
||||
.find(&id)
|
||||
.await?;
|
||||
let artist = ArtistRepository::new(db.get_connection()).find(&id).await?;
|
||||
|
||||
Ok(artist.into())
|
||||
}
|
||||
@@ -239,19 +237,15 @@ impl LibraryQuery {
|
||||
.with_remote_track_url(base_url.as_str()));
|
||||
}
|
||||
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
|
||||
let album = AlbumRepository::new(db.lock().await.get_connection())
|
||||
.find(&id)
|
||||
.await?;
|
||||
let album = AlbumRepository::new(db.get_connection()).find(&id).await?;
|
||||
|
||||
Ok(album.into())
|
||||
}
|
||||
|
||||
async fn search(&self, ctx: &Context<'_>, keyword: String) -> Result<SearchResult, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let searcher = ctx.data::<Arc<Mutex<Searcher>>>().unwrap();
|
||||
let mut db = db.lock().await;
|
||||
let indexer = searcher.lock().await;
|
||||
let artists = indexer.artist.search(&keyword)?;
|
||||
let albums = indexer.album.search(&keyword)?;
|
||||
|
||||
@@ -4,9 +4,9 @@ use async_graphql::*;
|
||||
use cuid::cuid;
|
||||
use futures_util::Stream;
|
||||
use music_player_addons::CurrentSourceDevice;
|
||||
use music_player_entity::{folder as folder_entity,
|
||||
playlist as playlist_entity, playlist_tracks as playlist_tracks_entity, select_result,
|
||||
track as track_entity,
|
||||
use music_player_entity::{
|
||||
folder as folder_entity, playlist as playlist_entity,
|
||||
playlist_tracks as playlist_tracks_entity, select_result, track as track_entity,
|
||||
};
|
||||
use music_player_storage::{repo::playlist::PlaylistRepository, Database};
|
||||
use sea_orm::{
|
||||
@@ -28,8 +28,7 @@ pub struct PlaylistQuery;
|
||||
#[Object]
|
||||
impl PlaylistQuery {
|
||||
async fn playlist(&self, ctx: &Context<'_>, id: ID) -> Result<Playlist, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
|
||||
let current_device = ctx.data::<Arc<Mutex<CurrentSourceDevice>>>().unwrap();
|
||||
let mut device = current_device.lock().await;
|
||||
@@ -48,8 +47,7 @@ impl PlaylistQuery {
|
||||
}
|
||||
|
||||
async fn playlists(&self, ctx: &Context<'_>) -> Result<Vec<Playlist>, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
|
||||
let current_device = ctx.data::<Arc<Mutex<CurrentSourceDevice>>>().unwrap();
|
||||
let mut device = current_device.lock().await;
|
||||
@@ -68,8 +66,7 @@ impl PlaylistQuery {
|
||||
}
|
||||
|
||||
async fn main_playlists(&self, ctx: &Context<'_>) -> Result<Vec<Playlist>, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
PlaylistRepository::new(db.get_connection())
|
||||
.main_playlists()
|
||||
.await
|
||||
@@ -78,8 +75,7 @@ impl PlaylistQuery {
|
||||
}
|
||||
|
||||
async fn recent_playlists(&self, ctx: &Context<'_>) -> Result<Vec<Playlist>, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
PlaylistRepository::new(db.get_connection())
|
||||
.recent_playlists()
|
||||
.await
|
||||
@@ -88,8 +84,7 @@ impl PlaylistQuery {
|
||||
}
|
||||
|
||||
async fn folder(&self, ctx: &Context<'_>, id: ID) -> Result<Folder, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let results: Vec<(folder_entity::Model, Vec<playlist_entity::Model>)> =
|
||||
folder_entity::Entity::find_by_id(id.to_string())
|
||||
.find_with_related(playlist_entity::Entity)
|
||||
@@ -104,8 +99,7 @@ impl PlaylistQuery {
|
||||
}
|
||||
|
||||
async fn folders(&self, ctx: &Context<'_>) -> Result<Vec<Folder>, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
folder_entity::Entity::find()
|
||||
.order_by_asc(folder_entity::Column::Name)
|
||||
.all(db.get_connection())
|
||||
@@ -127,8 +121,7 @@ impl PlaylistMutation {
|
||||
description: Option<String>,
|
||||
folder_id: Option<ID>,
|
||||
) -> Result<Playlist, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let mut folder: Option<folder_entity::Model> = None;
|
||||
let folder_id = match folder_id {
|
||||
Some(folder_id) => {
|
||||
@@ -170,8 +163,7 @@ impl PlaylistMutation {
|
||||
}
|
||||
|
||||
async fn delete_playlist(&self, ctx: &Context<'_>, id: ID) -> Result<Playlist, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let playlist = playlist_entity::Entity::find_by_id(id.to_string())
|
||||
.one(db.get_connection())
|
||||
.await?;
|
||||
@@ -196,8 +188,7 @@ impl PlaylistMutation {
|
||||
id: ID,
|
||||
track_id: ID,
|
||||
) -> Result<Playlist, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let track = track_entity::Entity::find_by_id(track_id.to_string())
|
||||
.one(db.get_connection())
|
||||
.await?;
|
||||
@@ -238,8 +229,7 @@ impl PlaylistMutation {
|
||||
id: ID,
|
||||
position: usize,
|
||||
) -> Result<Playlist, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let playlist_track = playlist_tracks_entity::Entity::find()
|
||||
.filter(playlist_tracks_entity::Column::PlaylistId.eq(id.to_string()))
|
||||
.all(db.get_connection())
|
||||
@@ -270,8 +260,7 @@ impl PlaylistMutation {
|
||||
id: ID,
|
||||
name: String,
|
||||
) -> Result<Playlist, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let playlist = playlist_entity::Entity::find_by_id(id.to_string())
|
||||
.one(db.get_connection())
|
||||
.await?;
|
||||
@@ -294,8 +283,7 @@ impl PlaylistMutation {
|
||||
}
|
||||
|
||||
async fn create_folder(&self, ctx: &Context<'_>, name: String) -> Result<Folder, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let folder = folder_entity::ActiveModel {
|
||||
id: ActiveValue::set(cuid().unwrap()),
|
||||
name: ActiveValue::Set(name),
|
||||
@@ -315,8 +303,7 @@ impl PlaylistMutation {
|
||||
}
|
||||
|
||||
async fn delete_folder(&self, ctx: &Context<'_>, id: ID) -> Result<Folder, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let folder = folder_entity::Entity::find_by_id(id.to_string())
|
||||
.one(db.get_connection())
|
||||
.await?;
|
||||
@@ -340,8 +327,7 @@ impl PlaylistMutation {
|
||||
id: ID,
|
||||
name: String,
|
||||
) -> Result<Folder, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let folder = folder_entity::Entity::find_by_id(id.to_string())
|
||||
.one(db.get_connection())
|
||||
.await?;
|
||||
@@ -369,8 +355,7 @@ impl PlaylistMutation {
|
||||
id: ID,
|
||||
folder_id: ID,
|
||||
) -> Result<Folder, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let folder = folder_entity::Entity::find_by_id(folder_id.to_string())
|
||||
.one(db.get_connection())
|
||||
.await?;
|
||||
@@ -414,8 +399,7 @@ impl PlaylistMutation {
|
||||
ids: Vec<ID>,
|
||||
folder_id: ID,
|
||||
) -> Result<Folder, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
|
||||
let folder = folder_entity::Entity::find_by_id(folder_id.to_string())
|
||||
.one(db.get_connection())
|
||||
|
||||
@@ -92,7 +92,7 @@ impl TracklistMutation {
|
||||
let player_cmd = ctx
|
||||
.data::<Arc<std::sync::Mutex<UnboundedSender<PlayerCommand>>>>()
|
||||
.unwrap();
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let current_device = ctx.data::<Arc<Mutex<CurrentSourceDevice>>>().unwrap();
|
||||
let mut device = current_device.lock().await;
|
||||
|
||||
@@ -140,7 +140,7 @@ impl TracklistMutation {
|
||||
let result: Vec<(track_entity::Model, Vec<artist_entity::Model>)> =
|
||||
track_entity::Entity::find_by_id(id.clone())
|
||||
.find_with_related(artist_entity::Entity)
|
||||
.all(db.lock().await.get_connection())
|
||||
.all(db.get_connection())
|
||||
.await?;
|
||||
|
||||
if result.len() == 0 {
|
||||
@@ -153,7 +153,7 @@ impl TracklistMutation {
|
||||
let result: Vec<(track_entity::Model, Option<album_entity::Model>)> =
|
||||
track_entity::Entity::find_by_id(id.clone())
|
||||
.find_also_related(album_entity::Entity)
|
||||
.all(db.lock().await.get_connection())
|
||||
.all(db.get_connection())
|
||||
.await?;
|
||||
let (_, album) = result.into_iter().next().unwrap();
|
||||
track.album = album.unwrap();
|
||||
@@ -275,7 +275,7 @@ impl TracklistMutation {
|
||||
}
|
||||
|
||||
async fn play_next(&self, ctx: &Context<'_>, id: ID) -> Result<bool, Error> {
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let devices = ctx.data::<Arc<StdMutex<Vec<types::Device>>>>().unwrap();
|
||||
let devices = devices.lock().unwrap().clone();
|
||||
let current_device = ctx.data::<Arc<Mutex<CurrentSourceDevice>>>().unwrap();
|
||||
@@ -324,9 +324,7 @@ impl TracklistMutation {
|
||||
receiver.play_next(track.into()).await?;
|
||||
return Ok(true);
|
||||
} else {
|
||||
track = TrackRepository::new(db.lock().await.get_connection())
|
||||
.find(&id)
|
||||
.await?;
|
||||
track = TrackRepository::new(db.get_connection()).find(&id).await?;
|
||||
}
|
||||
|
||||
let current_device = ctx.data::<Arc<Mutex<CurrentReceiverDevice>>>().unwrap();
|
||||
@@ -365,7 +363,7 @@ impl TracklistMutation {
|
||||
let player_cmd = ctx
|
||||
.data::<Arc<StdMutex<UnboundedSender<PlayerCommand>>>>()
|
||||
.unwrap();
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let devices = ctx.data::<Arc<StdMutex<Vec<types::Device>>>>().unwrap();
|
||||
let devices = devices.lock().unwrap().clone();
|
||||
let current_device = ctx.data::<Arc<Mutex<CurrentSourceDevice>>>().unwrap();
|
||||
@@ -408,9 +406,7 @@ impl TracklistMutation {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
let mut result = AlbumRepository::new(db.lock().await.get_connection())
|
||||
.find(&id)
|
||||
.await?;
|
||||
let mut result = AlbumRepository::new(db.get_connection()).find(&id).await?;
|
||||
|
||||
let current_device = ctx.data::<Arc<Mutex<CurrentReceiverDevice>>>().unwrap();
|
||||
let mut device = current_device.lock().await;
|
||||
@@ -453,7 +449,7 @@ impl TracklistMutation {
|
||||
let player_cmd = ctx
|
||||
.data::<Arc<StdMutex<UnboundedSender<PlayerCommand>>>>()
|
||||
.unwrap();
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let devices = ctx.data::<Arc<StdMutex<Vec<types::Device>>>>().unwrap();
|
||||
let devices = devices.lock().unwrap().clone();
|
||||
let current_device = ctx.data::<Arc<Mutex<CurrentSourceDevice>>>().unwrap();
|
||||
@@ -492,9 +488,7 @@ impl TracklistMutation {
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
let mut artist = ArtistRepository::new(db.lock().await.get_connection())
|
||||
.find(&id)
|
||||
.await?;
|
||||
let mut artist = ArtistRepository::new(db.get_connection()).find(&id).await?;
|
||||
|
||||
let current_device = ctx.data::<Arc<Mutex<CurrentReceiverDevice>>>().unwrap();
|
||||
let mut device = current_device.lock().await;
|
||||
@@ -537,8 +531,7 @@ impl TracklistMutation {
|
||||
let player_cmd = ctx
|
||||
.data::<Arc<std::sync::Mutex<UnboundedSender<PlayerCommand>>>>()
|
||||
.unwrap();
|
||||
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
|
||||
let db = db.lock().await;
|
||||
let db = ctx.data::<Database>().unwrap();
|
||||
let devices = ctx.data::<Arc<StdMutex<Vec<types::Device>>>>().unwrap();
|
||||
let devices = devices.lock().unwrap().clone();
|
||||
let current_device = ctx.data::<Arc<Mutex<CurrentSourceDevice>>>().unwrap();
|
||||
|
||||
@@ -54,7 +54,7 @@ pub async fn setup_schema() -> (
|
||||
"sqlite:///tmp/music-player.sqlite3",
|
||||
);
|
||||
|
||||
let db = Arc::new(Mutex::new(Database::new().await));
|
||||
let db = Database::new().await;
|
||||
(
|
||||
Schema::build(
|
||||
Query::default(),
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import React, {FC} from 'react';
|
||||
import SearchResults from './SearchResults';
|
||||
import {useRecoilValue} from 'recoil';
|
||||
import {searchState} from '../SearchState';
|
||||
import {useNavigation} from '@react-navigation/native';
|
||||
|
||||
const SearchWithData: FC = () => {
|
||||
const navigation = useNavigation<any>();
|
||||
const props = useRecoilValue(searchState);
|
||||
const onPressAlbum = (album: any) => {
|
||||
navigation.navigate('AlbumDetails', {album});
|
||||
};
|
||||
const onPressArtist = (artist: any) => {
|
||||
navigation.navigate('ArtistDetails', {artist});
|
||||
};
|
||||
return (
|
||||
<SearchResults
|
||||
{...props}
|
||||
onPressAlbum={onPressAlbum}
|
||||
onPressArtist={onPressArtist}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default SearchWithData;
|
||||
@@ -12,11 +12,11 @@ use crate::api::music::v1alpha1::{
|
||||
use crate::api::objects::v1alpha1::Addon;
|
||||
|
||||
pub struct Addons {
|
||||
db: Arc<Mutex<Database>>,
|
||||
db: Database,
|
||||
}
|
||||
|
||||
impl Addons {
|
||||
pub fn new(db: Arc<Mutex<Database>>) -> Self {
|
||||
pub fn new(db: Database) -> Self {
|
||||
Self { db }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ use crate::api::music::v1alpha1::{
|
||||
};
|
||||
|
||||
pub struct History {
|
||||
db: Arc<Mutex<Database>>,
|
||||
db: Database,
|
||||
}
|
||||
|
||||
impl History {
|
||||
pub fn new(db: Arc<Mutex<Database>>) -> Self {
|
||||
pub fn new(db: Database) -> Self {
|
||||
Self { db }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ use music_player_storage::repo::track::TrackRepository;
|
||||
use music_player_storage::Database;
|
||||
use music_player_storage::{repo::album::AlbumRepository, searcher::Searcher};
|
||||
use sea_orm::ActiveModelTrait;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
use crate::api::music::v1alpha1::{
|
||||
library_service_server::LibraryService, GetAlbumDetailsRequest, GetAlbumDetailsResponse,
|
||||
@@ -17,11 +15,11 @@ use crate::api::music::v1alpha1::{
|
||||
};
|
||||
|
||||
pub struct Library {
|
||||
db: Arc<Mutex<Database>>,
|
||||
db: Database,
|
||||
}
|
||||
|
||||
impl Library {
|
||||
pub fn new(db: Arc<Mutex<Database>>) -> Self {
|
||||
pub fn new(db: Database) -> Self {
|
||||
Self { db }
|
||||
}
|
||||
}
|
||||
@@ -89,8 +87,10 @@ impl LibraryService for Library {
|
||||
"" => None,
|
||||
_ => Some(request.filter),
|
||||
};
|
||||
let results = ArtistRepository::new(&self.db.lock().await.get_connection())
|
||||
.find_all(filter)
|
||||
let offset = request.offset;
|
||||
let limit = request.limit;
|
||||
let results = ArtistRepository::new(&self.db.get_connection())
|
||||
.find_all(filter, Some(offset as u64), Some(limit as u64))
|
||||
.await
|
||||
.map_err(|e| tonic::Status::internal(e.to_string()))?;
|
||||
|
||||
@@ -109,8 +109,10 @@ impl LibraryService for Library {
|
||||
"" => None,
|
||||
_ => Some(request.filter),
|
||||
};
|
||||
let results = AlbumRepository::new(&self.db.lock().await.get_connection())
|
||||
.find_all(filter)
|
||||
let offset = request.offset;
|
||||
let limit = request.limit;
|
||||
let results = AlbumRepository::new(&self.db.get_connection())
|
||||
.find_all(filter, Some(offset as u64), Some(limit as u64))
|
||||
.await
|
||||
.map_err(|e| tonic::Status::internal(e.to_string()))?;
|
||||
|
||||
@@ -129,8 +131,13 @@ impl LibraryService for Library {
|
||||
"" => None,
|
||||
_ => Some(request.filter),
|
||||
};
|
||||
let tracks = TrackRepository::new(&self.db.lock().await.get_connection())
|
||||
.find_all(filter, 100)
|
||||
let offset = request.offset;
|
||||
let limit = match request.limit {
|
||||
0 => 100,
|
||||
_ => request.limit,
|
||||
};
|
||||
let tracks = TrackRepository::new(&self.db.get_connection())
|
||||
.find_all(filter, Some(offset as u64), limit as u64)
|
||||
.await
|
||||
.map_err(|e| tonic::Status::internal(e.to_string()))?;
|
||||
|
||||
@@ -146,7 +153,7 @@ impl LibraryService for Library {
|
||||
) -> Result<tonic::Response<GetTrackDetailsResponse>, tonic::Status> {
|
||||
let id = request.into_inner().id;
|
||||
|
||||
let track = TrackRepository::new(&self.db.lock().await.get_connection())
|
||||
let track = TrackRepository::new(&self.db.get_connection())
|
||||
.find(&id)
|
||||
.await
|
||||
.map_err(|e| tonic::Status::internal(e.to_string()))?;
|
||||
@@ -161,7 +168,7 @@ impl LibraryService for Library {
|
||||
request: tonic::Request<GetAlbumDetailsRequest>,
|
||||
) -> Result<tonic::Response<GetAlbumDetailsResponse>, tonic::Status> {
|
||||
let id = request.into_inner().id;
|
||||
let album = AlbumRepository::new(&self.db.lock().await.get_connection())
|
||||
let album = AlbumRepository::new(&self.db.get_connection())
|
||||
.find(&id)
|
||||
.await
|
||||
.map_err(|e| tonic::Status::internal(e.to_string()))?;
|
||||
@@ -177,7 +184,7 @@ impl LibraryService for Library {
|
||||
) -> Result<tonic::Response<GetArtistDetailsResponse>, tonic::Status> {
|
||||
let id = request.into_inner().id;
|
||||
|
||||
let artist = ArtistRepository::new(&self.db.lock().await.get_connection())
|
||||
let artist = ArtistRepository::new(&self.db.get_connection())
|
||||
.find(&id)
|
||||
.await
|
||||
.map_err(|e| tonic::Status::internal(e.to_string()))?;
|
||||
|
||||
@@ -29,7 +29,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let (cmd_tx, cmd_rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
let cmd_tx = Arc::new(std::sync::Mutex::new(cmd_tx));
|
||||
let cmd_rx = Arc::new(std::sync::Mutex::new(cmd_rx));
|
||||
let db = Arc::new(Mutex::new(Database::new().await));
|
||||
let db = Database::new().await;
|
||||
|
||||
let (_, _) = Player::new(
|
||||
move || backend(None, audio_format),
|
||||
|
||||
@@ -22,11 +22,11 @@ use crate::api::{
|
||||
};
|
||||
|
||||
pub struct Playlist {
|
||||
db: Arc<Mutex<Database>>,
|
||||
db: Database,
|
||||
}
|
||||
|
||||
impl Playlist {
|
||||
pub fn new(db: Arc<Mutex<Database>>) -> Self {
|
||||
pub fn new(db: Database) -> Self {
|
||||
Self { db }
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ impl PlaylistService for Playlist {
|
||||
name: ActiveValue::set(request.get_ref().name.clone()),
|
||||
..Default::default()
|
||||
};
|
||||
match item.insert(self.db.lock().await.get_connection()).await {
|
||||
match item.insert(self.db.get_connection()).await {
|
||||
Ok(saved) => {
|
||||
for track in request.get_ref().tracks.iter() {
|
||||
let item = playlist_tracks::ActiveModel {
|
||||
@@ -51,7 +51,7 @@ impl PlaylistService for Playlist {
|
||||
track_id: ActiveValue::set(track.id.clone()),
|
||||
created_at: ActiveValue::set(chrono::Utc::now()),
|
||||
};
|
||||
match item.insert(self.db.lock().await.get_connection()).await {
|
||||
match item.insert(self.db.get_connection()).await {
|
||||
Ok(_) => (),
|
||||
Err(_) => (),
|
||||
}
|
||||
@@ -72,7 +72,7 @@ impl PlaylistService for Playlist {
|
||||
request: tonic::Request<DeleteRequest>,
|
||||
) -> Result<tonic::Response<DeleteResponse>, tonic::Status> {
|
||||
playlist::Entity::delete_by_id(request.get_ref().id.clone())
|
||||
.exec(self.db.lock().await.get_connection())
|
||||
.exec(self.db.get_connection())
|
||||
.await
|
||||
.map(|_| {
|
||||
tonic::Response::new(DeleteResponse {
|
||||
@@ -88,7 +88,7 @@ impl PlaylistService for Playlist {
|
||||
request: tonic::Request<GetItemsRequest>,
|
||||
) -> Result<tonic::Response<GetItemsResponse>, tonic::Status> {
|
||||
let result = playlist::Entity::find_by_id(request.get_ref().id.clone())
|
||||
.one(self.db.lock().await.get_connection())
|
||||
.one(self.db.get_connection())
|
||||
.await;
|
||||
match result {
|
||||
Ok(playlist) => {
|
||||
@@ -99,7 +99,7 @@ impl PlaylistService for Playlist {
|
||||
.clone()
|
||||
.unwrap()
|
||||
.find_related(track::Entity)
|
||||
.all(self.db.lock().await.get_connection())
|
||||
.all(self.db.get_connection())
|
||||
.await
|
||||
.map(|tracks| {
|
||||
tonic::Response::new(GetItemsResponse {
|
||||
@@ -136,7 +136,7 @@ impl PlaylistService for Playlist {
|
||||
};
|
||||
playlist::Entity::update(updates)
|
||||
.filter(playlist::Column::Id.eq("test"))
|
||||
.exec(self.db.lock().await.get_connection())
|
||||
.exec(self.db.get_connection())
|
||||
.await
|
||||
.map(|updated| {
|
||||
tonic::Response::new(RenameResponse {
|
||||
@@ -158,7 +158,7 @@ impl PlaylistService for Playlist {
|
||||
.eq(request.get_ref().id.clone())
|
||||
.and(playlist_tracks::Column::TrackId.eq(request.get_ref().track_id.clone())),
|
||||
)
|
||||
.one(self.db.lock().await.get_connection())
|
||||
.one(self.db.get_connection())
|
||||
.await;
|
||||
if item.is_err() {
|
||||
return Err(tonic::Status::internal(
|
||||
@@ -169,7 +169,7 @@ impl PlaylistService for Playlist {
|
||||
id: Set(item.unwrap().unwrap().id),
|
||||
..Default::default()
|
||||
})
|
||||
.exec(self.db.lock().await.get_connection())
|
||||
.exec(self.db.get_connection())
|
||||
.await
|
||||
.map(|_| {
|
||||
tonic::Response::new(RemoveItemResponse {
|
||||
@@ -190,7 +190,7 @@ impl PlaylistService for Playlist {
|
||||
track_id: ActiveValue::set(request.get_ref().track_id.clone()),
|
||||
created_at: ActiveValue::set(chrono::Utc::now()),
|
||||
};
|
||||
match item.insert(self.db.lock().await.get_connection()).await {
|
||||
match item.insert(self.db.get_connection()).await {
|
||||
Ok(saved) => Ok(tonic::Response::new(AddItemResponse {
|
||||
id: saved.id,
|
||||
..Default::default()
|
||||
@@ -203,7 +203,7 @@ impl PlaylistService for Playlist {
|
||||
&self,
|
||||
_request: tonic::Request<FindAllRequest>,
|
||||
) -> Result<tonic::Response<FindAllResponse>, tonic::Status> {
|
||||
let result = PlaylistRepository::new(self.db.lock().await.get_connection())
|
||||
let result = PlaylistRepository::new(self.db.get_connection())
|
||||
.find_all()
|
||||
.await
|
||||
.map_err(|_| tonic::Status::internal("Failed to get playlist"))?;
|
||||
@@ -216,7 +216,7 @@ impl PlaylistService for Playlist {
|
||||
&self,
|
||||
request: tonic::Request<GetPlaylistDetailsRequest>,
|
||||
) -> Result<tonic::Response<GetPlaylistDetailsResponse>, tonic::Status> {
|
||||
let result = PlaylistRepository::new(self.db.lock().await.get_connection())
|
||||
let result = PlaylistRepository::new(self.db.get_connection())
|
||||
.find(&request.get_ref().id)
|
||||
.await
|
||||
.map_err(|_| tonic::Status::internal("Failed to get playlist"))?;
|
||||
|
||||
@@ -43,7 +43,7 @@ type Tx = UnboundedSender<Message>;
|
||||
type PeerMap = Arc<sync::Mutex<HashMap<SocketAddr, Tx>>>;
|
||||
|
||||
pub struct MusicPlayerServer {
|
||||
db: Arc<Mutex<Database>>,
|
||||
db: Database,
|
||||
tracklist: Arc<std::sync::Mutex<TracklistState>>,
|
||||
cmd_tx: Arc<std::sync::Mutex<TokioUnboundedSender<PlayerCommand>>>,
|
||||
peer_map: PeerMap,
|
||||
@@ -54,7 +54,7 @@ impl MusicPlayerServer {
|
||||
tracklist: Arc<std::sync::Mutex<TracklistState>>,
|
||||
cmd_tx: Arc<std::sync::Mutex<TokioUnboundedSender<PlayerCommand>>>,
|
||||
peer_map: PeerMap,
|
||||
db: Arc<Mutex<Database>>,
|
||||
db: Database,
|
||||
) -> Self {
|
||||
Self {
|
||||
db,
|
||||
@@ -76,27 +76,27 @@ impl MusicPlayerServer {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.add_service(tonic_web::enable(AddonsServiceServer::new(Addons::new(
|
||||
Arc::clone(&self.db),
|
||||
self.db.clone(),
|
||||
))))
|
||||
.add_service(tonic_web::enable(CoreServiceServer::new(Core::default())))
|
||||
.add_service(tonic_web::enable(HistoryServiceServer::new(History::new(
|
||||
Arc::clone(&self.db),
|
||||
self.db.clone(),
|
||||
))))
|
||||
.add_service(tonic_web::enable(LibraryServiceServer::new(Library::new(
|
||||
Arc::clone(&self.db),
|
||||
self.db.clone(),
|
||||
))))
|
||||
.add_service(tonic_web::enable(MixerServiceServer::new(Mixer::default())))
|
||||
.add_service(tonic_web::enable(PlaybackServiceServer::new(
|
||||
Playback::new(Arc::clone(&self.tracklist), Arc::clone(&self.cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(PlaylistServiceServer::new(
|
||||
Playlist::new(Arc::clone(&self.db)),
|
||||
Playlist::new(self.db.clone()),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(
|
||||
Arc::clone(&self.tracklist),
|
||||
Arc::clone(&self.cmd_tx),
|
||||
Arc::clone(&self.db),
|
||||
self.db.clone(),
|
||||
),
|
||||
)))
|
||||
.serve(addr)
|
||||
@@ -121,27 +121,27 @@ impl MusicPlayerServer {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.add_service(tonic_web::enable(AddonsServiceServer::new(Addons::new(
|
||||
Arc::clone(&self.db),
|
||||
self.db.clone(),
|
||||
))))
|
||||
.add_service(tonic_web::enable(CoreServiceServer::new(Core::default())))
|
||||
.add_service(tonic_web::enable(HistoryServiceServer::new(History::new(
|
||||
Arc::clone(&self.db),
|
||||
self.db.clone(),
|
||||
))))
|
||||
.add_service(tonic_web::enable(LibraryServiceServer::new(Library::new(
|
||||
Arc::clone(&self.db),
|
||||
self.db.clone(),
|
||||
))))
|
||||
.add_service(tonic_web::enable(MixerServiceServer::new(Mixer::default())))
|
||||
.add_service(tonic_web::enable(PlaybackServiceServer::new(
|
||||
Playback::new(Arc::clone(&self.tracklist), Arc::clone(&self.cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(PlaylistServiceServer::new(
|
||||
Playlist::new(Arc::clone(&self.db)),
|
||||
Playlist::new(self.db.clone()),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(
|
||||
Arc::clone(&self.tracklist),
|
||||
Arc::clone(&self.cmd_tx),
|
||||
Arc::clone(&self.db),
|
||||
self.db.clone(),
|
||||
),
|
||||
)))
|
||||
.serve_with_incoming(UnixListenerStream::new(listener))
|
||||
|
||||
@@ -24,7 +24,7 @@ async fn scan() {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.add_service(tonic_web::enable(LibraryServiceServer::new(Library::new(
|
||||
Arc::clone(&db),
|
||||
db,
|
||||
))))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -49,7 +49,7 @@ async fn search() {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.add_service(tonic_web::enable(LibraryServiceServer::new(Library::new(
|
||||
Arc::clone(&db),
|
||||
db,
|
||||
))))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -71,7 +71,7 @@ async fn get_artists() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.add_service(tonic_web::enable(LibraryServiceServer::new(Library::new(
|
||||
Arc::clone(&db),
|
||||
db,
|
||||
))))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -107,7 +107,7 @@ async fn get_albums() {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.add_service(tonic_web::enable(LibraryServiceServer::new(Library::new(
|
||||
Arc::clone(&db),
|
||||
db,
|
||||
))))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -139,7 +139,7 @@ async fn get_tracks() {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.add_service(tonic_web::enable(LibraryServiceServer::new(Library::new(
|
||||
Arc::clone(&db),
|
||||
db,
|
||||
))))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -189,7 +189,7 @@ async fn get_track_details() {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.add_service(tonic_web::enable(LibraryServiceServer::new(Library::new(
|
||||
Arc::clone(&db),
|
||||
db,
|
||||
))))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -226,7 +226,7 @@ async fn get_album_details() {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.add_service(tonic_web::enable(LibraryServiceServer::new(Library::new(
|
||||
Arc::clone(&db),
|
||||
db,
|
||||
))))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -262,7 +262,7 @@ async fn get_artist_details() {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.add_service(tonic_web::enable(LibraryServiceServer::new(Library::new(
|
||||
Arc::clone(&db),
|
||||
db,
|
||||
))))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
|
||||
@@ -27,7 +27,7 @@ pub async fn setup_new_params(
|
||||
Arc<Mutex<UnboundedSender<PlayerCommand>>>,
|
||||
Arc<Mutex<UnboundedReceiver<PlayerCommand>>>,
|
||||
Arc<Mutex<Tracklist>>,
|
||||
Arc<tokio::sync::Mutex<Database>>,
|
||||
Database,
|
||||
SocketAddr,
|
||||
String,
|
||||
) {
|
||||
@@ -50,7 +50,7 @@ pub async fn setup_new_params(
|
||||
let addr: SocketAddr = format!("0.0.0.0:{}", port).parse().unwrap();
|
||||
let url = format!("http://{}:{}", settings.host, port);
|
||||
|
||||
let db = Arc::new(tokio::sync::Mutex::new(Database::new().await));
|
||||
let db = Database::new().await;
|
||||
|
||||
return (
|
||||
backend,
|
||||
|
||||
@@ -79,7 +79,7 @@ async fn next() {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -153,7 +153,7 @@ async fn previous() {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -233,7 +233,7 @@ async fn play() {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
@@ -316,7 +316,7 @@ async fn pause() {
|
||||
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
|
||||
)))
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
|
||||
@@ -35,7 +35,7 @@ async fn get_tracklist_tracks() {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.add_service(tonic_web::enable(TracklistServiceServer::new(
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
|
||||
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
|
||||
)))
|
||||
.serve_with_shutdown(addr, rx.map(drop))
|
||||
.await
|
||||
|
||||
@@ -25,14 +25,14 @@ use crate::api::{
|
||||
pub struct Tracklist {
|
||||
state: Arc<std::sync::Mutex<TracklistState>>,
|
||||
cmd_tx: Arc<std::sync::Mutex<UnboundedSender<PlayerCommand>>>,
|
||||
db: Arc<Mutex<Database>>,
|
||||
db: Database,
|
||||
}
|
||||
|
||||
impl Tracklist {
|
||||
pub fn new(
|
||||
state: Arc<std::sync::Mutex<TracklistState>>,
|
||||
cmd_tx: Arc<std::sync::Mutex<UnboundedSender<PlayerCommand>>>,
|
||||
db: Arc<Mutex<Database>>,
|
||||
db: Database,
|
||||
) -> Self {
|
||||
Self { state, cmd_tx, db }
|
||||
}
|
||||
@@ -49,7 +49,7 @@ impl TracklistService for Tracklist {
|
||||
|
||||
let result: Vec<(track::Model, Vec<artist::Model>)> = track::Entity::find_by_id(id.clone())
|
||||
.find_with_related(artist::Entity)
|
||||
.all(self.db.lock().await.get_connection())
|
||||
.all(self.db.get_connection())
|
||||
.await
|
||||
.map_err(|e| tonic::Status::internal(e.to_string()))?;
|
||||
if result.len() == 0 {
|
||||
@@ -62,7 +62,7 @@ impl TracklistService for Tracklist {
|
||||
let result: Vec<(track::Model, Option<album::Model>)> =
|
||||
track::Entity::find_by_id(id.clone())
|
||||
.find_also_related(album::Entity)
|
||||
.all(self.db.lock().await.get_connection())
|
||||
.all(self.db.get_connection())
|
||||
.await
|
||||
.map_err(|e| tonic::Status::internal(e.to_string()))?;
|
||||
let (_, album) = result.into_iter().next().unwrap();
|
||||
|
||||
10
src/main.rs
10
src/main.rs
@@ -202,9 +202,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
db.create_indexes().await;
|
||||
}
|
||||
|
||||
let db_conn = Database::new().await;
|
||||
let searcher = Searcher::new();
|
||||
let db = Arc::new(Mutex::new(Database::new().await));
|
||||
let db = Database::new().await;
|
||||
let tracklist = Arc::new(std::sync::Mutex::new(Tracklist::new_empty()));
|
||||
let (cmd_tx, cmd_rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
let cloned_tracklist = Arc::clone(&tracklist);
|
||||
@@ -290,13 +289,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
runtime.block_on(auto_scan_music_library(db_conn, searcher));
|
||||
let db = runtime.block_on(Database::new());
|
||||
runtime.block_on(auto_scan_music_library(db, searcher));
|
||||
});
|
||||
}
|
||||
|
||||
let tracklist_ws = Arc::clone(&tracklist);
|
||||
let tracklist_webui = Arc::clone(&tracklist);
|
||||
let db_ws = Arc::clone(&db);
|
||||
|
||||
let peer_map_ws = Arc::clone(&peer_map);
|
||||
|
||||
@@ -329,8 +328,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
let db = runtime.block_on(Database::new());
|
||||
match runtime.block_on(
|
||||
MusicPlayerServer::new(tracklist_ws, cmd_tx_ws, peer_map_ws, db_ws).start_ws(),
|
||||
MusicPlayerServer::new(tracklist_ws, cmd_tx_ws, peer_map_ws, db).start_ws(),
|
||||
) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
|
||||
@@ -72,3 +72,4 @@ actix-cors = "0.6.3"
|
||||
sea-orm = { version = "0.9.3", features = ["runtime-tokio-rustls", "sqlx-sqlite"] }
|
||||
futures-util = "0.3.25"
|
||||
mime = "0.3.16"
|
||||
futures = "0.3.28"
|
||||
|
||||
@@ -132,7 +132,7 @@ async fn main() {
|
||||
Arc::clone(&cmd_rx),
|
||||
tracklist.clone(),
|
||||
);
|
||||
let db = Arc::new(Mutex::new(Database::new().await));
|
||||
let db = Database::new().await;
|
||||
let schema: MusicPlayerSchema = Schema::build(
|
||||
Query::default(),
|
||||
Mutation::default(),
|
||||
|
||||
@@ -53,7 +53,7 @@ async fn index_spa() -> impl Responder {
|
||||
handle_embedded_file("index.html")
|
||||
}
|
||||
|
||||
async fn index_file(db: Data<Arc<Mutex<Database>>>, req: HttpRequest) -> Result<NamedFile, Error> {
|
||||
async fn index_file(db: Data<Database>, req: HttpRequest) -> Result<NamedFile, Error> {
|
||||
let id = req.match_info().get("id").unwrap();
|
||||
let id = id.split('.').next().unwrap();
|
||||
let mut path = PathBuf::new();
|
||||
@@ -61,7 +61,7 @@ async fn index_file(db: Data<Arc<Mutex<Database>>>, req: HttpRequest) -> Result<
|
||||
println!("id: {}", id);
|
||||
|
||||
let track = track_entity::Entity::find_by_id(id.to_owned())
|
||||
.one(db.lock().await.get_connection())
|
||||
.one(db.get_connection())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -144,7 +144,7 @@ pub async fn start_webui(
|
||||
Mutation::default(),
|
||||
Subscription::default(),
|
||||
)
|
||||
.data(Arc::new(Mutex::new(Database::new().await)))
|
||||
.data(Database::new().await)
|
||||
.data(cmd_tx)
|
||||
.data(tracklist)
|
||||
.data(devices)
|
||||
@@ -155,14 +155,12 @@ pub async fn start_webui(
|
||||
.finish();
|
||||
println!("Starting webui at {}", addr.bright_green());
|
||||
|
||||
let db = Arc::new(Mutex::new(Database::new().await));
|
||||
|
||||
HttpServer::new(move || {
|
||||
let cors = Cors::permissive();
|
||||
|
||||
let db = futures::executor::block_on(Database::new());
|
||||
let covers_path = format!("{}/covers", get_application_directory());
|
||||
App::new()
|
||||
.app_data(Data::new(Arc::clone(&db)))
|
||||
.app_data(Data::new(db.clone()))
|
||||
.app_data(Data::new(schema.clone()))
|
||||
.wrap(cors)
|
||||
.service(index_graphql)
|
||||
|
||||
@@ -21,7 +21,7 @@ async fn main() -> std::io::Result<()> {
|
||||
let cloned_tracklist = tracklist.clone();
|
||||
let cloned_cmd_tx = Arc::clone(&cmd_tx);
|
||||
let cloned_cmd_rx = Arc::clone(&cmd_rx);
|
||||
let db = Arc::new(Mutex::new(Database::new().await));
|
||||
let db = Database::new().await;
|
||||
let (_, _) = Player::new(
|
||||
move || backend(None, audio_format),
|
||||
move |_| {},
|
||||
|
||||
Reference in New Issue
Block a user