mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2026-05-06 23:05:50 +05:30
feat: added custom commands, per-download configs and other minor improvements
This commit is contained in:
@@ -202,7 +202,8 @@ export const saveDownloadState = async (downloadState: DownloadState) => {
|
||||
embed_thumbnail = $28,
|
||||
sponsorblock_remove = $29,
|
||||
sponsorblock_mark = $30,
|
||||
use_aria2 = $31
|
||||
use_aria2 = $31,
|
||||
custom_command = $32
|
||||
WHERE download_id = $1`,
|
||||
[
|
||||
downloadState.download_id,
|
||||
@@ -235,7 +236,8 @@ export const saveDownloadState = async (downloadState: DownloadState) => {
|
||||
downloadState.embed_thumbnail,
|
||||
downloadState.sponsorblock_remove,
|
||||
downloadState.sponsorblock_mark,
|
||||
downloadState.use_aria2
|
||||
downloadState.use_aria2,
|
||||
downloadState.custom_command
|
||||
]
|
||||
)
|
||||
}
|
||||
@@ -270,8 +272,9 @@ export const saveDownloadState = async (downloadState: DownloadState) => {
|
||||
embed_thumbnail,
|
||||
sponsorblock_remove,
|
||||
sponsorblock_mark,
|
||||
use_aria2
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31)`,
|
||||
use_aria2,
|
||||
custom_command
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32)`,
|
||||
[
|
||||
downloadState.download_id,
|
||||
downloadState.download_status,
|
||||
@@ -303,7 +306,8 @@ export const saveDownloadState = async (downloadState: DownloadState) => {
|
||||
downloadState.embed_thumbnail,
|
||||
downloadState.sponsorblock_remove,
|
||||
downloadState.sponsorblock_mark,
|
||||
downloadState.use_aria2
|
||||
downloadState.use_aria2,
|
||||
downloadState.custom_command
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export const useDownloadStatesStore = create<DownloadStatesStore>((set) => ({
|
||||
const existingIndex = prev.downloadStates.findIndex(
|
||||
item => item.download_id === state.download_id
|
||||
);
|
||||
|
||||
|
||||
if (existingIndex !== -1) {
|
||||
// Update existing state
|
||||
const updatedStates = [...prev.downloadStates];
|
||||
@@ -47,22 +47,45 @@ export const useCurrentVideoMetadataStore = create<CurrentVideoMetadataStore>((s
|
||||
|
||||
export const useDownloaderPageStatesStore = create<DownloaderPageStatesStore>((set) => ({
|
||||
activeDownloadModeTab: 'selective',
|
||||
activeDownloadConfigurationTab: 'options',
|
||||
isStartingDownload: false,
|
||||
selectedDownloadFormat: 'best',
|
||||
selectedCombinableVideoFormat: '',
|
||||
selectedCombinableAudioFormat: '',
|
||||
selectedSubtitles: [],
|
||||
selectedPlaylistVideoIndex: '1',
|
||||
downloadConfiguration: {
|
||||
output_format: null,
|
||||
embed_metadata: null,
|
||||
embed_thumbnail: null,
|
||||
custom_command: null
|
||||
},
|
||||
isErrored: false,
|
||||
isErrorExpected: false,
|
||||
erroredDownloadId: null,
|
||||
setActiveDownloadModeTab: (tab) => set(() => ({ activeDownloadModeTab: tab })),
|
||||
setActiveDownloadConfigurationTab: (tab) => set(() => ({ activeDownloadConfigurationTab: tab })),
|
||||
setIsStartingDownload: (isStarting) => set(() => ({ isStartingDownload: isStarting })),
|
||||
setSelectedDownloadFormat: (format) => set(() => ({ selectedDownloadFormat: format })),
|
||||
setSelectedCombinableVideoFormat: (format) => set(() => ({ selectedCombinableVideoFormat: format })),
|
||||
setSelectedCombinableAudioFormat: (format) => set(() => ({ selectedCombinableAudioFormat: format })),
|
||||
setSelectedSubtitles: (subtitles) => set(() => ({ selectedSubtitles: subtitles })),
|
||||
setSelectedPlaylistVideoIndex: (index) => set(() => ({ selectedPlaylistVideoIndex: index })),
|
||||
setDownloadConfigurationKey: (key, value) => set((state) => ({
|
||||
downloadConfiguration: {
|
||||
...state.downloadConfiguration,
|
||||
[key]: value
|
||||
}
|
||||
})),
|
||||
setDownloadConfiguration: (config) => set(() => ({ downloadConfiguration: config })),
|
||||
resetDownloadConfiguration: () => set(() => ({
|
||||
downloadConfiguration: {
|
||||
output_format: null,
|
||||
embed_metadata: null,
|
||||
embed_thumbnail: null,
|
||||
custom_command: null
|
||||
}
|
||||
})),
|
||||
setIsErrored: (isErrored) => set(() => ({ isErrored: isErrored })),
|
||||
setIsErrorExpected: (isErrorExpected) => set(() => ({ isErrorExpected: isErrorExpected })),
|
||||
setErroredDownloadId: (downloadId) => set(() => ({ erroredDownloadId: downloadId })),
|
||||
@@ -154,6 +177,8 @@ export const useSettingsPageStatesStore = create<SettingsPageStatesStore>((set)
|
||||
use_aria2: false,
|
||||
use_force_internet_protocol: false,
|
||||
force_internet_protocol: 'ipv4',
|
||||
use_custom_commands: false,
|
||||
custom_commands: [],
|
||||
// extension settings
|
||||
websocket_port: 53511
|
||||
},
|
||||
@@ -212,6 +237,8 @@ export const useSettingsPageStatesStore = create<SettingsPageStatesStore>((set)
|
||||
use_aria2: false,
|
||||
use_force_internet_protocol: false,
|
||||
force_internet_protocol: 'ipv4',
|
||||
use_custom_commands: false,
|
||||
custom_commands: [],
|
||||
// extension settings
|
||||
websocket_port: 53511
|
||||
},
|
||||
@@ -245,4 +272,4 @@ export const useLogsStore = create<LogsStore>((set) => ({
|
||||
setLogs: (logs) => set(() => ({ logs })),
|
||||
addLog: (log) => set((state) => ({ logs: [...state.logs, log] })),
|
||||
clearLogs: () => set(() => ({ logs: [] }))
|
||||
}));
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user