38 lines
949 B
TypeScript
38 lines
949 B
TypeScript
import { create } from 'zustand'
|
|
import { SplitOptions } from '../types'
|
|
|
|
const DEFAULT_OPTIONS: SplitOptions = {
|
|
format: 'mp3',
|
|
transcode_to: '',
|
|
drop_video: false,
|
|
drop_subs: false,
|
|
number_tracks: false,
|
|
replace_bad_chars: false,
|
|
replacement_char: '_',
|
|
bad_chars: '!@#№$;:%^&?*(){}[]\\/<>+=~`\' ',
|
|
skip_existing: false,
|
|
output_template: '%an-%tn.%ext',
|
|
album: '',
|
|
comment: '',
|
|
no_comment: false,
|
|
comment_stream: null,
|
|
merge_comments: false,
|
|
comment_separator: '; ',
|
|
tracklist_format: '%ts %tn - %an', // NEW
|
|
}
|
|
|
|
interface OptionsState {
|
|
options: SplitOptions
|
|
setOptions: (options: Partial<SplitOptions>) => void
|
|
reset: () => void
|
|
}
|
|
|
|
export const useOptionsStore = create<OptionsState>((set) => ({
|
|
options: { ...DEFAULT_OPTIONS },
|
|
setOptions: (newOptions) =>
|
|
set((state) => ({
|
|
options: { ...state.options, ...newOptions },
|
|
})),
|
|
reset: () => set({ options: { ...DEFAULT_OPTIONS } }),
|
|
}))
|