nut
nut copied to clipboard
[Feature] Auto scan intervals
Hi, I use NUT on my windows server with gdrive mounted to that machine to serv the files remotely to my tinfoil at home.
I have to manually press the scan button every day to pick up new files, an option to have this automatically rescan would be awesome, thanks.
Call the scan api periodically https://github.com/blawar/nut/blob/master/Server/Controller/Api.py#L84
Call the scan api periodically https://github.com/blawar/nut/blob/master/Server/Controller/Api.py#L84 after looking into this some, I see what you mean. i will see if I can do this via a timed batch file, thanks.
i think the API requests should be documented more <3
If you're using nodejs and have the nut server running, for example:
function apiCall(path){
return new Promise((resolve, reject) => {
axios({
method:'get',
url:`http://127.0.0.1:${NUT_PORT}/api/${path}`,
auth: {
username: config.NUT_USER,
password: config.NUT_PASS
},
})
.then(function (response) {
resolve(response.data);
})
.catch(function (error) {
reject(error);
});
})
}
console.log('Scanning local nut files...')
try{
await apiCall('scan')
}catch (e) {
console.error('Failed', e)
}
I'll second adding autoscan. Having to run an external script to trigger scanning is not always feasible.