// const bass = require('./smg/player/basswrapper').basswrapper;
// const basslib = new bass();
require('linqjs')
const moment = require('moment');
const PlayerDB = require('../db/PlayerDB');
let db

const Schedulesdb = require('../db/schedulesDB');
const Announcesdb = require('../db/announcesDB');
const SMGPush = require('../push/SMGPush');
const Utils = require('../utils/smgutils');
var schedulePlayer = require('../playerSerkan/schedulePlayer')
let announcePlayer =require('../playerSerkan/announcePlayer');
let masterMixer=require('../playerSerkan/masterMixer')
let streamPlayer=require('../playerSerkan/streamPlayer')
let AutoUpdate=require('../AutoUpdate/AutoUpdate')
let utils = new Utils(),config,  connectionUrl  ,
    retryConnect = true, announcesdb, schedulesdb,push,
    MasterMixer,schPlayer,announcesDownloader,schedulesDownloader,autoupdater;



const SchedulesDownloader = require('../downloader/schedulesDownloader');
const AnnouncesDownloader = require('../downloader/announcesDownloader');
const SSDPServer=require('../ssdp/ssdpserver')

const Bluetooth=require('../Bluetooth/bluetooth-controller')



const SSHManager=require('../ssh/sshController')
async function Main() {


    db= new PlayerDB({utils,config});
    //await config
    config =await utils.readConfig();

    global.deviceID = config.Settings.deviceID;
    global.url = config.Settings.downloadURL;

    connectionUrl = config.Settings.serviceUrl
    retryConnect = true;

    //await db init
    await db.initsync();
    global.db = db;
    schedulesdb = new Schedulesdb({ db, moment });
    announcesdb = new Announcesdb({ db, moment });










    push = new SMGPush({ connectionUrl, retryConnect, db, schedulesdb, announcesdb,utils,config });
    let sshmanager=new SSHManager({push});


    push.connect();





}

Main();
// setInterval(() => {}, 500)

