Skip to content

Commit 22f56d4

Browse files
committed
ai slop
1 parent e270f34 commit 22f56d4

22 files changed

Lines changed: 496 additions & 3047 deletions

Cargo.lock

Lines changed: 270 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,18 @@ clap = { version = "4", features = ["derive"] }
5151
fnv = "1.0.7"
5252
rand = "0.10.1"
5353
base64 = "0.22.1"
54-
libmpv2 = "4.1.0"
5554
glow = "0.17"
5655
xxhash-rust = { version = "0.8.15", features = ["xxh3"] }
5756
futures-util = "0.3.31"
5857
itertools = "0.14.0"
5958
moka = { version = "0.12.15", features = ["future"] }
59+
mutsumi = { path = "../mutsumi" }
60+
mpris-server = "0.10"
61+
xattr = { version = "1.6.1" }
62+
gdk-wayland = { version = "0.11", package = "gdk4-wayland", features = [
63+
"v4_18",
64+
"wayland_crate",
65+
] }
6066

6167
[dev-dependencies]
6268
cargo-husky = { version = "1", default-features = false, features = ["user-hooks"] }
@@ -68,18 +74,6 @@ protocols = [] # Enable custom protocol callbacks
6874
render = [] # Enable custom rendering
6975
build_libmpv = [] # build libmpv automatically, provided MPV_SOURCE is set
7076

71-
[target.'cfg(target_os = "linux")'.dependencies]
72-
mpris-server = "0.10"
73-
xattr = { version = "1.6.1" }
74-
gdk-x11 = { version = "0.11", package = "gdk4-x11", features = [
75-
"v4_18",
76-
"xlib",
77-
] }
78-
gdk-wayland = { version = "0.11", package = "gdk4-wayland", features = [
79-
"v4_18",
80-
"wayland_crate",
81-
] }
82-
8377
[profile.release]
8478
lto = true
8579
strip = true

resources/resources.gresource.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,9 @@
8181
<file compressed="true" preprocess="xml-stripblanks">ui/action_row.ui</file>
8282
<file compressed="true" preprocess="xml-stripblanks">ui/check_row.ui</file>
8383
<file compressed="true" preprocess="xml-stripblanks">ui/mpv_menu.ui</file>
84-
<file compressed="true" preprocess="xml-stripblanks">ui/mpv_menu_actions.ui</file>
8584
<file compressed="true" preprocess="xml-stripblanks">ui/mpv_shortcuts_window.ui</file>
8685
<file compressed="true" preprocess="xml-stripblanks">ui/tu_overview_item.ui</file>
8786
<file compressed="true" preprocess="xml-stripblanks">ui/item_carousel.ui</file>
88-
<file compressed="true" preprocess="xml-stripblanks">ui/mpv_control_sidebar.ui</file>
8987
<file compressed="true" preprocess="xml-stripblanks">ui/server_action_row.ui</file>
9088
<file compressed="true" preprocess="xml-stripblanks">ui/image_drop_row.ui</file>
9189
<file compressed="true" preprocess="xml-stripblanks">ui/image_dialog_search_page.ui</file>
@@ -97,7 +95,6 @@
9795
<file compressed="true" preprocess="xml-stripblanks">ui/filters_row.ui</file>
9896
<file compressed="true" preprocess="xml-stripblanks">ui/filter_label.ui</file>
9997
<file compressed="true" preprocess="xml-stripblanks">ui/filter_search_page.ui</file>
100-
<file compressed="true" preprocess="xml-stripblanks">ui/volume_bar.ui</file>
10198
<file compressed="true" preprocess="xml-stripblanks">ui/episode_switcher.ui</file>
10299
</gresource>
103100
</gresources>

resources/ui/mpv_control_sidebar.ui

Lines changed: 0 additions & 846 deletions
This file was deleted.

resources/ui/mpv_menu_actions.ui

Lines changed: 0 additions & 58 deletions
This file was deleted.

resources/ui/volume_bar.ui

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/client/error.rs

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -34,53 +34,6 @@ impl UserFacingError for std::boxed::Box<dyn std::error::Error> {
3434
}
3535
}
3636

37-
impl UserFacingError for libmpv2::Error {
38-
fn to_user_facing(&self) -> String {
39-
match self {
40-
Self::Loadfile { error } => {
41-
warn!("MPV ErrorLoadfile: {}", error);
42-
format!("ErrorLoadfile: {error}")
43-
}
44-
Self::Raw(error) => {
45-
let string = mpv_error_to_string(*error);
46-
warn!("MPV Error: {} ({})", string, error);
47-
format!("Error: {string} ({error})")
48-
}
49-
_ => {
50-
warn!("MPV Error: {}", self);
51-
format!("Unknown Error: {self}")
52-
}
53-
}
54-
}
55-
}
56-
57-
fn mpv_error_to_string(error: i32) -> &'static str {
58-
match error {
59-
0 => "Success",
60-
-1 => "Event queue full",
61-
-2 => "Out of memory",
62-
-3 => "Uninitialized",
63-
-4 => "Invalid parameter",
64-
-5 => "Option not found",
65-
-6 => "Option format",
66-
-7 => "Option error",
67-
-8 => "Property not found",
68-
-9 => "Property format",
69-
-10 => "Property unavailable",
70-
-11 => "Property error",
71-
-12 => "Command",
72-
-13 => "Loading failed",
73-
-14 => "Audio output init failed",
74-
-15 => "Video output init failed",
75-
-16 => "Nothing to play",
76-
-17 => "Unknown format",
77-
-18 => "Unsupported",
78-
-19 => "Not implemented",
79-
-20 => "Generic",
80-
_ => "Unknown",
81-
}
82-
}
83-
8437
impl UserFacingError for anyhow::Error {
8538
fn to_user_facing(&self) -> String {
8639
warn!("Unknown Error: {:#}", self);

src/gstl/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
#[cfg(target_os = "linux")]
21
pub mod mpris;
32
pub mod player;

src/gstl/player.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pub mod imp {
3232
},
3333
subclass::prelude::*,
3434
};
35-
#[cfg(target_os = "linux")]
3635
use mpris_server::LocalServer;
3736
use once_cell::sync::*;
3837
use tracing::{
@@ -101,7 +100,6 @@ pub mod imp {
101100
pub repeat_mode: Cell<ListRepeatMode>,
102101
#[property(get, set, default_value = false)]
103102
pub gapless: RefCell<bool>,
104-
#[cfg(target_os = "linux")]
105103
pub mpris_server: OnceCell<LocalServer<super::MusicPlayer>>,
106104
}
107105

@@ -117,7 +115,6 @@ pub mod imp {
117115
let pipeline = gst::ElementFactory::make("playbin3").build().unwrap();
118116

119117
// Initialize the mpris server
120-
#[cfg(target_os = "linux")]
121118
glib::spawn_future_local(glib::clone!(
122119
#[weak(rename_to = imp)]
123120
self,
@@ -450,27 +447,22 @@ pub mod imp {
450447
pub fn notify_song_changed(&self) {
451448
let has_prev = self.prev_song().is_some();
452449
let has_next = self.next_song().is_some();
453-
#[cfg(target_os = "linux")]
454450
self.obj().notify_mpris_song_changed(has_prev, has_next);
455451
}
456452

457453
pub fn notify_playing(&self) {
458-
#[cfg(target_os = "linux")]
459454
self.obj().notify_mpris_playing();
460455
}
461456

462457
pub fn notify_paused(&self) {
463-
#[cfg(target_os = "linux")]
464458
self.obj().notify_mpris_paused();
465459
}
466460

467461
pub fn notify_stopped(&self) {
468-
#[cfg(target_os = "linux")]
469462
self.obj().notify_mpris_stopped();
470463
}
471464

472465
pub fn notify_seeked(&self, position: i64) {
473-
#[cfg(target_os = "linux")]
474466
self.obj().notify_mpris_seeked(position);
475467
}
476468
}

src/lib.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ mod arg;
88
mod config;
99
mod gstl;
1010
mod macros;
11-
#[cfg(target_os = "linux")]
1211
mod mpris_common;
1312
mod ui;
1413
mod utils;
@@ -73,3 +72,19 @@ fn register_gio_resources() {
7372
let resources = gtk::gio::Resource::load(path).expect("Failed to load resources.");
7473
gtk::gio::resources_register(&resources);
7574
}
75+
76+
#[cfg(test)]
77+
mod tests {
78+
use gtk::gio;
79+
80+
#[test]
81+
fn registers_embedded_mutsumi_templates() {
82+
mutsumi::register_resources();
83+
84+
gio::resources_lookup_data(
85+
"/io/github/mutsumi/ui/mpv_control_sidebar.ui",
86+
gio::ResourceLookupFlags::NONE,
87+
)
88+
.expect("mutsumi MPVControlSidebar template should be registered");
89+
}
90+
}

0 commit comments

Comments
 (0)