Skip to content

Commit

Permalink
Bump version to 0.19.3
Browse files Browse the repository at this point in the history
Signed-off-by: tsukinaha <[email protected]>
  • Loading branch information
tsukinaha committed Feb 4, 2025
1 parent 1f51275 commit ebc6870
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tsukimi"
version = "0.19.2"
version = "0.19.3"
edition = "2021"
rust-version = "1.81"
description = "A simple Emby Client written by GTK4-RS"
Expand Down
2 changes: 1 addition & 1 deletion installer/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.19.2.0
0.19.3.0
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('tsukimi', 'rust',
version: '0.19.2',
version: '0.19.3',
meson_version: '>= 1.1',
default_options: [ 'warning_level=2',
'werror=false',
Expand All @@ -9,7 +9,7 @@ project('tsukimi', 'rust',

major_version = '0'
minor_version = '19'
micro_version = '2'
micro_version = '3'

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.19.2" date="2024-10-18" />
<release version="0.19.3" date="2024-10-18" />
</releases>
<name>Tsukimi</name>
<summary>A simple third-party Emby client</summary>
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.19.2";
pub static VERSION: &str = "0.19.3";
pub static GETTEXT_PACKAGE: &str = "tsukimi";
51 changes: 46 additions & 5 deletions src/ui/mpv/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use crate::{
structs::{
Back,
MediaSource,
MediaStream,
},
},
close_on_error,
Expand Down Expand Up @@ -419,7 +420,7 @@ impl MPVPage {
};

let back = Back {
id,
id: id.clone(),
playsessionid: playback_info.play_session_id,
mediasourceid: media_source.id.clone(),
tick: media_source.run_time_ticks.unwrap_or(0),
Expand All @@ -436,12 +437,16 @@ impl MPVPage {
.media_streams
.iter()
.filter(|stream| stream.stream_type == "Subtitle")
.filter_map(|stream| stream.display_title.as_ref())
.cloned()
.map(|stream| {
(
stream.index,
stream.display_title.clone().unwrap_or_default(),
)
})
.collect();

make_subtitle_version_choice(sub_version_list)
.and_then(|index| media_source.media_streams.get(index))
.and_then(|index| media_source.media_streams.get(index.0 as usize))
};

if let Some(slang) = selected.clone().map(|s| s.sub_lang) {
Expand All @@ -454,7 +459,16 @@ impl MPVPage {
let sub_url = match media_stream {
Some(stream) if stream.is_external => match &stream.delivery_url {
Some(url) => Some(EMBY_CLIENT.get_streaming_url(url).await),
None => None,
None => {
println!("External Subtitle without selected source");
imp.obj()
.external_sub_url_without_selected_source(
id,
stream,
media_source.id.clone(),
)
.await
}
},
_ => None,
};
Expand All @@ -471,6 +485,33 @@ impl MPVPage {
));
}

async fn external_sub_url_without_selected_source(
&self, id: String, media_stream: &MediaStream, media_source_id: String,
) -> Option<String> {
let id_clone = id.clone();
let stream_index = media_stream.index;
let media_source_id_clone = media_source_id.clone();
let playback_info = spawn_tokio(async move {
EMBY_CLIENT
.get_playbackinfo(&id_clone, Some(stream_index), Some(media_source_id), true)
.await
})
.await
.ok()?;

let media_source = playback_info
.media_sources
.iter().find(|source| source.id == media_source_id_clone);

let url = media_source?
.media_streams
.get(stream_index as usize)?
.delivery_url
.clone()?;

Some(EMBY_CLIENT.get_streaming_url(&url).await)
}

fn set_audio_and_video_tracks_dropdown(&self, value: MpvTracks) {
let imp = self.imp();
self.bind_tracks::<true>(value.audio_tracks, &imp.audio_listbox.get());
Expand Down
13 changes: 6 additions & 7 deletions src/ui/widgets/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,14 +730,15 @@ impl ItemPage {
continue;
};

lang_list.push(dl.line1.clone().unwrap_or_default());
lang_list
.push((stream.index, dl.line1.clone().unwrap_or_default()));
let object = glib::BoxedAnyObject::new(dl);
sstore.append(&object);
}
}

if let Some(usize) = make_subtitle_version_choice(lang_list) {
subdropdown.set_selected(usize as u32);
if let Some(u) = make_subtitle_version_choice(lang_list) {
subdropdown.set_selected(u.1 as u32);
}
break;
}
Expand Down Expand Up @@ -1210,6 +1211,7 @@ impl ItemPage {
.selected_item()
.and_downcast::<glib::BoxedAnyObject>()
else {
toast!(self, gettext("No video source found"));
return;
};

Expand All @@ -1219,13 +1221,10 @@ impl ItemPage {
.map(|obj| obj.borrow::<DropdownList>().clone());

let video_dl: std::cell::Ref<DropdownList> = video_object.borrow();
let (sub_index, sub_lang) = sub_dl
.and_then(|sub_dl| {
Some((
let (sub_index, sub_lang) = sub_dl.map(|sub_dl| (
sub_dl.index.unwrap_or_default(),
sub_dl.sub_lang.clone().unwrap_or_default(),
))
})
.unwrap_or_default();

let info = SelectedVideoSubInfo {
Expand Down
12 changes: 7 additions & 5 deletions src/ui/widgets/item_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn make_video_version_choice_from_matcher(
best_match_index
}

pub fn make_subtitle_version_choice(lang_list: Vec<String>) -> Option<usize> {
pub fn make_subtitle_version_choice(lang_list: Vec<(u64, String)>) -> Option<(u64, usize)> {
let lang = match SETTINGS.mpv_subtitle_preferred_lang() {
1 => "English",
2 => "Chinese Simplified",
Expand All @@ -60,14 +60,16 @@ pub fn make_subtitle_version_choice(lang_list: Vec<String>) -> Option<usize> {
};

let mut best_match_index = None;
let mut best_match_usize = None;
let mut highest_similarity = 0.0;
for (index, name) in lang_list.iter().enumerate() {
let similarity = jaro_winkler(name, lang);
for (index, i) in lang_list.iter().enumerate() {
let similarity = jaro_winkler(&i.1, lang);
if similarity > highest_similarity {
highest_similarity = similarity;
best_match_index = Some(index);
best_match_index = Some(i.0);
best_match_usize = Some(index);
}
}

best_match_index
Some((best_match_index?, best_match_usize?))
}

0 comments on commit ebc6870

Please sign in to comment.