mplug163 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/mplug163/menu.rb +33 -14
- data/lib/mplug163/ui.rb +12 -11
- data/lib/mplug163/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 437aeb99caca66003041701b9eb00fba48932117
|
4
|
+
data.tar.gz: a1bb9ccf0cba4c681059712cc6ef35d81dc19607
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d10ca1494b180e0083b1e2833c04a4092743d12d79bab3ca80ec17889bad701e3edb19710f6a54d9e07500b0ccae7b03fc7ea37c6f2a033ce1caa4be7ef1a6d
|
7
|
+
data.tar.gz: a3794c1f2a89126b003c9890f8e02c2b8e27294cc5c7d76fa8130fe4ecbea51e194879fceb76f3dba14ef1bfbab6412f47ff7ba5a999efd181ac3e7a4f405613
|
data/README.md
CHANGED
@@ -37,6 +37,7 @@ Sorry, I do not test Mplug163 in Linux. If you try it in Linux and catch some pr
|
|
37
37
|
| t | Playlist | 收藏精选歌单 |
|
38
38
|
| c | Collection | 收藏歌曲列表 |
|
39
39
|
| a | Album | 收藏专辑 |
|
40
|
+
| z | DJ Channels | 收藏 DJ 节目 |
|
40
41
|
| r | Remove Present Entry | 删除当前曲目 |
|
41
42
|
| q | Quit | 退出 |
|
42
43
|
|
data/lib/mplug163/menu.rb
CHANGED
@@ -18,6 +18,7 @@ SHORTCUT = [
|
|
18
18
|
['t', 'Playlist ', '收藏精选歌单'],
|
19
19
|
['c', 'Collection ', '收藏歌曲列表'],
|
20
20
|
['a', 'Album ', '收藏专辑'],
|
21
|
+
['z', 'DJ Channels ', '收藏 DJ 节目'],
|
21
22
|
['r', 'Remove ', '删除当前曲目'],
|
22
23
|
['q', 'Quit ', '退出']
|
23
24
|
]
|
@@ -26,7 +27,7 @@ class Menu
|
|
26
27
|
def initialize
|
27
28
|
@datatype = 'main'
|
28
29
|
@title = '网易云音乐'
|
29
|
-
@datalist = %w(排行榜 艺术家 新碟上架
|
30
|
+
@datalist = %w(排行榜 精选歌单 艺术家 新碟上架 我的歌单 DJ节目 本地收藏 搜索 帮助)
|
30
31
|
@offset = 0
|
31
32
|
@index = 0
|
32
33
|
@present_songs = []
|
@@ -136,12 +137,14 @@ class Menu
|
|
136
137
|
# Star a song, a playlist or an album.
|
137
138
|
when 's'
|
138
139
|
next if datalist.empty?
|
139
|
-
if datatype == 'songs'
|
140
|
+
if datatype == 'songs'
|
140
141
|
@collection.push(datalist[idx]).uniq!
|
141
142
|
elsif datatype == 'playlists'
|
142
143
|
@playlists.push(datalist[idx]).uniq!
|
143
144
|
elsif datatype == 'albums'
|
144
145
|
@albums.push(datalist[idx]).uniq!
|
146
|
+
elsif datatype == 'djchannels'
|
147
|
+
@djs.push(datalist[idx]).uniq!
|
145
148
|
end
|
146
149
|
|
147
150
|
# Load favorite playlists.
|
@@ -171,6 +174,15 @@ class Menu
|
|
171
174
|
@offset = 0
|
172
175
|
@index = 0
|
173
176
|
|
177
|
+
# Load favorite dj channels
|
178
|
+
when 'z'
|
179
|
+
@stack.push([datatype, title, datalist, offset, index])
|
180
|
+
@datatype = 'djchannels'
|
181
|
+
@title = '网易云音乐 > 收藏 DJ 节目'
|
182
|
+
@datalist = @djs
|
183
|
+
@offset = 0
|
184
|
+
@index = 0
|
185
|
+
|
174
186
|
# Remove an entry from the present list.
|
175
187
|
when 'r'
|
176
188
|
if (datatype != 'main') && !datalist.empty?
|
@@ -248,27 +260,27 @@ class Menu
|
|
248
260
|
@title += ' > 排行榜'
|
249
261
|
@datatype = 'songs'
|
250
262
|
|
251
|
-
#
|
263
|
+
# Playlists
|
252
264
|
when 1
|
265
|
+
playlists = netease.top_playlists
|
266
|
+
@datalist = netease.dig_info(playlists, 'playlists')
|
267
|
+
@title += ' > 精选歌单'
|
268
|
+
@datatype = 'playlists'
|
269
|
+
|
270
|
+
# Artist
|
271
|
+
when 2
|
253
272
|
artists = netease.top_artists
|
254
273
|
@datalist = netease.dig_info(artists, 'artists')
|
255
274
|
@title += ' > 艺术家'
|
256
275
|
@datatype = 'artists'
|
257
276
|
|
258
277
|
# New album
|
259
|
-
when
|
278
|
+
when 3
|
260
279
|
albums = netease.new_albums
|
261
280
|
@datalist = netease.dig_info(albums, 'albums')
|
262
281
|
@title += ' > 新碟上架'
|
263
282
|
@datatype = 'albums'
|
264
283
|
|
265
|
-
# Playlists
|
266
|
-
when 3
|
267
|
-
playlists = netease.top_playlists
|
268
|
-
@datalist = netease.dig_info(playlists, 'playlists')
|
269
|
-
@title += ' > 精选歌单'
|
270
|
-
@datatype = 'playlists'
|
271
|
-
|
272
284
|
# My playlist
|
273
285
|
when 4
|
274
286
|
# Require user's account before fetching his playlists.
|
@@ -294,7 +306,7 @@ class Menu
|
|
294
306
|
# DJ channels
|
295
307
|
when 5
|
296
308
|
@datatype = 'djchannels'
|
297
|
-
@title += ' > DJ节目'
|
309
|
+
@title += ' > DJ 节目'
|
298
310
|
@datalist = netease.djchannels
|
299
311
|
|
300
312
|
# Favorite things.
|
@@ -320,7 +332,7 @@ class Menu
|
|
320
332
|
ui = @ui
|
321
333
|
x = ui.build_favorite_menu
|
322
334
|
|
323
|
-
if (1..
|
335
|
+
if (1..4).include? x.to_i
|
324
336
|
@stack.push([@datatype, @title, @datalist, @offset, @index])
|
325
337
|
@index = 0
|
326
338
|
@offset = 0
|
@@ -343,6 +355,11 @@ class Menu
|
|
343
355
|
@datalist = @albums
|
344
356
|
@title += ' > 收藏专辑'
|
345
357
|
|
358
|
+
when '4'
|
359
|
+
@datatype = 'djchannels'
|
360
|
+
@datalist = @djs
|
361
|
+
@title += ' > 收藏 DJ 节目'
|
362
|
+
|
346
363
|
end
|
347
364
|
end
|
348
365
|
|
@@ -396,6 +413,7 @@ class Menu
|
|
396
413
|
@collection = data['collection'] || []
|
397
414
|
@playlists = data['playlists'] || []
|
398
415
|
@albums = data['albums'] || []
|
416
|
+
@djs = data['djs'] || []
|
399
417
|
end
|
400
418
|
|
401
419
|
def write_data
|
@@ -404,7 +422,8 @@ class Menu
|
|
404
422
|
:account => @account,
|
405
423
|
:collection => @collection,
|
406
424
|
:playlists => @playlists,
|
407
|
-
:albums => @albums
|
425
|
+
:albums => @albums,
|
426
|
+
:djs => @djs
|
408
427
|
}
|
409
428
|
|
410
429
|
File.open(user_file, 'w') do |f|
|
data/lib/mplug163/ui.rb
CHANGED
@@ -209,7 +209,7 @@ class Ui
|
|
209
209
|
end
|
210
210
|
|
211
211
|
when 'playlists'
|
212
|
-
artist_name = get_param('
|
212
|
+
artist_name = get_param('搜索精选歌单:')
|
213
213
|
data = @netease.search(artist_name, stype = 1000)
|
214
214
|
if data['result'].include? 'playlists'
|
215
215
|
playlists = data['result']['playlists']
|
@@ -222,9 +222,10 @@ class Ui
|
|
222
222
|
def build_favorite_menu
|
223
223
|
clear_to_bottom(@screen, PLAYER_CONTENT_Y, SCREEN_HEIGHT)
|
224
224
|
putstr(@screen, PLAYER_CONTENT_Y, PLAYER_X, '选择收藏条目类型:', Curses.color_pair(1))
|
225
|
-
putstr(@screen, PLAYER_CONTENT_Y + 1, PLAYER_X, '
|
226
|
-
putstr(@screen, PLAYER_CONTENT_Y + 2, PLAYER_X, '
|
227
|
-
putstr(@screen, PLAYER_CONTENT_Y + 3, PLAYER_X, '
|
225
|
+
putstr(@screen, PLAYER_CONTENT_Y + 1, PLAYER_X, '1 - 歌曲')
|
226
|
+
putstr(@screen, PLAYER_CONTENT_Y + 2, PLAYER_X, '2 - 精选歌单')
|
227
|
+
putstr(@screen, PLAYER_CONTENT_Y + 3, PLAYER_X, '3 - 专辑')
|
228
|
+
putstr(@screen, PLAYER_CONTENT_Y + 4, PLAYER_X, '4 - DJ 节目')
|
228
229
|
putstr(@screen, PLAYER_CONTENT_Y + 6, PLAYER_X, '请键入对应数字:', Curses.color_pair(2))
|
229
230
|
@screen.refresh
|
230
231
|
@screen.getch
|
@@ -233,10 +234,10 @@ class Ui
|
|
233
234
|
def build_search_menu
|
234
235
|
clear_to_bottom(@screen, PLAYER_CONTENT_Y, SCREEN_HEIGHT)
|
235
236
|
putstr(@screen, PLAYER_CONTENT_Y, PLAYER_X, '选择搜索类型:', Curses.color_pair(1))
|
236
|
-
putstr(@screen, PLAYER_CONTENT_Y + 1, PLAYER_X, '
|
237
|
-
putstr(@screen, PLAYER_CONTENT_Y + 2, PLAYER_X, '
|
238
|
-
putstr(@screen, PLAYER_CONTENT_Y + 3, PLAYER_X, '
|
239
|
-
putstr(@screen, PLAYER_CONTENT_Y + 4, PLAYER_X, '
|
237
|
+
putstr(@screen, PLAYER_CONTENT_Y + 1, PLAYER_X, '1 - 歌曲')
|
238
|
+
putstr(@screen, PLAYER_CONTENT_Y + 2, PLAYER_X, '2 - 艺术家')
|
239
|
+
putstr(@screen, PLAYER_CONTENT_Y + 3, PLAYER_X, '3 - 专辑')
|
240
|
+
putstr(@screen, PLAYER_CONTENT_Y + 4, PLAYER_X, '4 - 精选歌单')
|
240
241
|
putstr(@screen, PLAYER_CONTENT_Y + 6, PLAYER_X, '请键入对应数字:', Curses.color_pair(2))
|
241
242
|
@screen.refresh
|
242
243
|
@screen.getch
|
@@ -258,9 +259,9 @@ class Ui
|
|
258
259
|
|
259
260
|
def build_login_error
|
260
261
|
clear_to_bottom(@screen, PLAYER_CONTENT_Y, SCREEN_HEIGHT)
|
261
|
-
putstr(@screen, PLAYER_CONTENT_Y + 1, PLAYER_X, 'oh
|
262
|
-
putstr(@screen, PLAYER_CONTENT_Y + 2, PLAYER_X, '
|
263
|
-
putstr(@screen, PLAYER_CONTENT_Y + 3, PLAYER_X, '
|
262
|
+
putstr(@screen, PLAYER_CONTENT_Y + 1, PLAYER_X, 'oh,出现错误 Orz', Curses.color_pair(2))
|
263
|
+
putstr(@screen, PLAYER_CONTENT_Y + 2, PLAYER_X, '1 - 再试一次')
|
264
|
+
putstr(@screen, PLAYER_CONTENT_Y + 3, PLAYER_X, '2 - 稍后再试')
|
264
265
|
putstr(@screen, PLAYER_CONTENT_Y + 5, PLAYER_X, '请键入对应数字:', Curses.color_pair(2))
|
265
266
|
@screen.refresh
|
266
267
|
@screen.getch
|
data/lib/mplug163/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mplug163
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ripple Yui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|