mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2026-06-10 04:13:44 +05:30
feat: added option to remove download id from filename #35
This commit is contained in:
@@ -309,6 +309,7 @@ function AppFilesystemSettings() {
|
||||
const filenameTemplate = useSettingsPageStatesStore(state => state.settings.filename_template);
|
||||
const windowsFilenames = useSettingsPageStatesStore(state => state.settings.windows_filenames);
|
||||
const restrictFilenames = useSettingsPageStatesStore(state => state.settings.restrict_filenames);
|
||||
const uniqueFilenames = useSettingsPageStatesStore(state => state.settings.unique_filenames);
|
||||
|
||||
const downloadStates = useDownloadStatesStore(state => state.downloadStates);
|
||||
const ongoingDownloads = downloadStates.filter(state =>
|
||||
@@ -462,6 +463,15 @@ function AppFilesystemSettings() {
|
||||
</form>
|
||||
</Form>
|
||||
</div>
|
||||
<div className="unique-filenames">
|
||||
<h3 className="font-semibold">Unique Filenames</h3>
|
||||
<p className="text-xs text-muted-foreground mb-3">Make filenames unique by appending download ID, playlist index at the end of the filename (recommended, disabling it may cause issue with some downloads, also it may cause paused downloads to re-start from begining)</p>
|
||||
<Switch
|
||||
id="unique-filenames"
|
||||
checked={uniqueFilenames}
|
||||
onCheckedChange={(checked) => saveSettingsKey('unique_filenames', checked)}
|
||||
/>
|
||||
</div>
|
||||
<div className="sanitize-filenames">
|
||||
<h3 className="font-semibold">Sanitize Filenames</h3>
|
||||
<p className="text-xs text-muted-foreground mb-3">Make filenames windows-compatible, allow only ASCII characters and replace spaces with underscore (recommended, disabling it may cause issue with some downloads, also it may cause paused downloads to re-start from begining)</p>
|
||||
|
||||
@@ -74,7 +74,8 @@ export default function useDownloader() {
|
||||
disable_innertube: DISABLE_INNERTUBE,
|
||||
pot_server_port: POT_SERVER_PORT,
|
||||
windows_filenames: WINDOWS_FILENAMES,
|
||||
restrict_filenames: RESTRICT_FILENAMES
|
||||
restrict_filenames: RESTRICT_FILENAMES,
|
||||
unique_filenames: UNIQUE_FILENAMES,
|
||||
} = useSettingsPageStatesStore(state => state.settings);
|
||||
const isRunningPotServer = useSettingsPageStatesStore(state => state.isRunningPotServer);
|
||||
|
||||
@@ -349,9 +350,17 @@ export default function useDownloader() {
|
||||
}
|
||||
|
||||
if (isMultiplePlaylistItems) {
|
||||
args.push('--output', `%(playlist_title|Unknown)s[${downloadId}]/[%(playlist_index|0)d]_${FILENAME_TEMPLATE}.%(ext)s`);
|
||||
if (UNIQUE_FILENAMES) {
|
||||
args.push('--output', `%(playlist_title|Untitled)s[${downloadId}]/[%(playlist_index|0)d]_${FILENAME_TEMPLATE}.%(ext)s`);
|
||||
} else {
|
||||
args.push('--output', `%(playlist_title|Untitled)s/${FILENAME_TEMPLATE}.%(ext)s`);
|
||||
}
|
||||
} else {
|
||||
if (UNIQUE_FILENAMES) {
|
||||
args.push('--output', `${FILENAME_TEMPLATE}[${downloadId}].%(ext)s`);
|
||||
} else {
|
||||
args.push('--output', `${FILENAME_TEMPLATE}.%(ext)s`);
|
||||
}
|
||||
}
|
||||
|
||||
if (WINDOWS_FILENAMES) {
|
||||
|
||||
@@ -204,7 +204,7 @@ export const useSettingsPageStatesStore = create<SettingsPageStatesStore>((set)
|
||||
force_internet_protocol: 'ipv4',
|
||||
use_custom_commands: false,
|
||||
custom_commands: [],
|
||||
filename_template: '%(title|Unknown)s_%(resolution|unknown)s',
|
||||
filename_template: '%(title|Untitled)s_%(resolution|unknown)s',
|
||||
debug_mode: false,
|
||||
log_verbose: true,
|
||||
log_progress: false,
|
||||
@@ -223,6 +223,7 @@ export const useSettingsPageStatesStore = create<SettingsPageStatesStore>((set)
|
||||
pot_server_port: 4416,
|
||||
windows_filenames: true,
|
||||
restrict_filenames: true,
|
||||
unique_filenames: true,
|
||||
quit_on_close: false,
|
||||
// extension settings
|
||||
websocket_port: 53511
|
||||
@@ -292,7 +293,7 @@ export const useSettingsPageStatesStore = create<SettingsPageStatesStore>((set)
|
||||
force_internet_protocol: 'ipv4',
|
||||
use_custom_commands: false,
|
||||
custom_commands: [],
|
||||
filename_template: '%(title|Unknown)s_%(resolution|unknown)s',
|
||||
filename_template: '%(title|Untitled)s_%(resolution|unknown)s',
|
||||
debug_mode: false,
|
||||
log_verbose: true,
|
||||
log_progress: false,
|
||||
@@ -311,6 +312,7 @@ export const useSettingsPageStatesStore = create<SettingsPageStatesStore>((set)
|
||||
pot_server_port: 4416,
|
||||
windows_filenames: true,
|
||||
restrict_filenames: true,
|
||||
unique_filenames: true,
|
||||
quit_on_close: false,
|
||||
// extension settings
|
||||
websocket_port: 53511
|
||||
|
||||
@@ -66,6 +66,7 @@ export interface Settings {
|
||||
pot_server_port: number;
|
||||
windows_filenames: boolean;
|
||||
restrict_filenames: boolean;
|
||||
unique_filenames: boolean;
|
||||
quit_on_close: boolean;
|
||||
// extension settings
|
||||
websocket_port: number;
|
||||
|
||||
Reference in New Issue
Block a user