douban.fm 命令行版

2017-06-27 09:04:09 +08:00
 waterlife

doubanfm

douban.fm

这是最近学 js/node.js 做的练手项目。由于 js 目前并不是主要工作语言,所以代码可能不太好看,不过功能使用是没什么大问题的。

截屏

功能特性

依赖

安装

命令行启动

快捷键

仅在 mac 上做过运行测试。由于一些限制,在 iTerm 上运行会比较完美。

2816 次点击
所在节点    分享创造
18 条回复
hsmocc
2017-06-27 09:27:06 +08:00
个人感觉丢进垃圾桶 d 比较合适,还可以绑定光标上下键
waterlife
2017-06-27 10:07:33 +08:00
@hsmocc 丢垃圾桶 d 这个快捷键确实不错,回头加上。
liujiangbei
2017-06-27 16:02:14 +08:00
出错了,Nodejs8.1.2
waterlife
2017-06-27 16:37:15 +08:00
@liujiangbei 我使用的也是 Node.js 8.1.2,没有问题。有什么出错提示吗?
liujiangbei
2017-06-27 20:35:47 +08:00
@waterlife 提示

events.js:182
throw er; // Unhandled 'error' event
^

Error: spawn mplayer ENOENT
at exports._errnoException (util.js:1016:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:189:19)
at onErrorNT (internal/child_process.js:366:16)
at _combinedTickCallback (internal/process/next_tick.js:102:11)
at process._tickCallback (internal/process/next_tick.js:161:9)
at Function.Module.runMain (module.js:607:11)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3

我的系统升级到了 10.13 develop 版本
waterlife
2017-06-27 20:38:29 +08:00
@liujiangbei #5 你是不是没安装 mplayer ?
liujiangbei
2017-06-27 20:44:23 +08:00
@waterlife mplayer 怎么安装,没有用过这个东西?
liujiangbei
2017-06-27 20:47:10 +08:00
@waterlife 你的 package.json 里边不是已经指定了 mplayer 吗?我还需要 brew install mplayer 安装是吗?

{
"name": "doubanfm",
"version": "0.1.4",
"description": "Command line interface player of douban.fm",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"douban.fm": "node ./index.js"
},
"bin": {
"doubanfm": "./index.js"
},
"author": "",
"license": "MIT",
"dependencies": {
"chalk": "^1.1.3",
"cookie": "^0.3.1",
"log": "^1.4.0",
"mplayer": "^2.1.0",
"opn": "^5.0.0",
"readline-sync": "^1.4.7",
"superagent": "^3.5.2",
"term-img": "^1.0.0",
"term-list-scrollable": "^0.1.3",
"underscore": "^1.8.3"
}
}
waterlife
2017-06-27 20:49:33 +08:00
@liujiangbei #7 推荐安装方式: brew install mplayer
liujiangbei
2017-06-27 20:51:36 +08:00
@waterlife 好的,我试试。
hwding
2017-06-27 23:00:09 +08:00
nodejs 外行问一句,这个能停留在一页上的操作面板是怎么实现的。
mingyun
2017-06-27 23:45:29 +08:00
貌似不支持 win

$ doubanfm
d:\nodejs\node_modules\doubanfm\lib\fm.js:79
async run() {
^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (d:\nodejs\node_modules\doubanfm\index.js:3:10)
at Module._compile (module.js:570:32)
morethansean
2017-06-28 00:43:39 +08:00
@mingyun 升级到 8.x.
waterlife
2017-06-28 09:14:11 +08:00
@mingyun windows 没做测试。但是看你的报错,应该是 Node.js 版本过低的原因。因为项目使用了 async/await 语法,所以 Node.js 至少要求 7.6+。
waterlife
2017-06-28 09:17:13 +08:00
@hwding 你可以看看这个库: https://github.com/tj/node-term-list
liujiangbei
2017-06-28 10:10:22 +08:00
@waterlife OK 了,我一开始进入的时候没有登录,现在想要登录怎么搞?
liujiangbei
2017-06-28 10:13:10 +08:00
@waterlife 看了你的源码,自己弄好了,挺有意思的,这个工具。
LeoEatle
2017-06-28 14:08:54 +08:00
不错不错!超喜欢 douban.fm

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/371285

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX