vkpd 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README +4 -0
  2. data/lib/vkpd/cli.rb +16 -5
  3. data/lib/vkpd/version.rb +1 -1
  4. metadata +2 -2
data/README CHANGED
@@ -8,6 +8,10 @@ Options:
8
8
  Drop first n results
9
9
  -s, --sort=n
10
10
  Sort by: 0 - popularity, 1 - length, 2 - upload date
11
+ -v, --verbose
12
+ Verbose output
13
+ -p, --mplayer
14
+ Use mplayer instead of mpd
11
15
  -nf, --no-fix, --exact
12
16
  Do not try to fix typos
13
17
  user [user_id]
data/lib/vkpd/cli.rb CHANGED
@@ -9,6 +9,7 @@ module Vkpd
9
9
  do_clear = true
10
10
  do_play = true
11
11
  params["auto_complete"] = '1'
12
+ player = :mpd
12
13
 
13
14
  if ARGV.empty?
14
15
  ARGV.push "-h"
@@ -23,6 +24,8 @@ module Vkpd
23
24
  exit 0
24
25
  when '-v', '--verbose'
25
26
  @verbose = true
27
+ when '-p', '--mplayer'
28
+ player = :mplayer
26
29
  when '-c', '--count', /^--count=\d+$/
27
30
  value = current.include?("=") ? current.match(/=(.*)/)[1] : ARGV.shift
28
31
  params["count"] = value
@@ -69,12 +72,20 @@ module Vkpd
69
72
  if method.match /search/
70
73
  response.shift
71
74
  end
72
- mpd.clear if do_clear
73
- response.each do |song|
74
- puts song if @verbose
75
- mpd.add song["url"]
75
+ case player
76
+ when :mpd
77
+ mpd.clear if do_clear
78
+ response.each do |song|
79
+ puts song if @verbose
80
+ mpd.add song["url"]
81
+ end
82
+ mpd.play if do_play
83
+ when :mplayer
84
+ response.each do |song|
85
+ puts song if @verbose
86
+ system "mplayer --cache=8192 --cache-min=2 #{song['url']}"
87
+ end
76
88
  end
77
- mpd.play if do_play
78
89
  end
79
90
 
80
91
  private
data/lib/vkpd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vkpd
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
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.3.0
4
+ version: 1.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-24 00:00:00.000000000 Z
12
+ date: 2013-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra