Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/tsukinaha/tsukimi into feat…
Browse files Browse the repository at this point in the history
…ure/win
  • Loading branch information
Kosette committed Apr 8, 2024
2 parents f084e82 + 9ed5d9b commit b0b66b4
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 78 deletions.
67 changes: 36 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
# Tsukimi
> A Simple Third-party Emby client.
![Commit Activity](https://img.shields.io/github/commit-activity/m/tsukinaha/Tsukimi/main)
![Top Language](https://img.shields.io/github/languages/top/tsukinaha/Tsukimi)
![GitHub License](https://img.shields.io/github/license/tsukinaha/tsukimi)
<img alt="Commit Activity" src="https://img.shields.io/github/commit-activity/m/tsukinaha/Tsukimi/main" />
<img alt="Top Language" src="https://img.shields.io/github/languages/top/tsukinaha/Tsukimi"/>
<img alt="Github License" src="https://img.shields.io/github/license/tsukinaha/Tsukimi" />

使用 GTK4-RS 编写的第三方 Emby 客户端
For Linux ~~Only~~.
请注意 设置页第一项的功能是
开启:每 10s 回报一次进度 播放与停止也回报
关闭:每 300s 回报一次进度 播放与停止也回报
如果你不能接受懒回报 请立刻删除此软件并拉黑
只对 aur 用户的 issue/pr 积极回应

使用 GTK4-RS 编写的第三方 Emby 客户端

<a href="https://github.com/tsukinaha/tsukimi/actions/workflows/build_linux.yml">
<img alt="Linux CI status" src="https://github.com/tsukinaha/tsukimi/actions/workflows/build_linux.yml/badge.svg"/>
</a>
<a href="https://github.com/tsukinaha/tsukimi/actions/workflows/build_release.yml">
<img alt="Windows GNU CI status" src="https://github.com/tsukinaha/tsukimi/actions/workflows/build_release.yml/badge.svg"/>
</a>

[![AUR Version](https://img.shields.io/aur/version/tsukimi-git)](https://aur.archlinux.org/packages/tsukimi-git)
<a href="https://github.com/tsukinaha/tsukimi/actions/workflows/build_linux.yml">
<img alt="Linux CI status" src="https://github.com/tsukinaha/tsukimi/actions/workflows/build_linux.yml/badge.svg"/>
</a>
<a href="https://github.com/tsukinaha/tsukimi/actions/workflows/build_release.yml">
<img alt="Windows GNU CI status" src="https://github.com/tsukinaha/tsukimi/actions/workflows/build_release.yml/badge.svg"/>
</a>
<a href="https://aur.archlinux.org/packages/tsukimi-git">
<img alt="AUR Version" src="https://img.shields.io/aur/version/tsukimi-git" />
</a>

## Build

请见 [Dockerfile](https://github.com/tsukinaha/tsukimi/blob/main/Dockerfile)
## Screenshots
<div align="center">
<img src="./docs/tsukimi.png"/>
</div>

## Build
### Linux
- 请见 [Dockerfile](https://github.com/tsukinaha/tsukimi/blob/main/Dockerfile)

## Installation
### Linux
From AUR
`paru -S tsukimi-git`


### Windows

- Install via Scoop / 通过 Scoop 安装

- Scoop
```
scoop bucket add scol https://github.com/Kosette/scol.git
scoop install tsukimi
```
- [Release](https://github.com/tsukinaha/tsukimi/releases/latest)

## MPV Config

- Linux: 读取默认配置 (`$XDG_CONFIG_HOME/mpv`)
- Windows:
首先读取以下路径中的配置

## MPV Config
- Linux: `$XDG_CONFIG_HOME/mpv`
- Windows:
```
|__bin\
|__share\
Expand All @@ -54,14 +59,14 @@ scoop install tsukimi
| |__ .......
|__config\
```
Priority:
`./mpv`>`$MPV_HOME`>`%APPDATA%/mpv`
[MPV-manual#files](https://mpv.io/manual/master/#files)

如果没有配置,则读取环境变量`$MPV_HOME`,都没有则保持 libmpv 默认行为

**具体配置请见:[MPV-manual#files](https://mpv.io/manual/master/#files)**

## Themes

- 除内置的 6 个主题外提供了跟随系统的选项 以便切换深浅色 和尊重用户自定义 css 样式表 [了解详情](https://wiki.archlinux.org/title/GTK#Configuration)
- 在自定义样式表时请使用 Default [关于自定义样式表](https://wiki.archlinux.org/title/GTK#Configuration)
- 主题来自 [Gradience](https://github.com/GradienceTeam/Gradience)

## Credits
Expand Down
Binary file added docs/tsukimi-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/tsukimi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 1 addition & 8 deletions resources/ui/item.ui
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,11 @@
<property name="spacing">10</property>
<property name="valign">start</property>
<property name="halign">end</property>
<child>
<object class="GtkToggleButton">
<property name="icon-name">emblem-favorite-symbolic</property>
<style>
<class name="raised" />
</style>
</object>
</child>
<child>
<object class="GtkCheckButton">
<style>
<class name="selection-mode" />
<class name="checkwatched" />
</style>
</object>
</child>
Expand Down
17 changes: 17 additions & 0 deletions resources/ui/movie.ui
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@
<property name="halign">start</property>
</object>
</child>
<child type="overlay">
<object class="GtkBox">
<property name="margin-end">30</property>
<property name="margin-top">15</property>
<property name="spacing">10</property>
<property name="valign">start</property>
<property name="halign">end</property>
<child>
<object class="GtkCheckButton">
<style>
<class name="selection-mode" />
<class name="checkwatched" />
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
Expand Down
4 changes: 4 additions & 0 deletions src/ui/adwaita.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.checkwatched {
background: rgba(0, 0, 0, 0.1);
}

child {
margin: 9px;
border-radius: 15px;
Expand Down
4 changes: 4 additions & 0 deletions src/ui/adwaitadark.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.checkwatched {
background: rgba(0, 0, 0, 0.1);
}

child {
margin: 9px;
border-radius: 15px;
Expand Down
4 changes: 4 additions & 0 deletions src/ui/alpha-dark.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.checkwatched {
background: rgba(0, 0, 0, 0.1);
}

child {
margin: 9px;
border-radius: 15px;
Expand Down
4 changes: 4 additions & 0 deletions src/ui/basic.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.checkwatched {
background: rgba(0, 0, 0, 0.1);
}

child {
margin: 9px;
border-radius: 15px;
Expand Down
57 changes: 19 additions & 38 deletions src/ui/mpv/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ pub fn play(

let server_info = set_config();
let url = format!("{}:{}/emby{}", server_info.domain, server_info.port, url);

let settings = gtk::gio::Settings::new(APP_ID);
let interval = if settings.boolean("is-progress-enabled") {
Duration::from_secs(10)
} else {
Duration::from_secs(300)
};
let mut duration: u64 = back.tick;
// Create an `Mpv` and set some properties.
let mpv = Mpv::with_initializer(|init| {
init.set_property("osc", true)?;
Expand All @@ -40,8 +46,6 @@ pub fn play(
init.set_property("force-media-title", name)?;
}

let settings = gtk::gio::Settings::new(APP_ID);

if settings.boolean("is-fullscreen") {
init.set_property("fullscreen", true)?;
}
Expand Down Expand Up @@ -77,7 +81,6 @@ pub fn play(
ev_ctx.observe_property("time-pos", Format::Double, 0)?;

let backc = back.clone();
std::env::set_var("DURATION", (&backc.tick / 10000000).to_string());
runtime().spawn(async move {
crate::ui::network::playstart(backc).await;
});
Expand All @@ -99,15 +102,11 @@ pub fn play(
match ev {
Ok(Event::EndFile(r)) => {
if r == 3 {
if let Ok(duration) = env::var("DURATION") {
println!("Duration: {}", duration);
let tick = duration.parse::<f64>().unwrap() as u64 * 10000000;
let mut back = back.clone();
back.tick = tick as u64;
runtime().spawn(async move {
crate::ui::network::positionstop(back).await;
});
}
let mut back = back.clone();
back.tick = duration;
runtime().spawn(async move {
crate::ui::network::positionstop(back).await;
});
}
println!("Exiting! Reason: {:?}", r);
break;
Expand All @@ -118,32 +117,14 @@ pub fn play(
change: PropertyData::Double(mpv_node),
..
}) => {
std::env::set_var("DURATION", mpv_node.to_string());
let settings = gtk::gio::Settings::new(APP_ID);
if last_print.elapsed() >= Duration::from_secs(10)
&& settings.boolean("is-progress-enabled")
{
last_print = Instant::now();
if let Ok(duration) = env::var("DURATION") {
let tick = duration.parse::<f64>().unwrap() as u64 * 10000000;
let mut back = back.clone();
// println!("Position: {}", tick);
back.tick = tick as u64;
runtime().spawn(async move {
crate::ui::network::positionback(back).await;
});
}
} else if last_print.elapsed() >= Duration::from_secs(30) {
duration = mpv_node as u64 * 10000000;
if last_print.elapsed() >= interval {
last_print = Instant::now();
if let Ok(duration) = env::var("DURATION") {
let tick = duration.parse::<f64>().unwrap() as u64 * 10000000;
let mut back = back.clone();
// println!("Position: {}", tick);
back.tick = tick as u64;
runtime().spawn(async move {
crate::ui::network::positionback(back).await;
});
}
let mut back = back.clone();
back.tick = duration;
runtime().spawn(async move {
crate::ui::network::positionback(back).await;
});
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/ui/solarized.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.checkwatched {
background: rgba(0, 0, 0, 0.1);
}

child {
margin: 9px;
border-radius: 15px;
Expand Down
4 changes: 4 additions & 0 deletions src/ui/style-dark.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.checkwatched {
background: rgba(0, 0, 0, 0.1);
}

child {
margin: 9px;
border-radius: 15px;
Expand Down
4 changes: 4 additions & 0 deletions src/ui/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ child {
background: rgba(0, 0, 0, 0);
}

.checkwatched {
background: rgba(0, 0, 0, 0.1);
}

listview > row {
margin-left: 9px;
margin-right: 9px;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/widgets/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ mod imp {
}
}
}
seasonlist.set_selected(pos);
if idc == inid {
itemlist.first_child().unwrap().activate();
}
Expand All @@ -226,7 +227,6 @@ mod imp {
}
itemlist.first_child().unwrap().activate();
});
seasonlist.set_selected(pos);
itemrevealer.set_reveal_child(true);
}));
obj.setoverview();
Expand Down

0 comments on commit b0b66b4

Please sign in to comment.