vkpd 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +14 -17
- data/README.md +40 -0
- data/lib/vkpd.rb +8 -7
- data/lib/vkpd/cli.rb +9 -7
- data/lib/vkpd/version.rb +1 -1
- data/vkpd.gemspec +1 -0
- metadata +18 -1
data/README
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
vkpd [options] [search request]
|
2
2
|
|
3
|
-
Requirements:
|
4
|
-
vkpd requires mpc to work and sinatra to authenticate
|
5
|
-
|
6
3
|
Options:
|
7
4
|
|
8
5
|
-c, --count=n
|
@@ -21,17 +18,17 @@ Options:
|
|
21
18
|
Add songs to current playlist instead of replacing it
|
22
19
|
|
23
20
|
Some examples:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
21
|
+
vkpd Beatles # replaces current mpd playlist with The Beatles' songs and starts playing
|
22
|
+
vkpd play Beatles # the same
|
23
|
+
vkpd add Beatles # adds found songs to playlist and starts playing
|
24
|
+
vkpd -c 5 Beatles # get just first five search results
|
25
|
+
vkpd -c 5 -o 5 beatles # get second five results
|
26
|
+
vkpd --count 5 --offset=5 beatles # the same
|
27
|
+
vkpd user 3885655 # plays user's songs
|
28
|
+
vkpd user 3885655 -c 3 # plays last three songs added by user
|
29
|
+
vkpd user # current user's songs
|
30
|
+
vkpd user -c 1 # current user's last added song
|
31
|
+
vkpd group 1 # plays songs from group with id = 1
|
32
|
+
vkpd --no-fix Beetles # prevents from searching for Beatles
|
33
|
+
vkpd -nf Beetles # same as above
|
34
|
+
vkpd -s 1 Beatles # sorted by length. 0 to sort by popularity, 2 to sort by upload date
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#VKPD
|
2
|
+
|
3
|
+
VKPD searches for music on social network vk.com and adds/plays it with MPD.
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/vkpd.png)](http://badge.fury.io/rb/vkpd)
|
5
|
+
|
6
|
+
##Run
|
7
|
+
vkpd [options] [search request]
|
8
|
+
|
9
|
+
##Options
|
10
|
+
|
11
|
+
-c, --count=n
|
12
|
+
Limit songs count
|
13
|
+
-o, --offset=n
|
14
|
+
Drop first n results
|
15
|
+
-s, --sort=n
|
16
|
+
Sort by: 0 - popularity, 1 - length, 2 - upload date
|
17
|
+
-nf, --no-fix, --exact
|
18
|
+
Do not try to fix typos
|
19
|
+
user [user_id]
|
20
|
+
Load user songs. If user_id not supplied use current user's id
|
21
|
+
group <group_id>
|
22
|
+
Load group songs
|
23
|
+
add
|
24
|
+
Add songs to current playlist instead of replacing it
|
25
|
+
|
26
|
+
##Some examples
|
27
|
+
vkpd Beatles # replaces current mpd playlist with The Beatles' songs and starts playing
|
28
|
+
vkpd play Beatles # the same
|
29
|
+
vkpd add Beatles # adds found songs to playlist and starts playing
|
30
|
+
vkpd -c 5 Beatles # get just first five search results
|
31
|
+
vkpd -c 5 -o 5 beatles # get second five results
|
32
|
+
vkpd --count 5 --offset=5 beatles # the same
|
33
|
+
vkpd user 3885655 # plays user's songs
|
34
|
+
vkpd user 3885655 -c 3 # plays last three songs added by user
|
35
|
+
vkpd user # current user's songs
|
36
|
+
vkpd user -c 1 # current user's last added song
|
37
|
+
vkpd group 1 # plays songs from group with id = 1
|
38
|
+
vkpd --no-fix Beetles # prevents from searching for Beatles
|
39
|
+
vkpd -nf Beetles # same as above
|
40
|
+
vkpd -s 1 Beatles # sorted by length. 0 to sort by popularity, 2 to sort by upload date
|
data/lib/vkpd.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# -*- coding: utf-8; mode: ruby -*-
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
2
|
+
require 'net/http'
|
3
|
+
require 'net/https'
|
4
|
+
require 'cgi'
|
5
|
+
require 'yaml'
|
6
|
+
require 'json'
|
7
|
+
require 'pathname'
|
8
|
+
require 'sinatra/base'
|
9
|
+
require 'ruby-mpd'
|
9
10
|
require 'vkpd/version'
|
10
11
|
require 'vkpd/cli'
|
11
12
|
require 'vkpd/auth'
|
data/lib/vkpd/cli.rb
CHANGED
@@ -11,10 +11,12 @@ module Vkpd
|
|
11
11
|
|
12
12
|
# main CLI method
|
13
13
|
def main
|
14
|
+
mpd = MPD.new 'localhost'
|
15
|
+
mpd.connect
|
14
16
|
method = "audio.search"
|
15
17
|
params = {}
|
16
|
-
|
17
|
-
|
18
|
+
do_clear = true
|
19
|
+
do_play = true
|
18
20
|
params["auto_complete"] = '1'
|
19
21
|
|
20
22
|
if ARGV.empty?
|
@@ -50,8 +52,8 @@ module Vkpd
|
|
50
52
|
method = 'audio.get'
|
51
53
|
params['gid'] = ARGV.shift
|
52
54
|
when 'add'
|
53
|
-
|
54
|
-
|
55
|
+
do_clear = false
|
56
|
+
do_play = false
|
55
57
|
when '-nf','--no-fix', '--exact'
|
56
58
|
params["auto_complete"] = '0'
|
57
59
|
when 'auth'
|
@@ -74,11 +76,11 @@ module Vkpd
|
|
74
76
|
if method.match /search/
|
75
77
|
response.shift
|
76
78
|
end
|
77
|
-
|
79
|
+
mpd.clear if do_clear
|
78
80
|
response.each do |song|
|
79
|
-
|
81
|
+
mpd.add song["url"]
|
80
82
|
end
|
81
|
-
|
83
|
+
mpd.play if do_play
|
82
84
|
end
|
83
85
|
|
84
86
|
private
|
data/lib/vkpd/version.rb
CHANGED
data/vkpd.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vkpd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: ruby-mpd
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.2.4
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.2.4
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: bundler
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,6 +88,7 @@ files:
|
|
72
88
|
- Gemfile
|
73
89
|
- LICENSE.txt
|
74
90
|
- README
|
91
|
+
- README.md
|
75
92
|
- Rakefile
|
76
93
|
- bin/vkpd
|
77
94
|
- lib/vkpd.rb
|