Skip to content

separated the path to the database from the path to the download output#140

Open
therrealdude wants to merge 2 commits into
patrickkfkan:masterfrom
therrealdude:therrealdude-add-db-folder
Open

separated the path to the database from the path to the download output#140
therrealdude wants to merge 2 commits into
patrickkfkan:masterfrom
therrealdude:therrealdude-add-db-folder

Conversation

@therrealdude

@therrealdude therrealdude commented May 26, 2026

Copy link
Copy Markdown

Hello,

I had a use case where I needed the database to be in a separate folder from the downloaded content. In my use case, I was trying to backup the data to a Samba share which was not playing well with SQLite. To fix this, I created a new command line argument, db-dir, to specify where the database should be saved. I created a pull request because I believe that this could be a common use case for others who want to backup content to a Samba share, NAS, ZFS share or whatever else there is.

@patrickkfkan patrickkfkan left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I have made some comments. Also, how would this affect the browse (web server) functionality? I see no changes to the server code.

Comment thread src/utils/logging/FileLogger.ts Outdated
export interface DownloaderFileLoggerInit {
targetURL: string;
outDir?: string;
dbDir?: string;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of having dbDir here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like nothing. It is removed now.

Comment thread src/cli/index.ts
Comment on lines +408 to -467
console.log('Proceeding...', EOL);
if (postConfirm) {
postConfirm();
}
}
else {
__logBegin();
commonLog(logger, 'debug', null, `Created ${downloaderName} instance with config: `, this.#getDisplayConfig(downloader.getConfig()));
if (index === 0) {
__checkProxy();
__checkDeno();
}
}

let hasDownloaderError = false;
let isAborted = false;
let endMessage = '';
downloader.on('end', ({ aborted, error, message }) => {
if (aborted) {
commonLog(logger, 'info', null, `${downloaderName} aborted`);
isAborted = true;
}
else if (!error) {
commonLog(logger, 'info', null, `${downloaderName} end`);
}
else {
commonLog(logger, 'warn', null, `${downloaderName} end with error`);
hasDownloaderError = true;
}
endMessage = message;
});

try {
const abortController = new AbortController();
const abortHandler = () => {
abortController.abort();
};
process.on('SIGINT', abortHandler);
await downloader.start({ signal: abortController.signal });
await logger.end();
process.off('SIGINT', abortHandler);
return { hasError: hasDownloaderError, aborted: isAborted, endMessage };
}
catch (error) {
commonLog(logger, 'error', null, `Uncaught ${downloaderName} error:`, error);
return { hasError: true, aborted: isAborted, endMessage: 'Uncaught error' };
}
}

#confirmProceed(prompt?: PromptSync.Prompt): boolean {
if (!prompt) {
prompt = PromptSync({ sigint: true });
}
const confirmProceed = prompt('Proceed (Y/n)? ');
if (!confirmProceed.trim() || confirmProceed.trim().toLowerCase() === 'y') {
return true;
try {
if (!prompt) {
prompt = PromptSync({ sigint: true });
console.log();
}
const confirmProceed = prompt('Proceed (Y/n)? ');
if (!confirmProceed.trim() || confirmProceed.trim().toLowerCase() === 'y') {
console.log('Proceeding...', EOL);
return true;
}
else if (confirmProceed.trim().toLowerCase() === 'n') {
return false;
}

return this.#confirmProceed(prompt);
}
else if (confirmProceed.trim().toLowerCase() === 'n') {
catch (error) {
console.error('Error obtaining user input: ', error instanceof Error ? error.message : error);
return false;
}

return this.#confirmProceed(prompt);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes do not appear to be related to the dbDir feature. If they are unrelated, please move them into a separate PR.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed with my latest update

@therrealdude

Copy link
Copy Markdown
Author

Thanks. I have made some comments. Also, how would this affect the browse (web server) functionality? I see no changes to the server code.

I just added some code to give the server the same functionality so the user can define the path for the database. Thanks for the feedback. Let me know if you think any more changes would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants