mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-02 19:01:40 +00:00
24 lines
715 B
TypeScript
24 lines
715 B
TypeScript
|
|
import { useState } from 'react';
|
||
|
|
import { usePlayerStore } from '/@/renderer/store';
|
||
|
|
|
||
|
|
export const useScrobble = () => {
|
||
|
|
const [isScrobbled, setIsScrobbled] = useState(false);
|
||
|
|
|
||
|
|
const currentSongDuration = usePlayerStore((state) => state.current.song?.duration);
|
||
|
|
|
||
|
|
const scrobbleAtPercentage = usePlayerStore((state) => state.settings.scrobbleAtPercentage);
|
||
|
|
|
||
|
|
console.log('currentSongDuration', currentSongDuration);
|
||
|
|
|
||
|
|
const scrobbleAtTime = (currentSongDuration * scrobbleAtPercentage) / 100;
|
||
|
|
|
||
|
|
console.log('scrobbleAtTime', scrobbleAtTime);
|
||
|
|
|
||
|
|
console.log('render');
|
||
|
|
const handleScrobble = () => {
|
||
|
|
console.log('scrobble complete');
|
||
|
|
};
|
||
|
|
|
||
|
|
return { handleScrobble, isScrobbled, setIsScrobbled };
|
||
|
|
};
|