groove-dl 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MANIFEST +0 -1
- data/README.md +2 -2
- data/bin/groove-dl +21 -10
- data/groove-dl.gemspec +5 -5
- data/lib/groove-dl/cli.rb +6 -1
- data/lib/groove-dl/downloader.rb +11 -5
- data/lib/groove-dl/version.rb +1 -1
- data/lib/groove-dl/widgets/download.rb +3 -0
- data/spec/groove-dl/cli_spec.rb +4 -0
- data/spec/groove-dl/downloader_spec.rb +8 -0
- metadata +54 -32
- data/bin/groove-dl-cli +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf2c65506f5ca02c45012c1800aba067cab99c0d
|
4
|
+
data.tar.gz: 1235dd8d45c8820147742e2121655f674f76ce3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b65c4781a2b339e5753d15bb8f066188c3b944d824173532d4337852602c36d6487c08109652ff24737755ab6fbed0114a72f94ec29811f2f7d043bde58a3a2b
|
7
|
+
data.tar.gz: ea2ee4a79b2ae9d04443f4ae7b90b135dcf19ff72facbe8f958049029a519b42151db56961998be9d5daf3d03182c25bba7eafacd894111ba8a85ffa80629bae
|
data/MANIFEST
CHANGED
data/README.md
CHANGED
@@ -37,7 +37,7 @@ Run `groove-dl` and a gtk app will be displayed, you can:
|
|
37
37
|
In CLI mode:
|
38
38
|
|
39
39
|
```bash
|
40
|
-
$ groove-dl
|
40
|
+
$ groove-dl --help
|
41
41
|
Usage: groove-dl [COMMAND] [OPTIONS]
|
42
42
|
|
43
43
|
Options:
|
@@ -57,7 +57,7 @@ See `<command> --help` for more information on a specific command.
|
|
57
57
|
|
58
58
|
Search for song:
|
59
59
|
```bash
|
60
|
-
$ groove-dl
|
60
|
+
$ groove-dl search --help
|
61
61
|
Usage: groove-dl search [OPTIONS]
|
62
62
|
|
63
63
|
Options:
|
data/bin/groove-dl
CHANGED
@@ -3,13 +3,24 @@
|
|
3
3
|
|
4
4
|
require File.expand_path('../../lib/groove-dl', __FILE__)
|
5
5
|
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require '
|
9
|
-
|
10
|
-
require 'groove-dl/
|
11
|
-
require 'groove-dl/
|
12
|
-
|
13
|
-
|
14
|
-
GrooveDl::
|
15
|
-
|
6
|
+
require 'ruby-progressbar'
|
7
|
+
require 'slop'
|
8
|
+
require 'terminal-table'
|
9
|
+
|
10
|
+
require 'groove-dl/cli'
|
11
|
+
require 'groove-dl/cli/search'
|
12
|
+
require 'groove-dl/displayer'
|
13
|
+
|
14
|
+
options = GrooveDl::CLI.options
|
15
|
+
if options.parse.empty?
|
16
|
+
require 'gtk3'
|
17
|
+
require 'shellwords'
|
18
|
+
require 'groove-dl/app'
|
19
|
+
require 'groove-dl/widgets/events'
|
20
|
+
require 'groove-dl/widgets/search'
|
21
|
+
require 'groove-dl/widgets/download'
|
22
|
+
|
23
|
+
Gtk.init
|
24
|
+
GrooveDl::App.new('glade/groove-dl.glade')
|
25
|
+
Gtk.main
|
26
|
+
end
|
data/groove-dl.gemspec
CHANGED
@@ -11,19 +11,19 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.homepage = 'http://github.com/PierreRambaud/groove-dl'
|
12
12
|
s.description = 'Grooveshark downloader allow you to search, choose ' \
|
13
13
|
'playlists and songs and download them.'
|
14
|
-
s.executables = ['groove-dl'
|
14
|
+
s.executables = ['groove-dl']
|
15
15
|
|
16
16
|
s.files = File.read(File.expand_path('../MANIFEST', __FILE__)).split("\n")
|
17
17
|
|
18
18
|
s.required_ruby_version = '>= 1.9.3'
|
19
19
|
|
20
20
|
s.add_dependency 'slop', '~>3.6'
|
21
|
-
s.add_dependency 'grooveshark', '~>0.2.12'
|
22
|
-
s.add_dependency 'ruby-progressbar', '~>1.7.0'
|
23
|
-
s.add_dependency 'terminal-table', '~>1.4.5'
|
21
|
+
s.add_dependency 'grooveshark', '~> 0.2', '>= 0.2.12'
|
22
|
+
s.add_dependency 'ruby-progressbar', '~> 1.7', '>= 1.7.0'
|
23
|
+
s.add_dependency 'terminal-table', '~> 1.4', '>= 1.4.5'
|
24
24
|
s.add_dependency 'gtk3', '~>2.2'
|
25
25
|
|
26
|
-
s.add_development_dependency 'fakefs', '~>0.6.0'
|
26
|
+
s.add_development_dependency 'fakefs', '~> 0.6', '>= 0.6.0'
|
27
27
|
s.add_development_dependency 'rake', '~>10.0'
|
28
28
|
s.add_development_dependency 'rack-test', '~>0.6'
|
29
29
|
s.add_development_dependency 'rspec', '~>3.0'
|
data/lib/groove-dl/cli.rb
CHANGED
@@ -40,7 +40,12 @@ module GrooveDl
|
|
40
40
|
|
41
41
|
client = Grooveshark::Client.new
|
42
42
|
d = Downloader.new(client, opts)
|
43
|
-
|
43
|
+
if opts[:p]
|
44
|
+
GrooveDl.configuration.logger
|
45
|
+
.info("Download files into #{d.output_directory}")
|
46
|
+
d.playlist(opts[:p])
|
47
|
+
end
|
48
|
+
|
44
49
|
d.song(opts[:s]) if opts[:s]
|
45
50
|
end
|
46
51
|
end
|
data/lib/groove-dl/downloader.rb
CHANGED
@@ -3,10 +3,8 @@ module GrooveDl
|
|
3
3
|
# Downloader Class
|
4
4
|
class Downloader
|
5
5
|
attr_accessor :type
|
6
|
-
attr_writer :client
|
7
|
-
|
8
|
-
attr_writer :download_count
|
9
|
-
attr_writer :download_skip
|
6
|
+
attr_writer :client, :download_queue, :download_count, :download_skip
|
7
|
+
attr_reader :output_directory, :queue, :count, :skip
|
10
8
|
|
11
9
|
##
|
12
10
|
# Initialize download
|
@@ -83,7 +81,11 @@ module GrooveDl
|
|
83
81
|
def download_queue
|
84
82
|
return false if @queue.empty?
|
85
83
|
@queue.each do |song|
|
86
|
-
|
84
|
+
begin
|
85
|
+
download(song, build_path(@output_directory, song))
|
86
|
+
rescue StandardError => e
|
87
|
+
GrooveDl.configuration.logger.error(e.message)
|
88
|
+
end
|
87
89
|
end
|
88
90
|
|
89
91
|
{ skipped: @skip, downloaded: @count }
|
@@ -124,6 +126,10 @@ module GrooveDl
|
|
124
126
|
pbar = ProgressBar.create(title: destination.split('/').last,
|
125
127
|
format: '%a |%b>>%i| %p%% %t',
|
126
128
|
total: response['content-length'].to_i)
|
129
|
+
|
130
|
+
dirname = File.dirname(destination)
|
131
|
+
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
132
|
+
|
127
133
|
File.open(destination, 'w') do |f|
|
128
134
|
response.read_body do |chunk|
|
129
135
|
f.write(chunk)
|
data/lib/groove-dl/version.rb
CHANGED
@@ -7,6 +7,8 @@ module GrooveDl
|
|
7
7
|
attr_accessor :search_list, :songs, :downloader
|
8
8
|
attr_accessor :failed, :success, :queue
|
9
9
|
|
10
|
+
attr_reader :queue_store, :failed_store, :success_store
|
11
|
+
|
10
12
|
RIGHT_CLICK = 3
|
11
13
|
|
12
14
|
SUCCESS_COLUMN_PATH,
|
@@ -69,6 +71,7 @@ module GrooveDl
|
|
69
71
|
search_list_store.each do |_model, _path, iter|
|
70
72
|
next unless iter[column_checkbox]
|
71
73
|
selected[iter[column_id]] = @search_list.data[iter[column_id]]
|
74
|
+
iter[column_checkbox] = false
|
72
75
|
end
|
73
76
|
|
74
77
|
@queue_store = @app.get_object('download_queue_list_store')
|
data/spec/groove-dl/cli_spec.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'groove-dl/cli'
|
4
|
+
require 'groove-dl/configuration'
|
4
5
|
require 'slop'
|
6
|
+
require 'logger'
|
5
7
|
|
6
8
|
# Groove Dl tests
|
7
9
|
module GrooveDl
|
@@ -32,9 +34,11 @@ module GrooveDl
|
|
32
34
|
end
|
33
35
|
|
34
36
|
it 'should download playlist' do
|
37
|
+
allow_any_instance_of(Logger).to receive(:info)
|
35
38
|
allow(Grooveshark::Client).to receive(:new).and_return(true)
|
36
39
|
downloader = double
|
37
40
|
allow(downloader).to receive(:playlist).with(1).and_return(true)
|
41
|
+
allow(downloader).to receive(:output_directory).and_return('/tmp')
|
38
42
|
allow(Downloader).to receive(:new).and_return(downloader)
|
39
43
|
expect(CLI.options.parse %w( -p 1)).to eq(['-p', '1'])
|
40
44
|
end
|
@@ -27,6 +27,14 @@ module GrooveDl
|
|
27
27
|
expect(@downloader.download_queue).to be_falsy
|
28
28
|
end
|
29
29
|
|
30
|
+
it 'should log error when download failed' do
|
31
|
+
@downloader.queue << 'something'
|
32
|
+
allow_any_instance_of(Logger).to receive(:error)
|
33
|
+
.with("undefined method `artist' for \"something\":String")
|
34
|
+
expect(@downloader.download_queue)
|
35
|
+
.to eq(skipped: 0, downloaded: 0)
|
36
|
+
end
|
37
|
+
|
30
38
|
it 'should download playlist' do
|
31
39
|
allow(@client).to receive(:request)
|
32
40
|
.and_return('songs' => [{ 'song_id' => 1,
|
metadata
CHANGED
@@ -1,167 +1,191 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groove-dl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre Rambaud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: grooveshark
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.2'
|
34
|
+
- - ">="
|
32
35
|
- !ruby/object:Gem::Version
|
33
36
|
version: 0.2.12
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - ~>
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0.2'
|
44
|
+
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: 0.2.12
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: ruby-progressbar
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - ~>
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.7'
|
54
|
+
- - ">="
|
46
55
|
- !ruby/object:Gem::Version
|
47
56
|
version: 1.7.0
|
48
57
|
type: :runtime
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
|
-
- - ~>
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.7'
|
64
|
+
- - ">="
|
53
65
|
- !ruby/object:Gem::Version
|
54
66
|
version: 1.7.0
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: terminal-table
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
58
70
|
requirements:
|
59
|
-
- - ~>
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '1.4'
|
74
|
+
- - ">="
|
60
75
|
- !ruby/object:Gem::Version
|
61
76
|
version: 1.4.5
|
62
77
|
type: :runtime
|
63
78
|
prerelease: false
|
64
79
|
version_requirements: !ruby/object:Gem::Requirement
|
65
80
|
requirements:
|
66
|
-
- - ~>
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.4'
|
84
|
+
- - ">="
|
67
85
|
- !ruby/object:Gem::Version
|
68
86
|
version: 1.4.5
|
69
87
|
- !ruby/object:Gem::Dependency
|
70
88
|
name: gtk3
|
71
89
|
requirement: !ruby/object:Gem::Requirement
|
72
90
|
requirements:
|
73
|
-
- - ~>
|
91
|
+
- - "~>"
|
74
92
|
- !ruby/object:Gem::Version
|
75
93
|
version: '2.2'
|
76
94
|
type: :runtime
|
77
95
|
prerelease: false
|
78
96
|
version_requirements: !ruby/object:Gem::Requirement
|
79
97
|
requirements:
|
80
|
-
- - ~>
|
98
|
+
- - "~>"
|
81
99
|
- !ruby/object:Gem::Version
|
82
100
|
version: '2.2'
|
83
101
|
- !ruby/object:Gem::Dependency
|
84
102
|
name: fakefs
|
85
103
|
requirement: !ruby/object:Gem::Requirement
|
86
104
|
requirements:
|
87
|
-
- - ~>
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0.6'
|
108
|
+
- - ">="
|
88
109
|
- !ruby/object:Gem::Version
|
89
110
|
version: 0.6.0
|
90
111
|
type: :development
|
91
112
|
prerelease: false
|
92
113
|
version_requirements: !ruby/object:Gem::Requirement
|
93
114
|
requirements:
|
94
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.6'
|
118
|
+
- - ">="
|
95
119
|
- !ruby/object:Gem::Version
|
96
120
|
version: 0.6.0
|
97
121
|
- !ruby/object:Gem::Dependency
|
98
122
|
name: rake
|
99
123
|
requirement: !ruby/object:Gem::Requirement
|
100
124
|
requirements:
|
101
|
-
- - ~>
|
125
|
+
- - "~>"
|
102
126
|
- !ruby/object:Gem::Version
|
103
127
|
version: '10.0'
|
104
128
|
type: :development
|
105
129
|
prerelease: false
|
106
130
|
version_requirements: !ruby/object:Gem::Requirement
|
107
131
|
requirements:
|
108
|
-
- - ~>
|
132
|
+
- - "~>"
|
109
133
|
- !ruby/object:Gem::Version
|
110
134
|
version: '10.0'
|
111
135
|
- !ruby/object:Gem::Dependency
|
112
136
|
name: rack-test
|
113
137
|
requirement: !ruby/object:Gem::Requirement
|
114
138
|
requirements:
|
115
|
-
- - ~>
|
139
|
+
- - "~>"
|
116
140
|
- !ruby/object:Gem::Version
|
117
141
|
version: '0.6'
|
118
142
|
type: :development
|
119
143
|
prerelease: false
|
120
144
|
version_requirements: !ruby/object:Gem::Requirement
|
121
145
|
requirements:
|
122
|
-
- - ~>
|
146
|
+
- - "~>"
|
123
147
|
- !ruby/object:Gem::Version
|
124
148
|
version: '0.6'
|
125
149
|
- !ruby/object:Gem::Dependency
|
126
150
|
name: rspec
|
127
151
|
requirement: !ruby/object:Gem::Requirement
|
128
152
|
requirements:
|
129
|
-
- - ~>
|
153
|
+
- - "~>"
|
130
154
|
- !ruby/object:Gem::Version
|
131
155
|
version: '3.0'
|
132
156
|
type: :development
|
133
157
|
prerelease: false
|
134
158
|
version_requirements: !ruby/object:Gem::Requirement
|
135
159
|
requirements:
|
136
|
-
- - ~>
|
160
|
+
- - "~>"
|
137
161
|
- !ruby/object:Gem::Version
|
138
162
|
version: '3.0'
|
139
163
|
- !ruby/object:Gem::Dependency
|
140
164
|
name: simplecov
|
141
165
|
requirement: !ruby/object:Gem::Requirement
|
142
166
|
requirements:
|
143
|
-
- - ~>
|
167
|
+
- - "~>"
|
144
168
|
- !ruby/object:Gem::Version
|
145
169
|
version: '0.9'
|
146
170
|
type: :development
|
147
171
|
prerelease: false
|
148
172
|
version_requirements: !ruby/object:Gem::Requirement
|
149
173
|
requirements:
|
150
|
-
- - ~>
|
174
|
+
- - "~>"
|
151
175
|
- !ruby/object:Gem::Version
|
152
176
|
version: '0.9'
|
153
177
|
- !ruby/object:Gem::Dependency
|
154
178
|
name: rubocop
|
155
179
|
requirement: !ruby/object:Gem::Requirement
|
156
180
|
requirements:
|
157
|
-
- - ~>
|
181
|
+
- - "~>"
|
158
182
|
- !ruby/object:Gem::Version
|
159
183
|
version: '0.25'
|
160
184
|
type: :development
|
161
185
|
prerelease: false
|
162
186
|
version_requirements: !ruby/object:Gem::Requirement
|
163
187
|
requirements:
|
164
|
-
- - ~>
|
188
|
+
- - "~>"
|
165
189
|
- !ruby/object:Gem::Version
|
166
190
|
version: '0.25'
|
167
191
|
description: Grooveshark downloader allow you to search, choose playlists and songs
|
@@ -169,20 +193,18 @@ description: Grooveshark downloader allow you to search, choose playlists and so
|
|
169
193
|
email: pierre.rambaud86@gmail.com
|
170
194
|
executables:
|
171
195
|
- groove-dl
|
172
|
-
- groove-dl-cli
|
173
196
|
extensions: []
|
174
197
|
extra_rdoc_files: []
|
175
198
|
files:
|
176
|
-
- .gitignore
|
177
|
-
- .rubocop.yml
|
178
|
-
- .travis.yml
|
199
|
+
- ".gitignore"
|
200
|
+
- ".rubocop.yml"
|
201
|
+
- ".travis.yml"
|
179
202
|
- Gemfile
|
180
203
|
- LICENSE
|
181
204
|
- MANIFEST
|
182
205
|
- README.md
|
183
206
|
- Rakefile
|
184
207
|
- bin/groove-dl
|
185
|
-
- bin/groove-dl-cli
|
186
208
|
- glade/groove-dl.glade
|
187
209
|
- groove-dl.gemspec
|
188
210
|
- lib/groove-dl.rb
|
@@ -214,17 +236,17 @@ require_paths:
|
|
214
236
|
- lib
|
215
237
|
required_ruby_version: !ruby/object:Gem::Requirement
|
216
238
|
requirements:
|
217
|
-
- -
|
239
|
+
- - ">="
|
218
240
|
- !ruby/object:Gem::Version
|
219
241
|
version: 1.9.3
|
220
242
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
243
|
requirements:
|
222
|
-
- -
|
244
|
+
- - ">="
|
223
245
|
- !ruby/object:Gem::Version
|
224
246
|
version: '0'
|
225
247
|
requirements: []
|
226
248
|
rubyforge_project:
|
227
|
-
rubygems_version: 2.
|
249
|
+
rubygems_version: 2.2.2
|
228
250
|
signing_key:
|
229
251
|
specification_version: 4
|
230
252
|
summary: Grooveshark songs downloader.
|
data/bin/groove-dl-cli
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
|
4
|
-
require File.expand_path('../../lib/groove-dl', __FILE__)
|
5
|
-
|
6
|
-
require 'ruby-progressbar'
|
7
|
-
require 'slop'
|
8
|
-
require 'terminal-table'
|
9
|
-
|
10
|
-
require 'groove-dl/cli'
|
11
|
-
require 'groove-dl/cli/search'
|
12
|
-
require 'groove-dl/displayer'
|
13
|
-
|
14
|
-
options = GrooveDl::CLI.options
|
15
|
-
puts options if options.parse.empty?
|