Hi DM,
Synchronet's JS object model has had bbs.batch_add_list() for a while now. With each file in the list, it has to search the whole file database to see if and where the file exists in the filebases.
Now that there is a FileBase class, I'm wondering if it would make sense for the FileBase class to have a similar batch_add function, for files just within that filebase? I've been working on a lightbar file lister, and if the user wants to add one of the files in that filebase to their batch download queue, I was thinking it might make sense for the FileBase class to have its own batch_add function, so that Synchronet wouldn't have to search through all of the filebases for that file.
If there already is such a function in the FileBase class, I'm not seeing it in the current documentation.. Maybe I missed it? http://www.synchro.net/docs/jsobjs.html#FileBase_class
No, there isn't a per-base "add to batch download queue" method (yes, I could add one pretty easily). However, the batch lists are now just .ini files (for details, see https://wiki.synchro.net/history:newfilebase#batches), so adding/removing files to the queue from a JS module should be pretty trivial. I'm pretty sure you know the File class has methods for dealing with .ini files.
Re: FileBase - Add to batch downloads?
By: Digital Man to Nightfox on Wed Jan 26 2022 01:59 pm
No, there isn't a per-base "add to batch download queue" method (yes, I could add one pretty easily). However, the batch lists are now just .ini files (for details, see https://wiki.synchro.net/history:newfilebase#batches), so adding/removing files to the queue from a JS module should be pretty trivial. I'm pretty sure you know the File class has methods for dealing with .ini files.
It looks like the bbs.batch_add_list() function (which has been around since version 3.10) is able to add files to the user's batch download list, and it seems the file format it expects is just one filename per line. Are you recommending to no longer use bbs.batch_add_list() but to write an ini file instead?
line. Are you recommending to no longer use bbs.batch_add_list() but
to write an ini file instead?
Correct. If you want to add files fast, open the appropriate file (as mentioned in that wiki article) and add the file details.
Or you can wait and I'll add a FileBase() method to do that for you, but it won't exist in v3.19b. Opening and updating the .ini file will work for v3.19b and future versions.
Sysop: | tracker1 |
---|---|
Location: | Phoenix, AZ |
Users: | 54 |
Nodes: | 25 (0 / 25) |
Uptime: | 120:23:25 |
Calls: | 367 |
Files: | 1,364 |
Messages: | 36,299 |