Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

异步取歌URL&歌词的想法 #11

Open
Copay opened this issue Feb 25, 2017 · 0 comments
Open

异步取歌URL&歌词的想法 #11

Copay opened this issue Feb 25, 2017 · 0 comments

Comments

@Copay
Copy link
Member

Copay commented Feb 25, 2017

Description

从某个网址取得 歌曲URL & 歌词(以及歌词翻译)内容.
可以通过某个函数对从网址取得的内容进行处理, 函数返回值应为 歌曲URL / LRC 内容

Example

/**
  * callback Function
  * @param {string} content 通过 AJAX or fetch 获取的内容
  * @returns {string} 纯粹的内容
  */
function(content){
    //......
    return results;
}

TODO

目前想法,在构造函数的 list 处设置

Example

let eachList = {
    //.....
    "url":"http://", //returns a music's url
    "lyric":"http://URL", //just a lyric's url
    "transLyric":"http://URL", //optional
    "urlProcessor":
    {
         "url":(c)=>{},
         "lyric":null,
         "transLyric":(c)=>{}
    }
};
  • urlProcessor是必要的属性,urlProcessor必须为Object类型并且至少拥有一个属性.
  • urlProcessor的子属性类型必须为function or null.
  • urlProcessor的子属性类型为function时,获取到的内容将被作为一个string类型参数传入该函数,并且函数返回值将被载入options作为内容处理.
  • urlProcessor的子属性类型为null时,获取到的内容将直接被载入options作为内容处理
  • urlProcessor不存在或者urlProcessor的子属性数量为0时,对url lyric transLyric不进行操作(包括获取内容URL的内容等的一切动作),url lyric transLyric的内容将直接被使用,依次作为歌曲URL,歌曲歌词内容,歌曲歌词翻译内容

以上作为更改代码的标准.

@Copay Copay changed the title 异步取歌词的想法 异步取歌URL&歌词的想法 Feb 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant