Update the music player's dependencies

This commit is contained in:
Savanni D'Gerinel 2024-06-02 11:31:33 -04:00
parent 15c4ae9bad
commit c004cdc600
11 changed files with 726 additions and 544 deletions

326
Cargo.lock generated
View File

@ -290,16 +290,6 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "atomic-write-file"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edcdbedc2236483ab103a53415653d6b4442ea6141baf1ffa85df29635e88436"
dependencies = [
"nix",
"rand 0.8.5",
]
[[package]]
name = "authdb"
version = "0.1.0"
@ -466,7 +456,7 @@ checksum = "f33613627f0dea6a731b0605101fad59ba4f193a52c96c4687728d822605a8a1"
dependencies = [
"bitflags 2.4.1",
"cairo-sys-rs",
"glib",
"glib 0.18.4",
"libc",
"once_cell",
"thiserror",
@ -478,7 +468,7 @@ version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51"
dependencies = [
"glib-sys",
"glib-sys 0.18.1",
"libc",
"system-deps",
]
@ -789,7 +779,7 @@ version = "0.1.0"
dependencies = [
"cairo-rs",
"gio",
"glib",
"glib 0.18.4",
"gtk4",
]
@ -805,7 +795,7 @@ dependencies = [
"gdk4",
"geo-types",
"gio",
"glib",
"glib 0.18.4",
"glib-build-tools 0.18.0",
"gtk4",
"ifc",
@ -1025,6 +1015,18 @@ dependencies = [
"zune-inflate",
]
[[package]]
name = "fallible-iterator"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
[[package]]
name = "fallible-streaming-iterator"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
[[package]]
name = "fastrand"
version = "1.9.0"
@ -1109,7 +1111,7 @@ dependencies = [
"ft-core",
"gdk4",
"gio",
"glib",
"glib 0.18.4",
"glib-build-tools 0.18.0",
"gtk4",
"libadwaita",
@ -1377,7 +1379,7 @@ checksum = "446f32b74d22c33b7b258d4af4ffde53c2bf96ca2e29abdf1a785fe59bd6c82c"
dependencies = [
"gdk-pixbuf-sys",
"gio",
"glib",
"glib 0.18.4",
"libc",
"once_cell",
]
@ -1388,9 +1390,9 @@ version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7"
dependencies = [
"gio-sys",
"glib-sys",
"gobject-sys",
"gio-sys 0.18.1",
"glib-sys 0.18.1",
"gobject-sys 0.18.0",
"libc",
"system-deps",
]
@ -1405,7 +1407,7 @@ dependencies = [
"gdk-pixbuf",
"gdk4-sys",
"gio",
"glib",
"glib 0.18.4",
"libc",
"pango",
]
@ -1418,9 +1420,9 @@ checksum = "dbab43f332a3cf1df9974da690b5bb0e26720ed09a228178ce52175372dcfef0"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"gio-sys 0.18.1",
"glib-sys 0.18.1",
"gobject-sys 0.18.0",
"libc",
"pango-sys",
"pkg-config",
@ -1497,8 +1499,8 @@ dependencies = [
"futures-core",
"futures-io",
"futures-util",
"gio-sys",
"glib",
"gio-sys 0.18.1",
"glib 0.18.4",
"libc",
"once_cell",
"pin-project-lite",
@ -1506,19 +1508,54 @@ dependencies = [
"thiserror",
]
[[package]]
name = "gio-sys"
version = "0.16.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9b693b8e39d042a95547fc258a7b07349b1f0b48f4b2fa3108ba3c51c0b5229"
dependencies = [
"glib-sys 0.16.3",
"gobject-sys 0.16.3",
"libc",
"system-deps",
"winapi",
]
[[package]]
name = "gio-sys"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2"
dependencies = [
"glib-sys",
"gobject-sys",
"glib-sys 0.18.1",
"gobject-sys 0.18.0",
"libc",
"system-deps",
"winapi",
]
[[package]]
name = "glib"
version = "0.16.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16aa2475c9debed5a32832cb5ff2af5a3f9e1ab9e69df58eaadc1ab2004d6eba"
dependencies = [
"bitflags 1.3.2",
"futures-channel",
"futures-core",
"futures-executor",
"futures-task",
"futures-util",
"gio-sys 0.16.3",
"glib-macros 0.16.8",
"glib-sys 0.16.3",
"gobject-sys 0.16.3",
"libc",
"once_cell",
"smallvec",
"thiserror",
]
[[package]]
name = "glib"
version = "0.18.4"
@ -1531,10 +1568,10 @@ dependencies = [
"futures-executor",
"futures-task",
"futures-util",
"gio-sys",
"glib-macros",
"glib-sys",
"gobject-sys",
"gio-sys 0.18.1",
"glib-macros 0.18.3",
"glib-sys 0.18.1",
"gobject-sys 0.18.0",
"libc",
"memchr",
"once_cell",
@ -1560,6 +1597,21 @@ version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3431c56f463443cba9bc3600248bc6d680cb614c2ee1cdd39dab5415bd12ac5c"
[[package]]
name = "glib-macros"
version = "0.16.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb1a9325847aa46f1e96ffea37611b9d51fc4827e67f79e7de502a297560a67b"
dependencies = [
"anyhow",
"heck",
"proc-macro-crate 1.3.1",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "glib-macros"
version = "0.18.3"
@ -1574,6 +1626,16 @@ dependencies = [
"syn 2.0.48",
]
[[package]]
name = "glib-sys"
version = "0.16.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61a4f46316d06bfa33a7ac22df6f0524c8be58e3db2d9ca99ccb1f357b62a65"
dependencies = [
"libc",
"system-deps",
]
[[package]]
name = "glib-sys"
version = "0.18.1"
@ -1605,7 +1667,7 @@ dependencies = [
"futures",
"gdk4",
"gio",
"glib",
"glib 0.18.4",
"glib-build-tools 0.16.3",
"gtk4",
"libadwaita",
@ -1614,13 +1676,24 @@ dependencies = [
"tokio",
]
[[package]]
name = "gobject-sys"
version = "0.16.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3520bb9c07ae2a12c7f2fbb24d4efc11231c8146a86956413fb1a79bb760a0f1"
dependencies = [
"glib-sys 0.16.3",
"libc",
"system-deps",
]
[[package]]
name = "gobject-sys"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44"
dependencies = [
"glib-sys",
"glib-sys 0.18.1",
"libc",
"system-deps",
]
@ -1631,7 +1704,7 @@ version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b2228cda1505613a7a956cca69076892cfbda84fc2b7a62b94a41a272c0c401"
dependencies = [
"glib",
"glib 0.18.4",
"graphene-sys",
"libc",
]
@ -1642,7 +1715,7 @@ version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc4144cee8fc8788f2a9b73dc5f1d4e1189d1f95305c4cb7bd9c1af1cfa31f59"
dependencies = [
"glib-sys",
"glib-sys 0.18.1",
"libc",
"pkg-config",
"system-deps",
@ -1665,7 +1738,7 @@ checksum = "0d958e351d2f210309b32d081c832d7de0aca0b077aa10d88336c6379bd01f7e"
dependencies = [
"cairo-rs",
"gdk4",
"glib",
"glib 0.18.4",
"graphene-rs",
"gsk4-sys",
"libc",
@ -1680,14 +1753,50 @@ checksum = "12bd9e3effea989f020e8f1ff3fa3b8c63ba93d43b899c11a118868853a56d55"
dependencies = [
"cairo-sys-rs",
"gdk4-sys",
"glib-sys",
"gobject-sys",
"glib-sys 0.18.1",
"gobject-sys 0.18.0",
"graphene-sys",
"libc",
"pango-sys",
"system-deps",
]
[[package]]
name = "gstreamer"
version = "0.19.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85fc926d081923c840403ec5ec3b2157a7cd236a2587c3031a4f0206f13ed500"
dependencies = [
"bitflags 1.3.2",
"cfg-if",
"futures-channel",
"futures-core",
"futures-util",
"glib 0.16.9",
"gstreamer-sys",
"libc",
"muldiv",
"num-integer",
"num-rational 0.4.1",
"once_cell",
"option-operations",
"paste",
"pretty-hex",
"thiserror",
]
[[package]]
name = "gstreamer-sys"
version = "0.19.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "545f52ad8a480732cc4290fd65dfe42952c8ae374fe581831ba15981fedf18a4"
dependencies = [
"glib-sys 0.16.3",
"gobject-sys 0.16.3",
"libc",
"system-deps",
]
[[package]]
name = "gtk4"
version = "0.7.3"
@ -1700,7 +1809,7 @@ dependencies = [
"gdk-pixbuf",
"gdk4",
"gio",
"glib",
"glib 0.18.4",
"graphene-rs",
"gsk4",
"gtk4-macros",
@ -1732,9 +1841,9 @@ dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gdk4-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"gio-sys 0.18.1",
"glib-sys 0.18.1",
"gobject-sys 0.18.0",
"graphene-sys",
"gsk4-sys",
"libc",
@ -1841,7 +1950,7 @@ dependencies = [
"cairo-rs",
"coordinates",
"gio",
"glib",
"glib 0.18.4",
"glib-build-tools 0.18.0",
"gtk4",
"image 0.24.7",
@ -2015,11 +2124,22 @@ name = "icon-test"
version = "0.1.0"
dependencies = [
"gio",
"glib",
"glib 0.18.4",
"gtk4",
"libadwaita",
]
[[package]]
name = "id3"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79f41f7e5ad125c63d55b112a98afb753742fa7f97692bfbbc52544b89e1ff1f"
dependencies = [
"bitflags 2.4.1",
"byteorder",
"flate2",
]
[[package]]
name = "idna"
version = "0.1.5"
@ -2257,7 +2377,7 @@ dependencies = [
"gdk-pixbuf",
"gdk4",
"gio",
"glib",
"glib 0.18.4",
"gtk4",
"libadwaita-sys",
"libc",
@ -2271,9 +2391,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e10aaa38de1d53374f90deeb4535209adc40cc5dba37f9704724169bceec69a"
dependencies = [
"gdk4-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"gio-sys 0.18.1",
"glib-sys 0.18.1",
"gobject-sys 0.18.0",
"gtk4-sys",
"libc",
"pango-sys",
@ -2294,9 +2414,9 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
[[package]]
name = "libsqlite3-sys"
version = "0.27.0"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326"
dependencies = [
"cc",
"pkg-config",
@ -2485,6 +2605,12 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58"
[[package]]
name = "muldiv"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0"
[[package]]
name = "multer"
version = "2.1.0"
@ -2503,6 +2629,26 @@ dependencies = [
"version_check 0.9.4",
]
[[package]]
name = "music-player"
version = "0.1.0"
dependencies = [
"gstreamer",
"id3",
"mime 0.3.17",
"mime_guess 2.0.4",
"result-extended",
"rusqlite",
"serde 1.0.193",
"serde_json",
"thiserror",
"tokio",
"url 2.5.0",
"urlencoding",
"uuid 1.6.1",
"warp",
]
[[package]]
name = "nary_tree"
version = "0.4.3"
@ -2531,17 +2677,6 @@ dependencies = [
"tempfile",
]
[[package]]
name = "nix"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
dependencies = [
"bitflags 2.4.1",
"cfg-if",
"libc",
]
[[package]]
name = "no-std-compat"
version = "0.4.1"
@ -2705,6 +2840,15 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "option-operations"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c26d27bb1aeab65138e4bf7666045169d1717febcc9ff870166be8348b223d0"
dependencies = [
"paste",
]
[[package]]
name = "otg-core"
version = "0.1.0"
@ -2731,7 +2875,7 @@ dependencies = [
"async-std",
"cairo-rs",
"gio",
"glib",
"glib 0.18.4",
"glib-build-tools 0.17.10",
"gtk4",
"image 0.24.7",
@ -2750,7 +2894,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4"
dependencies = [
"gio",
"glib",
"glib 0.18.4",
"libc",
"once_cell",
"pango-sys",
@ -2762,8 +2906,8 @@ version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5"
dependencies = [
"glib-sys",
"gobject-sys",
"glib-sys 0.18.1",
"gobject-sys 0.18.0",
"libc",
"system-deps",
]
@ -3056,6 +3200,12 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "pretty-hex"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5"
[[package]]
name = "pretty_env_logger"
version = "0.5.0"
@ -3472,6 +3622,20 @@ dependencies = [
"zeroize",
]
[[package]]
name = "rusqlite"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2"
dependencies = [
"bitflags 2.4.1",
"fallible-iterator",
"fallible-streaming-iterator",
"hashlink",
"libsqlite3-sys",
"smallvec",
]
[[package]]
name = "rustc-demangle"
version = "0.1.23"
@ -3584,7 +3748,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
name = "screenplay"
version = "0.1.0"
dependencies = [
"glib",
"glib 0.18.4",
"gtk4",
]
@ -3842,9 +4006,9 @@ dependencies = [
[[package]]
name = "sqlx"
version = "0.7.3"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf"
checksum = "0e50c216e3624ec8e7ecd14c6a6a6370aad6ee5d8cfc3ab30b5162eeeef2ed33"
dependencies = [
"sqlx-core",
"sqlx-macros",
@ -3855,9 +4019,9 @@ dependencies = [
[[package]]
name = "sqlx-core"
version = "0.7.3"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd"
checksum = "8d6753e460c998bbd4cd8c6f0ed9a64346fcca0723d6e75e52fdc351c5d2169d"
dependencies = [
"ahash",
"atoi",
@ -3895,9 +4059,9 @@ dependencies = [
[[package]]
name = "sqlx-macros"
version = "0.7.3"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5"
checksum = "9a793bb3ba331ec8359c1853bd39eed32cdd7baaf22c35ccf5c92a7e8d1189ec"
dependencies = [
"proc-macro2",
"quote",
@ -3908,11 +4072,10 @@ dependencies = [
[[package]]
name = "sqlx-macros-core"
version = "0.7.3"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841"
checksum = "0a4ee1e104e00dedb6aa5ffdd1343107b0a4702e862a84320ee7cc74782d96fc"
dependencies = [
"atomic-write-file",
"dotenvy",
"either",
"heck",
@ -3934,9 +4097,9 @@ dependencies = [
[[package]]
name = "sqlx-mysql"
version = "0.7.3"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4"
checksum = "864b869fdf56263f4c95c45483191ea0af340f9f3e3e7b4d57a61c7c87a970db"
dependencies = [
"atoi",
"base64 0.21.5",
@ -3976,9 +4139,9 @@ dependencies = [
[[package]]
name = "sqlx-postgres"
version = "0.7.3"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24"
checksum = "eb7ae0e6a97fb3ba33b23ac2671a5ce6e3cabe003f451abd5a56e7951d975624"
dependencies = [
"atoi",
"base64 0.21.5",
@ -4015,9 +4178,9 @@ dependencies = [
[[package]]
name = "sqlx-sqlite"
version = "0.7.3"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490"
checksum = "d59dc83cf45d89c555a577694534fcd1b55c545a816c816ce51f20bbe56a4f3f"
dependencies = [
"atoi",
"flume",
@ -4033,7 +4196,6 @@ dependencies = [
"sqlx-core",
"tracing",
"url 2.5.0",
"urlencoding",
]
[[package]]

View File

@ -19,6 +19,7 @@ members = [
"icon-test",
"ifc",
"memorycache",
"music-player/server",
"nom-training",
"otg/core",
"otg/gtk",

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
"style-loader": "^3.3.1",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"webpack": "^5.75.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.0.1"
}
}

View File

@ -3,7 +3,7 @@ const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
mode: 'development',
entry: ['./src/main.ts', './styles.scss'],
entry: ['./src/main.ts'],
module: {
rules: [
{
@ -15,10 +15,6 @@ module.exports = {
test: /\.html$/i,
type: 'asset/resource',
},
{
test: /\.s[ac]ss$/i,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
resolve: {

View File

@ -6,20 +6,20 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
flow = { path = "../../flow" }
gstreamer = { version = "0.19" }
id3 = { version = "1.6" }
mime_guess = { version = "2.0" }
mime = { version = "0.3" }
rusqlite = { version = "0.28" }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
thiserror = { version = "1.0" }
tokio = { version = "1.24", features = ["full"] }
url = { version = "2.3" }
uuid = { version = "1", features = ["v4"] }
warp = { version = "0.3" }
urlencoding = { version = "2.1" }
result-extended = { path = "../../result-extended" }
gstreamer = { version = "0.19" }
id3 = { version = "1.6" }
mime_guess = { version = "2.0" }
mime = { version = "0.3" }
rusqlite = { version = "0.29" }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
thiserror = { version = "1.0" }
tokio = { version = "1.24", features = ["full"] }
url = { version = "2.3" }
uuid = { version = "1", features = ["v4"] }
warp = { version = "0.3" }
urlencoding = { version = "2.1" }
[target.armv7-unknown-linux-gnueabi]
linker = "arm-linux-gnueabi-gcc"

View File

@ -1,4 +1,4 @@
use flow::Flow;
use result_extended::Result;
use music_player::{
core::{ControlMsg, Core},
database::{MemoryIndex, MusicIndex},
@ -29,8 +29,8 @@ enum Response<A: Serialize> {
Fatal(String),
}
impl<A: Serialize> From<Result<A, Error>> for Response<A> {
fn from(res: Result<A, Error>) -> Self {
impl<A: Serialize> From<std::result::Result<A, Error>> for Response<A> {
fn from(res: std::result::Result<A, Error>) -> Self {
match res {
Ok(val) => Self::Success(val),
Err(err) => Self::Failure(format!("{}", err)),
@ -38,12 +38,12 @@ impl<A: Serialize> From<Result<A, Error>> for Response<A> {
}
}
impl<A: Serialize> From<Flow<A, FatalError, Error>> for Response<A> {
fn from(res: Flow<A, FatalError, Error>) -> Self {
impl<A: Serialize> From<Result<A, Error, FatalError>> for Response<A> {
fn from(res: Result<A, Error, FatalError>) -> Self {
match res {
Flow::Ok(val) => Self::Success(val),
Flow::Fatal(fatal) => Self::Fatal(format!("{}", fatal)),
Flow::Err(err) => Self::Failure(format!("{}", err)),
Result::Ok(val) => Self::Success(val),
Result::Fatal(fatal) => Self::Fatal(format!("{}", fatal)),
Result::Err(err) => Self::Failure(format!("{}", err)),
}
}
}

View File

@ -5,7 +5,7 @@ use crate::{
scanner::MusicScanner,
Error, FatalError,
};
use flow::{ok, return_error, Flow};
use result_extended::{ok, return_error, Result};
use gstreamer::{format::ClockTime, prelude::*, MessageView};
use std::{
sync::{Arc, Mutex, RwLock},
@ -52,7 +52,7 @@ impl Core {
pub fn new(
db: Arc<dyn MusicIndex>,
scanner: Arc<dyn MusicScanner>,
) -> Result<Core, FatalError> {
) -> std::result::Result<Core, FatalError> {
let db = db;
let next_scan = Arc::new(RwLock::new(Instant::now()));
@ -70,17 +70,17 @@ impl Core {
})
}
pub fn list_tracks<'a>(&'a self) -> Flow<Vec<TrackInfo>, FatalError, Error> {
pub fn list_tracks<'a>(&'a self) -> Result<Vec<TrackInfo>, Error, FatalError> {
self.db.list_tracks().map_err(Error::DatabaseError)
}
pub fn play_track<'a>(&'a mut self, id: TrackId) -> Result<(), Error> {
pub fn play_track<'a>(&'a mut self, id: TrackId) -> std::result::Result<(), Error> {
self.stop_playback()?;
self.playback_controller = Some(Playback::new(id)?);
Ok(())
}
pub fn stop_playback<'a>(&'a mut self) -> Result<(), Error> {
pub fn stop_playback<'a>(&'a mut self) -> std::result::Result<(), Error> {
match self.playback_controller {
Some(ref controller) => controller.stop()?,
None => (),

View File

@ -2,7 +2,7 @@ use crate::{
media::{TrackId, TrackInfo},
FatalError,
};
use flow::{error, ok, Flow};
use result_extended::{error, ok, Result};
use rusqlite::Connection;
use serde::Serialize;
use std::collections::HashMap;
@ -21,10 +21,10 @@ pub enum DatabaseError {
}
pub trait MusicIndex: Sync + Send {
fn add_track(&self, track: TrackInfo) -> Flow<(), FatalError, DatabaseError>;
fn remove_track(&self, id: &TrackId) -> Flow<(), FatalError, DatabaseError>;
fn get_track_info(&self, id: &TrackId) -> Flow<Option<TrackInfo>, FatalError, DatabaseError>;
fn list_tracks<'a>(&'a self) -> Flow<Vec<TrackInfo>, FatalError, DatabaseError>;
fn add_track(&self, track: TrackInfo) -> Result<(), DatabaseError, FatalError>;
fn remove_track(&self, id: &TrackId) -> Result<(), DatabaseError, FatalError>;
fn get_track_info(&self, id: &TrackId) -> Result<Option<TrackInfo>, DatabaseError, FatalError>;
fn list_tracks<'a>(&'a self) -> Result<Vec<TrackInfo>, DatabaseError, FatalError>;
}
pub struct MemoryIndex {
@ -40,13 +40,13 @@ impl MemoryIndex {
}
impl MusicIndex for MemoryIndex {
fn add_track(&self, info: TrackInfo) -> Flow<(), FatalError, DatabaseError> {
fn add_track(&self, info: TrackInfo) -> Result<(), DatabaseError, FatalError> {
let mut tracks = self.tracks.write().unwrap();
tracks.insert(info.id.clone(), info);
ok(())
}
fn remove_track(&self, id: &TrackId) -> Flow<(), FatalError, DatabaseError> {
fn remove_track(&self, id: &TrackId) -> Result<(), DatabaseError, FatalError> {
let mut tracks = self.tracks.write().unwrap();
tracks.remove(&id);
ok(())
@ -55,7 +55,7 @@ impl MusicIndex for MemoryIndex {
fn get_track_info<'a>(
&'a self,
id: &TrackId,
) -> Flow<Option<TrackInfo>, FatalError, DatabaseError> {
) -> Result<Option<TrackInfo>, DatabaseError, FatalError> {
let track = {
let tracks = self.tracks.read().unwrap();
tracks.get(&id).cloned()
@ -63,7 +63,7 @@ impl MusicIndex for MemoryIndex {
ok(track)
}
fn list_tracks<'a>(&'a self) -> Flow<Vec<TrackInfo>, FatalError, DatabaseError> {
fn list_tracks<'a>(&'a self) -> Result<Vec<TrackInfo>, DatabaseError, FatalError> {
ok(self
.tracks
.read()
@ -92,7 +92,7 @@ pub struct Database {
}
impl Database {
pub fn new(path: PathBuf) -> Flow<Database, FatalError, DatabaseError> {
pub fn new(path: PathBuf) -> Result<Database, DatabaseError, FatalError> {
let connection = match Connection::open(path.clone()) {
Ok(connection) => connection,
Err(err) => return error(DatabaseError::UnhandledError(err.to_string())),
@ -136,7 +136,7 @@ mod test {
index.add_track(info.clone());
assert_eq!(
Flow::Ok(Some(info)),
Result::Ok(Some(info)),
index.get_track_info(&TrackId::from("track_1".to_owned()))
);
});

View File

@ -33,4 +33,4 @@ pub enum FatalError {
UnexpectedError,
}
impl flow::FatalError for FatalError {}
impl result_extended::FatalError for FatalError {}

View File

@ -1,5 +1,4 @@
use crate::{media::TrackId, Error, FatalError};
use flow::{ok, return_error, Flow};
use gstreamer::{format::ClockTime, prelude::*, MessageView, StateChangeError};
use std::{
path::PathBuf,