Quote:
Originally Posted by Lpxatreyu
... need between x (02.00am) - y (08.00am) my download list start otherwise stop all download.
|
Code:
// Time based download control
// Trigger: "Interval" (Recommended: 300000 ms)
var t1 = 2; // <- Set starting Hour (0-23)
var t2 = 8; // <- Set ending Hour (0-23)
var now = new Date();
if (now > time(t1) && now < time(t2)) {
if (!isDownloadControllerRunning() && downloadsPending()) startDownloads();
} else {
if (isDownloadControllerRunning()) stopDownloads();
}
//Functions
function time(hour) {
return new Date().setHours(hour, 0, 0, 0)
}
function downloadsPending() {
return getAllDownloadLinks().some(function(link) {
return link.getFinalLinkStatus() == null;
});
}