mirror of
https://github.com/stashapp/stash.git
synced 2025-12-07 08:54:10 +01:00
Added marker / scene audio interface option
This commit is contained in:
parent
a67a45ce91
commit
ec453c7a14
6 changed files with 40 additions and 19 deletions
File diff suppressed because one or more lines are too long
|
|
@ -73,7 +73,13 @@ func getSort(sort string, direction string, tableName string) string {
|
||||||
return " ORDER BY RANDOM() "
|
return " ORDER BY RANDOM() "
|
||||||
} else {
|
} else {
|
||||||
colName := getColumn(tableName, sort)
|
colName := getColumn(tableName, sort)
|
||||||
return " ORDER BY " + colName + " " + direction
|
var additional string
|
||||||
|
if tableName == "scenes" {
|
||||||
|
additional = ", bitrate DESC, framerate DESC, rating DESC, duration DESC"
|
||||||
|
} else if tableName == "scene_markers" {
|
||||||
|
additional = ", scene_id ASC, seconds ASC"
|
||||||
|
}
|
||||||
|
return " ORDER BY " + colName + " " + direction + additional
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,16 @@ export const SettingsInterfacePanel: FunctionComponent<IProps> = () => {
|
||||||
setData(newSettings);
|
setData(newSettings);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Checkbox
|
||||||
|
checked={!!data ? data.wall.soundEnabled : true}
|
||||||
|
label="Enable sound"
|
||||||
|
onChange={() => {
|
||||||
|
if (!data) { return; }
|
||||||
|
const newSettings = _.cloneDeep(data);
|
||||||
|
newSettings.wall.soundEnabled = !data.wall.soundEnabled;
|
||||||
|
setData(newSettings);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ interface ISceneCardProps {
|
||||||
|
|
||||||
export const SceneCard: FunctionComponent<ISceneCardProps> = (props: ISceneCardProps) => {
|
export const SceneCard: FunctionComponent<ISceneCardProps> = (props: ISceneCardProps) => {
|
||||||
const [previewPath, setPreviewPath] = useState<string | undefined>(undefined);
|
const [previewPath, setPreviewPath] = useState<string | undefined>(undefined);
|
||||||
const videoHoverHook = VideoHoverHook.useVideoHover();
|
const videoHoverHook = VideoHoverHook.useVideoHover({resetOnMouseLeave: false});
|
||||||
|
|
||||||
function maybeRenderRatingBanner() {
|
function maybeRenderRatingBanner() {
|
||||||
if (!props.scene.rating) { return; }
|
if (!props.scene.rating) { return; }
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import React from "react";
|
||||||
|
|
||||||
interface IInterfaceWallConfig {
|
interface IInterfaceWallConfig {
|
||||||
textContainerEnabled: boolean;
|
textContainerEnabled: boolean;
|
||||||
|
soundEnabled: boolean;
|
||||||
}
|
}
|
||||||
export interface IInterfaceConfig {
|
export interface IInterfaceConfig {
|
||||||
wall: IInterfaceWallConfig;
|
wall: IInterfaceWallConfig;
|
||||||
|
|
@ -25,6 +26,7 @@ export function useInterfaceLocalForage(): ILocalForage<IInterfaceConfig | undef
|
||||||
result.setData({
|
result.setData({
|
||||||
wall: {
|
wall: {
|
||||||
textContainerEnabled: true,
|
textContainerEnabled: true,
|
||||||
|
soundEnabled: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
|
import { useInterfaceLocalForage } from "./LocalForage";
|
||||||
|
|
||||||
export interface IVideoHoverHookData {
|
export interface IVideoHoverHookData {
|
||||||
videoEl: React.RefObject<HTMLVideoElement>;
|
videoEl: React.RefObject<HTMLVideoElement>;
|
||||||
|
|
@ -12,21 +13,17 @@ export interface IVideoHoverHookOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class VideoHoverHook {
|
export class VideoHoverHook {
|
||||||
public static useVideoHover(options?: IVideoHoverHookOptions): IVideoHoverHookData {
|
public static useVideoHover(options: IVideoHoverHookOptions): IVideoHoverHookData {
|
||||||
if (options === undefined) {
|
|
||||||
options = {
|
|
||||||
resetOnMouseLeave: false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const videoEl = useRef<HTMLVideoElement>(null);
|
const videoEl = useRef<HTMLVideoElement>(null);
|
||||||
const isPlaying = useRef<boolean>(false);
|
const isPlaying = useRef<boolean>(false);
|
||||||
const isHovering = useRef<boolean>(false);
|
const isHovering = useRef<boolean>(false);
|
||||||
|
|
||||||
|
const interfaceSettings = useInterfaceLocalForage();
|
||||||
|
const soundEnabled = !!interfaceSettings.data ? interfaceSettings.data.wall.soundEnabled : true;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const videoTag = videoEl.current;
|
const videoTag = videoEl.current;
|
||||||
if (!videoTag) { return; }
|
if (!videoTag) { return; }
|
||||||
videoTag.volume = 0.05;
|
|
||||||
videoTag.onplaying = () => {
|
videoTag.onplaying = () => {
|
||||||
if (isHovering.current === true) {
|
if (isHovering.current === true) {
|
||||||
isPlaying.current = true;
|
isPlaying.current = true;
|
||||||
|
|
@ -37,6 +34,12 @@ export class VideoHoverHook {
|
||||||
videoTag.onpause = () => isPlaying.current = false;
|
videoTag.onpause = () => isPlaying.current = false;
|
||||||
}, [videoEl]);
|
}, [videoEl]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const videoTag = videoEl.current;
|
||||||
|
if (!videoTag) { return; }
|
||||||
|
videoTag.volume = soundEnabled ? 0.05 : 0;
|
||||||
|
}, [soundEnabled]);
|
||||||
|
|
||||||
return {videoEl, isPlaying, isHovering, options};
|
return {videoEl, isPlaying, isHovering, options};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue