我正在尝试开发一款办公室音乐播放器,需要与restful API相关。简而言之,该API将能够从YouTube下载音乐并将其加载到正在运行的MPD实例的当前播放列表中。我还希望能够通过API控制播放/音量。以下是我目前的想法:
Endpoint: /queue
Methods:
GET: Gets the current MPD playlist
POST: Accepts JSON with these arguments:
source-type: specify the type of the source of the music (usually youtube, but i might want to expand later to support pulling from soundcloud, etc)
source-desc: Used in conjunction with source-type, ie, if source-type were youtube, this would be a youtube search query
It would use these arguments to go out and find the song you want and put it in the queue
DELETE: Would clear the queue
Endpoint: /playbackcontrol
Methods:
GET: Returns volume, whether playing, paused, or stopped, etc
POST: Accepts JSON with these arguments:
operation: describe the operation you want (ie, next, previous, volume adjust)
optional_value: value for operations that need a value (like volume)
所以,这就是我目前的想法。我知道这非常高级,我只是想获得一些反馈,看看我是否走在正确的方向上。这个实现API的方式看起来可行吗?