


module.exports = (path,url,format)=>{
    var command = global.dir+'/lib/youtube-dl';
    var param   = [];
    console.log(url);
    if(url.match('youtube')){
        console.log('youtube')
        switch (format) {
            case "mp3":
                param = ['-x','--audio-format','mp3','-i',url,'-o',path+'/%(title)s.%(ext)s'];
                break;
            case "mp4":
                param = ['-w','-f','bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4',url,'-o',path+'/%(title)s.%(ext)s'];
                break;
            default:

        }
    }
    else if(url.match('crunchyroll')){
        console.log('crunchyroll')
        param = ['--cookie', global.dir+'/tmp/c', '--all-subs', '--sub-format', 'srt', '--write-sub', '--embed-subs',url,'-o',path+'/%(title)s.%(ext)s'];
    }


    return [command,param];



}
