View Single Post
  #142  
Old 04.08.2017, 03:01
Lpxatreyu
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by mgpai View Post
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;
    });
}
Firstly I really appreciate for your fast support sir!
I forgot to mention about little change about my question.How about if i just want to change time i meant put minutes as 02:20 AM or 07:44 like this ?
Thank you for all of you !
Reply With Quote