let moment=require('moment')
let PlayerDB=require('../PlayerDB')
let db=new PlayerDB()
global.db=db;
global.deviceID=7786
//global.deviceID=7784

main();


async function main() {
    await db.initsync()
    db.on(db.eventTypes.Schedules_Details_Changed,(files)=>{
        console.log('Schedules_Details_Changed',files)
    })

    let schedulesDB=require('../schedulesDB')
    let schedules=new schedulesDB({db})
    //await schedules.updateScheduleFileDownloadedStatus(true,'0152c07a-c3ab-4a6e-b8bc-cb4144fa1f8d.mp3')

    var q=await schedules.getSchedulesToPlay()
    var q2=await db.getAvailablePlayTime()
    // var startTime=q.startTime.isAfter(q2.startTime)?q.startTime:q2.startTime
    // var endTime=q.endTime.isAfter(q2.endTime)?q.endTime:q2.endTime
    //var q3=db.IsNowOkForPlayback(q2.startTime,q2.endTime)
    console.log('bitti')
}