Skip to content

Commit

Permalink
feat: add single audio support.
Browse files Browse the repository at this point in the history
chore: bump to 0.17.0
  • Loading branch information
tsukinaha committed Nov 6, 2024
1 parent b2bce20 commit f1fc307
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 59 deletions.
8 changes: 5 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tsukimi"
version = "0.16.9"
version = "0.17.0"
edition = "2021"
rust-version = "1.81"
description = "A simple Emby Client written by GTK4-RS"
Expand Down Expand Up @@ -28,7 +28,7 @@ tracing = "0.1.40"
gst = { version = "0.23", package = "gstreamer" }
url = "2.5.3"
libmpv2 = { path = "libmpv2-rs", version = "=4.0.0" }
image = "0.25.2"
image = "0.25.5"
gettext-rs = { version = "~0.7", features = ["gettext-system"] }
hostname = "0.4.0"
epoxy = "0.1.0"
Expand Down Expand Up @@ -96,3 +96,6 @@ assets = [

[profile.release]
lto = true

[profile.dev]
debug = true
2 changes: 1 addition & 1 deletion installer/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.16.9.0
0.17.0.0
6 changes: 3 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('tsukimi', 'rust',
version: '0.16.9',
version: '0.17.0',
meson_version: '>= 1.1',
default_options: [ 'warning_level=2',
'werror=false',
Expand All @@ -8,8 +8,8 @@ project('tsukimi', 'rust',
)

major_version = '0'
minor_version = '16'
micro_version = '9'
minor_version = '17'
micro_version = '0'

version = major_version
version += '.' + minor_version + '.' + micro_version
Expand Down
2 changes: 1 addition & 1 deletion resources/moe.tsuna.tsukimi.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<releases>
<release version="0.16.9" date="2024-10-18" />
<release version="0.17.0" date="2024-10-18" />
</releases>
<name>Tsukimi</name>
<summary>A simple third-party Emby client</summary>
Expand Down
31 changes: 25 additions & 6 deletions resources/ui/other.ui
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template parent="AdwNavigationPage" class="OtherPage">
<property name="title" >Tsukimi</property>
<property name="title">Tsukimi</property>
<child>
<object class="AdwToolbarView">
<child>
Expand All @@ -23,8 +23,9 @@
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
<property name="margin-end">12</property>
<property name="margin-end">32</property>
<property name="margin-start">18</property>
<property name="spacing">32</property>
<property name="margin-bottom">20</property>
<property name="halign">fill</property>
<property name="valign">start</property>
Expand All @@ -47,11 +48,9 @@
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="spacing">12</property>
<property name="margin-top">12</property>
<child>
<object class="GtkLabel" id="title">
<property name="margin-start">12</property>
<property name="label" translatable="yes">Name</property>
<property name="halign">start</property>
<property name="valign">end</property>
Expand All @@ -62,6 +61,27 @@
</attributes>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="spacing">12</property>
<property name="margin-top">6</property>
<child>
<object class="GtkButton" id="play_button">
<property name="width-request">44</property>
<property name="height-request">44</property>
<property name="icon-name">media-playback-start-symbolic</property>
<property name="tooltip-text" translatable="yes">Play</property>
<property name="valign">center</property>
<property name="visible">False</property>
<style>
<class name="circular"/>
<class name="suggested-action"/>
</style>
</object>
</child>
<child>
<object class="ItemActionsBox" id="actionbox">
</object>
Expand All @@ -74,7 +94,6 @@
<property name="text" translatable="yes">No Inscriptions</property>
<property name="valign">fill</property>
<property name="yalign">0.20</property>
<property name="margin-start">12</property>
<property name="margin-top">12</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
Expand All @@ -85,7 +104,7 @@
</style>
</object>
</child>

</object>
</child>
</object>
Expand Down
18 changes: 18 additions & 0 deletions resources/ui/search.ui
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@
<property name="active">True</property>
</object>
</child>
<child>
<object class="AdwSwitchRow" id="audio">
<property name="title" translatable="yes">Audio</property>
<property name="active">False</property>
</object>
</child>
<child>
<object class="AdwSwitchRow" id="video">
<property name="title" translatable="yes">Video</property>
<property name="active">False</property>
</object>
</child>
<child>
<object class="AdwSwitchRow" id="episode">
<property name="title" translatable="yes">Episode</property>
<property name="active">False</property>
</object>
</child>
</object>
</child>
</object>
Expand Down
8 changes: 1 addition & 7 deletions resources/ui/window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,7 @@
</object>
</child>
<child type="bottom">
<object class="GtkRevealer" id="player_toolbar_bin">
<property name="reveal-child">False</property>
<property name="valign">end</property>
<child>
<object class="PlayerToolbarBox" id="player_toolbar_box" />
</child>
</object>
<object class="PlayerToolbarBox" id="player_toolbar_box" />
</child>
<property name="content">
<object class="GtkOverlay">
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pub static VERSION: &str = "0.16.9";
pub static VERSION: &str = "0.17.0";
pub static GETTEXT_PACKAGE: &str = "tsukimi";
2 changes: 1 addition & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn build_ui(app: &adw::Application) {
.application_name("Tsukimi")
.version(crate::config::VERSION)
.comments(
"A simple third-party Emby client.\nVersion: tsukimi 0.16.9 \n2024.10.18 20:05",
"A simple third-party Emby client.\nVersion: tsukimi 0.17.0 \n2024.10.18 20:05",
)
// TRANSLATORS: 'Name <email@domain.com>' or 'Name https://website.example'
.translator_credits(gettext("translator-credits"))
Expand Down
2 changes: 1 addition & 1 deletion src/ui/provider/tu_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl TuItem {
let page = ListPage::new(self.id(), "livetv".to_string());
push_page_with_tag(window, page, self.name());
}
"Tag" | "Genre" => {
"Tag" | "Genre" | "MusicGenre" => {
let page = SingleGrid::new();
let id = self.id();
let parent_id = parentid.clone();
Expand Down
6 changes: 1 addition & 5 deletions src/ui/widgets/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,11 @@ impl HomePage {
for view in items {
let ac_view = view.clone();

let Some(collection_type) = view.collection_type else {
continue;
};

let results = match fetch_with_cache(
&format!("library_{}", view.id),
CachePolicy::ReadCacheAndRefresh,
async move {
if collection_type == "livetv" {
if view.collection_type.as_deref() == Some("livetv") {
EMBY_CLIENT.get_channels().await.map(|x| x.items)
} else {
EMBY_CLIENT.get_latest(&view.id).await
Expand Down
6 changes: 0 additions & 6 deletions src/ui/widgets/music_album.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ pub(crate) mod imp {
#[weak]
obj,
async move {
obj.set_toolbar();
obj.set_album().await;
obj.get_songs().await;
obj.set_lists().await;
Expand Down Expand Up @@ -263,11 +262,6 @@ impl AlbumPage {
liststore
}

pub fn set_toolbar(&self) {
let window = self.root().and_downcast::<super::window::Window>().unwrap();
window.set_player_toolbar();
}

pub async fn set_lists(&self) {
self.sets("Recommend").await;
self.sets("More From").await;
Expand Down
26 changes: 18 additions & 8 deletions src/ui/widgets/other.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,14 @@ use gtk::{

use super::{horbu_scrolled::HorbuScrolled, picture_loader::PictureLoader};
use crate::{
client::{
bing_song_model, client::{
client::EMBY_CLIENT,
error::UserFacingError,
structs::*,
},
fraction,
fraction_reset,
toast,
ui::provider::tu_item::TuItem,
utils::{
}, fraction, fraction_reset, toast, ui::{provider::{core_song::CoreSong, tu_item::TuItem}, widgets::song_widget::SongWidget}, utils::{
fetch_with_cache,
CachePolicy,
},
}
};

pub(crate) mod imp {
Expand Down Expand Up @@ -83,6 +78,8 @@ pub(crate) mod imp {

#[template_child]
pub actionbox: TemplateChild<ItemActionsBox>,
#[template_child]
pub play_button: TemplateChild<gtk::Button>,
}

// The central trait for subclassing a GObject
Expand Down Expand Up @@ -218,6 +215,19 @@ impl OtherPage {
"BoxSet" => {
self.hortu_set_boxset_list().await;
}
"Audio" => {
self.imp().play_button.set_visible(true);
self.imp().play_button.connect_clicked(glib::clone!(
#[weak(rename_to = obj)]
self,
move |_| {
let item = obj.item();
let song_widget = SongWidget::new(item);
let model = gio::ListStore::new::<CoreSong>();
bing_song_model!(obj, model, song_widget.coresong());
}
));
}
_ => {

}
Expand Down
3 changes: 1 addition & 2 deletions src/ui/widgets/player_toolbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ impl PlayerToolbarBox {
}

pub fn bind_song_model(&self, active_model: gtk::gio::ListStore, active_core_song: CoreSong) {
let player = &self.imp().player.imp();
player.load_model(active_model, active_core_song);
self.imp().player.imp().load_model(active_model, active_core_song);
self.update_play_state();
}

Expand Down
15 changes: 15 additions & 0 deletions src/ui/widgets/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ mod imp {
#[template_child]
pub music: TemplateChild<adw::SwitchRow>,
#[template_child]
pub audio: TemplateChild<adw::SwitchRow>,
#[template_child]
pub video: TemplateChild<adw::SwitchRow>,
#[template_child]
pub episode: TemplateChild<adw::SwitchRow>,
#[template_child]
pub stack: TemplateChild<gtk::Stack>,
pub selection: gtk::SingleSelection,
}
Expand Down Expand Up @@ -232,6 +238,15 @@ impl SearchPage {
if imp.music.is_active() {
filter.push("MusicAlbum");
}
if imp.audio.is_active() {
filter.push("Audio");
}
if imp.video.is_active() {
filter.push("Video");
}
if imp.episode.is_active() {
filter.push("Episode");
}
if filter.is_empty() {
return List::default();
}
Expand Down
12 changes: 0 additions & 12 deletions src/ui/widgets/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ mod imp {
#[template_child]
pub namerow: TemplateChild<adw::ActionRow>,
#[template_child]
pub player_toolbar_bin: TemplateChild<gtk::Revealer>,
#[template_child]
pub player_toolbar_box: TemplateChild<PlayerToolbarBox>,
#[template_child]
pub progressbar: TemplateChild<gtk::ProgressBar>,
Expand Down Expand Up @@ -665,16 +663,6 @@ impl Window {
dialog.present(Some(self));
}

pub fn set_player_toolbar(&self) {
spawn(glib::clone!(
#[weak(rename_to = obj)]
self,
async move {
obj.imp().player_toolbar_bin.set_reveal_child(true);
}
));
}

pub fn set_fraction(&self, to_value: f64) {
let progressbar = &self.imp().progressbar;
self.progressbar_animation().set_value_from(progressbar.fraction());
Expand Down

0 comments on commit f1fc307

Please sign in to comment.