mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-02 10:53:33 +00:00
Add MPRIS support (#25)
* Stop mpv on app close for linux/macOS (#20) * Add initial MPRIS support * Fix mpv path check
This commit is contained in:
parent
0f7f4b969f
commit
23f84d68e8
19 changed files with 1672 additions and 144 deletions
|
|
@ -20,7 +20,8 @@ import { nanoid } from 'nanoid/non-secure';
|
|||
import { LibraryItem, SongListSort, SortOrder } from '/@/renderer/api/types';
|
||||
|
||||
const mpvPlayer = isElectron() ? window.electron.mpvPlayer : null;
|
||||
|
||||
const utils = isElectron() ? window.electron.utils : null;
|
||||
const mpris = isElectron() && utils?.isLinux() ? window.electron.mpris : null;
|
||||
export const useHandlePlayQueueAdd = () => {
|
||||
const queryClient = useQueryClient();
|
||||
const playerType = usePlayerType();
|
||||
|
|
@ -167,6 +168,13 @@ export const useHandlePlayQueueAdd = () => {
|
|||
if (!songs) return toast.warn({ message: 'No songs found' });
|
||||
|
||||
const playerData = usePlayerStore.getState().actions.addToQueue(songs, options.play);
|
||||
mpris?.updateSong({
|
||||
currentTime: usePlayerStore.getState().current.time,
|
||||
repeat: usePlayerStore.getState().repeat,
|
||||
shuffle: usePlayerStore.getState().shuffle,
|
||||
song: playerData.current.song,
|
||||
status: 'Playing',
|
||||
});
|
||||
|
||||
if (options.play === Play.NEXT || options.play === Play.LAST) {
|
||||
if (playerType === PlaybackType.LOCAL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue