Ruby on Rails:获取媒体播放器信息(iTunes、TRAKTOR、Cog;当前歌曲和播放列表)
我想编写一个小型 Web 应用程序来执行以下操作:
- 提供一个网页来显示当前歌曲,一些元数据
- 提供一个 Web api,可以查询下一首歌曲以允许页面更新而无需页面加载
没什么大不了的,我唯一无法估计的是是否可以访问 iTunes< 的当前歌曲/a>, TRAKTOR如果可能的话,来自 ruby on Rails 应用程序的 Cog 。
如果我也可以访问播放列表并显示以下歌曲,那就太好了。
I want to write a small web app which does this things:
- deliver a web page to display the current song and some meta data
- provide a web api which can be queried for the next song to allow the page to update without page load
No big deal, the only part I can't estimate is if it's possible to access the current song of iTunes, TRAKTOR and if possible Cog from a ruby on rails application.
It would be especially nice if I can access the playlist, too to display the following song, too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会通过命令行使用 applescript。我没有 Traktor Pro 或 Coq,但您可以通过 OS X 脚本编辑器中的 AppleScript 字典查看器查看可用的对象。对于 iTunes,命令为:
您可以从 Rails 应用程序(需要以您的用户帐户运行)执行命令,如下所示:
...
I would use applescript via the command-line. I don't have Traktor Pro or Coq, but you can look at what objects are available via the AppleScript Dictionary viewer in OS X's Script Editor. For iTunes, the command would be:
You would execute the command from your rails app (which would need to be running as your user account) like this:
...
Traktor 只能通过两种方式访问名称:
方法是欺骗它认为已连接恶魔设备,捕获 MIDI 输出数据并通过此 JavaScript https://github.com/Sonnenstrahl/traktor-now-playing
Traktor you can only access the names via two ways:
https://github.com/Sonnenstrahl/traktor-now-playing
我从来没有听说过你提到的另外两个播放器,但是有了 iTunes,这绝对是可能的。例如,看看这个项目:http://code.google.com/p/itunes-rails /
应该有一个可以与 iTunes 通信的脚本桥。不过不确定其他球员的情况。
I've never even heard of the other two players you are mentioning, but with iTunes this is definitely possible. Look at this project for example: http://code.google.com/p/itunes-rails/
There should be a scripting bridge that can communicate with iTunes. Not sure about the other players, though.