OnFileDropEx
{
    _playlist = (".avi", ".mp4", ".mov", ".mkv", ".flv", ".ogg", ".rm", ".rmvb", ".wmv" ,".aac" , ".mp3" ,".flac", ".mid", ".blv", ".wav", ".mpg")
    _fialist = (".png", ".jpg", ".jpeg", ".bmp", ".ico", ".psd")
    _file = reference0;
    _fileext = TOLOWER(SPLITPATH(_file)[3]);
    _filename = SPLITPATH(_file)[2] + _fileext;

    foreach _playlist ; _tmp{
        if _fileext _in_ _tmp
        {
            musicbox = 4
            Onmusicplay(_file)
            return
        }
    }

}



//————————————————————————————————
//***************************音乐盒**************************************
//旧函数名：Choice.wisledio
Choice.wisledio    //最新写法：\![sound,stop]\![sound,wait]\_q……\_q\![sound,play……
{
    musicbox = 0
    --
    playerhead
    --
    playerbody
}
Choice.sttop
{
    playerhead
    --
    playerbody
}

playerhead
{ "\![sound,stop]\![sound,wait]" }
playerbody
{
    "\_q\*\![set,autoscroll,disable]"
    --
    reference0 = playtitle
    if musicbox == 1 ; Onokalist(reference0)
    elseif musicbox == 2 ; Onwaslist
    --
    "\0\s[%(bsus)]\b[0]\f[name,%(zitai)]"
    --
    if musicbox == 1 ; "音乐盒"
    elseif musicbox == 2 ; "我的喜歡"
    elseif musicbox == 4 ; "播放中"
    else ;  "音乐列表"
    --
    _lem = 0
    if "Onlikethis" _in_ wismamu ; _lem = GETSTRBYTES(SPLIT(wismamu,"\q")[0],1)+2
    else ; _lem = GETSTRBYTES(wismamu,1)
    " - > \f[bold,1]%(wismamu)\f[bold,0]%(EXIF((_lem > 32),'\n','    '))音量：【%(palvol)】\n\n[half]/
    \![*]\q[停止,sttop]\_l[75,-]\![*]\q[播放,Onmusicplay]/
    \_l[150,-]\![*]\q[循环,Onmusicloop,默认不会自动循环]\_l[225,-]\![*]\q[音量＋,Onmusicvol,10]\_l[300,-]\![*]\q[音量－,Onmusicvol,-10]\n[half]/
    %(EXIF(playtext,'\n'+playtext))/
    \n\![*]\q[返回,randtitle]\_l[60,-]%(Openplayname(playname))/
    \_q"
}
Openplayname
{
_list = SPLITPATH(_argv[0])
if RE_GREP(_argv[0],"^http") ; "\![*]\q[打开连接,OnOpenlink,%(_argv[0])]"
elseif _list[3] {
_pl = REPLACE(_list[2],',','\,')
_pl = REPLACE(_pl,']','\]')
_pl += _list[3]
_nl = REPLACE(_list[1],',','\,')
_nl = REPLACE(_nl,']','\]')
_nu = _list[0]+_nl+_pl
_nul = SPLIT(_nu,"\%(_pl)")
"\![*]\q[打开文件,OnOpenfile,%(_nu)]\_l[150,-]\![*]\q[打开文件夹,OnOpenfile,%(_nul)]"
}}

Onmusicplay
{
    playerhead
    --
    if _argv[0]
    {
        playname = _argv[0]
        wismamu = SPLITPATH(playname)[2]
        playtext = ""
    }
    elseif reference0
    {
        playname = reference0
        wismamu = SPLITPATH(playname)[2]
        playtext = ""
    }
    if TOINT(_argv[1])
    { palvol = _argv[1] }
    elseif TOINT(reference1)
    { palvol = reference1 }
    --
    playerbody
    --
    _play = REPLACE(playname,',','\,');
    _play = REPLACE(_play,']','\]');
     "\![sound,play,%(_play),--volume=%(palvol)]"
}
Onmusicloop
{
    playerhead
    --
    playerbody
    --
    if playname {
    _play = REPLACE(playname,',','\,');
    _play = REPLACE(_play,']','\]');
    "\![sound,loop,%(_play),--volume=%(palvol)]"
    }
}
Onmusicvol
{
    if TOINT(reference0) ; palvol += reference0
    elseif TOINT(_argv[0]) ; palvol += _argv[0]
    if palvol < 0 ; palvol = 0
    if palvol > 100 ; palvol = 100
    _play = REPLACE(playname,',','\,');
    _play = REPLACE(_play,']','\]');
    "\![sound,load,%(_play),--volume=%(palvol)]"
    --
    reference0 = playtitle
    playerbody
}

Choice.randtitle
{
    "\0\s[%(bsus)]\b[0]\f[name,%(zitai)]\*\_q\![*]\![*]音乐盒"
    --
    if !musicpage { "\_l[150,-]\![*]\![*]\q[下一页->,rndi1]\n/
    \_l[15,-]\![*]\q[優しい・癒しの曲,Onokalist,優しい・癒しの曲]\_l[215,-]\![*]\q[可愛いらしい,Onokalist,可愛いらしい]\n/
    \_l[15,-]\![*]\q[バトル・戦争,Onokalist,バトル・戦争]\_l[215,-]\![*]\q[壮大・雄大,Onokalist,壮大・雄大]\n/
    \_l[15,-]\![*]\q[オープニング,Onokalist,オープニング]\_l[215,-]\![*]\q[近未来的,Onokalist,近未来的]\n/
    \_l[15,-]\![*]\q[神秘的・幻想的,Onokalist,神秘的・幻想的]\_l[215,-]\![*]\q[北欧風・ケルティック,Onokalist,北欧風・ケルティック]\n/
    " }
    elseif musicpage == 1 { "\_l[150,-]\![*]\![*]\q[<-上一页,rndi0]\n/
    \_l[15,-]\![*]\q[和風・アジアンテイスト,Onokalist,和風・アジアンテイスト]\_l[215,-]\![*]\q[激しい・勇壮な曲,Onokalist,激しい・勇壮な曲]\n/
    \_l[15,-]\![*]\q[緊張感・サスペンス,Onokalist,緊張感・サスペンス]\_l[215,-]\![*]\q[ホラー曲,Onokalist,ホラー曲]\n/
    \_l[15,-]\![*]\q[哀しい・切ない曲,Onokalist,哀しい・切ない曲]\_l[215,-]\![*]\q[楽しい・明るい曲,Onokalist,楽しい・明るい曲]\n/
    \_l[15,-]\![*]\q[新規追加曲,Onokalist,新規追加曲]\n/
    " }
    --
    "\![*]\![*]\![*]\q[我喜歡的,Onwaslist]\_l[150,-]\![*]\![*]\q[正在播放,Onplaybox]\_l[280,-]\![*]\![*]\q[返回,pamamu]\_q\e"
}
Choice.rndi1
{ musicpage = 1 ; Choice.randtitle }
Choice.rndi0
{ musicpage = 0 ; Choice.randtitle }
Onplaybox
{ playerbody }

//******************音乐盒
//****okalist('title')
Onokalist
{
    musicbox = 1
    if reference0 ; playtitle = reference0
    if !playtitle && reference0 == 1; playtitle = "神秘的・幻想的"
    
    if !SAORI(sqloridllpath,"OPEN",'sqlori.db') { "\f[name,%(zitai)]打开数据库出错" ; UNLOADLIB(sqloridllpath) ; return ; }
    _ans = "\1\s[10]\b[4]\f[name,%(zitai)]\![set,autoscroll,disable]\![*]\![*]%(playtitle)\n\n[half]"
    _eres = SAORI(sqloridllpath, 'EXEC', "SELECT id,name,like FROM musicoka WHERE title = '%(playtitle)' ORDER BY RANDOM() LIMIT 15;")
    _values = SPLIT(_eres, '0IDnamelike');
    if ARRAYSIZE(_values) >= 2
    {
        _values = SPLIT(_values[1], '');
        _lem = ARRAYSIZE(_values)
        _id = ""
        _name = ""
        _like = ""
        for _i = 0; _i < _lem; _i++ {
            if _i%3 == 0
            {    _id = _values[_i] }
            elseif _i%3 == 1
            {    _name = _values[_i] }
            elseif _i%3 == 2
            {    if _values[_i] == 1 ; _like = "\q[♥,Onlikethis,%(_id),0,%(playtitle)]"
                else ; _like = "\q[❤,Onlikethis,%(_id),1,%(playtitle)]"
                _ans = _ans+ "\![*]\q[%(_name),Onmusicoka,%(_id)]" + _like + "\n"
            }
        }
    }
    _ans+"\n[half]\![*]\q[返回,randtitle]"
    void SAORI(sqloridllpath,"CLOSE",'sqlori.db') 
    UNLOADLIB(sqloridllpath)
}
//******************音乐盒播放
Onmusicoka
{

    _id = reference0
    
    if !SAORI(sqloridllpath,"OPEN",'sqlori.db') { "\f[name,%(zitai)]打开数据库出错" ; UNLOADLIB(sqloridllpath) ; return ; }
    _ans = "\1\s[10]\b[4]\f[name,%(zitai)]\![set,autoscroll,disable]\![*]\![*]%(playtitle)\n\n[half]"
    _eres = SAORI(sqloridllpath, 'EXEC', "SELECT address,name,text,like FROM musicoka WHERE id = %(_id)")

    _address = 'https://musicoka.oss-cn-guangzhou.aliyuncs.com/'
    _name = ""
    _text = ""
    _like= ""
    _values = SPLIT(_eres, '0addressnametextlike');
    if ARRAYSIZE(_values) >= 2
    {
        _values = SPLIT(_values[1], '');
        _lem = ARRAYSIZE(_values)

        for _i = 0; _i < _lem; _i++ {
            if _i%4 == 0
            {    _address += _values[_i] }
            elseif _i%4 == 1
            {    _name = _values[_i] }
            elseif _i%4 == 2
            {    _text = _values[_i] }
            elseif _i%4 == 3
            {    if _values[_i] == 1 ; _like = "\q[♥,Onlikethis,%(_id),0,%(playtitle)]"
            else ; _like = "\q[❤,Onlikethis,%(_id),1,%(playtitle)]"
            _ans = _ans+ "\![*]\q[%(_name),Onmusicoka,%(_id)]" + _like + "\n"
            }
        }
        wismamu = _name+_like
        playtext = _text
        playname = _address
        reference0 = playname
        --
        playerhead
        --
        playerbody
        --
         "\![sound,play,%(playname),--volume=%(palvol)]"
    }
    void SAORI(sqloridllpath,"CLOSE",'sqlori.db') 
    UNLOADLIB(sqloridllpath)
}

//****************************添加喜歡
Onlikethis
{
    _id = reference0
    
    if !SAORI(sqloridllpath,"OPEN",'sqlori.db') { "\f[name,%(zitai)]打开数据库出错" ; UNLOADLIB(sqloridllpath) ; return ; }
    if reference1 ; void SAORI(sqloridllpath,'EXEC', "UPDATE musicoka SET like='1' WHERE id = %(_id);")
    else ; void SAORI(sqloridllpath,'EXEC', "UPDATE musicoka SET like='0' WHERE id = %(_id);")
    void SAORI(sqloridllpath,"CLOSE",'sqlori.db') 
    UNLOADLIB(sqloridllpath)
    likethis2(_id)
}
//****************************添加喜歡返回列表
likethis2
{
    _id = reference0
    
    if !SAORI(sqloridllpath,"OPEN",'sqlori.db') { "\f[name,%(zitai)]打开数据库出错" ; UNLOADLIB(sqloridllpath) ; return ; }
   _eres = SAORI(sqloridllpath,'EXEC', "SELECT name,like FROM musicoka WHERE id = %(_id);")
    _name = ""
    _like = ""
    _values = SPLIT(_eres, '0namelike');
    if ARRAYSIZE(_values) >= 2
    {
        _values = SPLIT(_values[1], '');
        _lem = ARRAYSIZE(_values)
        
        for _i = 0; _i < _lem; _i++ {
            if _i%2 == 0
            {    _name += _values[_i] }
            elseif _i%2 == 1
            {    if _values[_i] == 1 ; _like = "\q[♥,Onlikethis,%(_id),0]"
            else ; _like = "\q[❤,Onlikethis,%(_id),1]"
            }
        }
        
    }
    void SAORI(sqloridllpath,"CLOSE",'sqlori.db') 
    UNLOADLIB(sqloridllpath)
    if _name _in_ wismamu ; wismamu = _name+ _like
    reference0 = playtitle
    playerbody
}


//****************************我的音樂
Onwaslist
{
    musicbox = 2
    
    if !SAORI(sqloridllpath,"OPEN",'sqlori.db') { "\f[name,%(zitai)]打开数据库出错" ; UNLOADLIB(sqloridllpath) ; return ; }
    _ans = "\1\s[10]\b[4]\![set,autoscroll,disable]\f[name,%(zitai)]\![*]\![*]我的音樂\n\n[half]"
    _eres = SAORI(sqloridllpath,'EXEC', "SELECT id,name,like FROM musicoka WHERE like = '1';")
    _id = ""
    _name = ""
    _like = ""
    _values = SPLIT(_eres, '0IDnamelike');
    if ARRAYSIZE(_values) >= 2
    {
        _values = SPLIT(_values[1], '');
        _lem = ARRAYSIZE(_values)
        
        for _i = 0; _i < _lem; _i++ {
            if _i%3 ==  0
            {    _id = _values[_i] }
            elseif _i%3 == 1
            {    _name = _values[_i] }
            elseif _i%3 == 2
            {    if _values[_i] == 1 ; _like = "\q[♥,Onlikethis,%(_id),0]"
                else ; _like = "\q[❤,Onlikethis,%(_id),1]"
                _ans = _ans+ "\![*]\q[%(_name),Onmusicoka,%(_id)]" + _like + "\n"
            }
        }
        reference0 = playtitle
    }else{
        _ans = _ans+ "\![*]你沒有收藏任何歌曲"
    }
    _ans+"\n[half]\n\![*]\q[返回,randtitle]"
    void SAORI(sqloridllpath,"CLOSE",'sqlori.db') 
    UNLOADLIB(sqloridllpath)
}



