spotify-to-mp3 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +29 -19
- data/bin/spotify-to-mp3 +2 -2
- data/lib/spotify_to_mp3/app.rb +6 -3
- data/lib/spotify_to_mp3/app/stream_track_ids.rb +19 -0
- data/lib/spotify_to_mp3/{dependency_injection.rb → dependency_container.rb} +7 -1
- data/lib/spotify_to_mp3/grooveshark.rb +4 -0
- data/lib/spotify_to_mp3/spotify.rb +4 -0
- data/lib/spotify_to_mp3/track_id_resolver.rb +2 -0
- data/spec/app/file_track_ids_spec.rb +1 -1
- data/spec/grooveshark_spec.rb +2 -2
- data/spec/spotify_spec.rb +1 -1
- data/spec/track_id_resolver_spec.rb +2 -2
- data/spotify-to-mp3.gemspec +1 -1
- metadata +4 -5
- data/lib/spotify_to_mp3.rb +0 -16
- data/lib/spotify_to_mp3/app/file_track_ids.rb +0 -21
data/README.md
CHANGED
@@ -4,7 +4,7 @@ A simple command line utility to download MP3 files of Spotify tracks
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
### Mac OS X
|
7
|
+
### Mac OS X
|
8
8
|
|
9
9
|
```bash
|
10
10
|
$ sudo gem install spotify-to-mp3
|
@@ -12,7 +12,7 @@ $ sudo gem install spotify-to-mp3
|
|
12
12
|
|
13
13
|
Probably `sudo` can be ommited if using [rvm](http://beginrescueend.com/) or similar.
|
14
14
|
|
15
|
-
### Linux (Ubuntu
|
15
|
+
### Linux (Ubuntu)
|
16
16
|
|
17
17
|
Make sure you have rubygems installed and configured:
|
18
18
|
|
@@ -21,37 +21,47 @@ $ sudo apt-get install rubygems1.9 ruby1.9.1-dev
|
|
21
21
|
$ echo 'PATH=$PATH:/var/lib/gems/1.9/bin' | sudo tee /etc/profile.d/rubygems1.9.sh >/dev/null
|
22
22
|
```
|
23
23
|
|
24
|
-
<span></span>
|
25
|
-
|
26
24
|
```bash
|
27
25
|
$ sudo gem install spotify-to-mp3
|
28
26
|
```
|
29
27
|
|
30
|
-
### Windows (not tested)
|
31
|
-
|
32
|
-
[Install Ruby](http://rubyinstaller.org/)
|
33
|
-
|
34
|
-
```
|
35
|
-
gem install spotify-to-mp3
|
36
|
-
```
|
37
|
-
|
38
28
|
## Usage
|
39
29
|
|
40
|
-
1. Create a file (like `songs.txt`) and copy the Spotify songs URLs to it. Plain song names are also
|
30
|
+
1. Create a file (like `songs.txt`) and copy the Spotify songs URLs to it. Plain song names are also
|
41
31
|
accepted. It will look like this:
|
42
32
|
|
43
|
-
|
44
|
-
|
45
|
-
|
33
|
+
```
|
34
|
+
http://open.spotify.com/track/1JqTcOjOn7gEpeC0JcRVPa
|
35
|
+
spotify:track:1fE3ddAlmjJ99IIfLgZjTy
|
36
|
+
The Drums - Money
|
37
|
+
```
|
46
38
|
|
47
39
|
2. Download songs. They are saved to the current directory. Errors will appear in red (like when a song is not found).
|
48
40
|
|
49
|
-
|
50
|
-
|
51
|
-
|
41
|
+
```bash
|
42
|
+
$ spotify-to-mp3 songs.txt
|
43
|
+
```
|
44
|
+
|
45
|
+
Also, as it's common in Unix programs, you can pipe in the songs:
|
46
|
+
|
47
|
+
```bash
|
48
|
+
$ echo white knuckle ride | spotify-to-mp3
|
49
|
+
```
|
50
|
+
|
51
|
+
or simply:
|
52
|
+
|
53
|
+
```bash
|
54
|
+
$ spotify-to-mp3
|
55
|
+
```
|
56
|
+
|
57
|
+
and drag the songs from the Spotify app to the terminal.
|
52
58
|
|
53
59
|
## Changelog
|
54
60
|
|
61
|
+
2014-05-05
|
62
|
+
|
63
|
+
- Accept track IDs from stdin
|
64
|
+
|
55
65
|
2012-08-20
|
56
66
|
|
57
67
|
- Set filename artist and title from Grooveshark
|
data/bin/spotify-to-mp3
CHANGED
data/lib/spotify_to_mp3/app.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'spotify_to_mp3/app/stream_track_ids'
|
4
|
+
|
1
5
|
module SpotifyToMp3
|
2
6
|
class App
|
3
7
|
def initialize(track_id_resolver, grooveshark)
|
@@ -6,8 +10,7 @@ module SpotifyToMp3
|
|
6
10
|
end
|
7
11
|
|
8
12
|
def run
|
9
|
-
|
10
|
-
FileTrackIds.new(file).each do |track_id|
|
13
|
+
StreamTrackIds.new(ARGF).each do |track_id|
|
11
14
|
begin
|
12
15
|
puts "Resolving \"#{track_id}\""
|
13
16
|
track = @track_id_resolver.resolve(track_id)
|
@@ -18,7 +21,7 @@ module SpotifyToMp3
|
|
18
21
|
print "Found \"#{grooveshark_track}\""
|
19
22
|
if File.exists?(grooveshark_track.filename)
|
20
23
|
# To know about songs no longer in download list
|
21
|
-
FileUtils.touch grooveshark_track.filename
|
24
|
+
FileUtils.touch grooveshark_track.filename
|
22
25
|
|
23
26
|
puts ", already exists, skipping"
|
24
27
|
else
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module SpotifyToMp3
|
2
|
+
class App
|
3
|
+
class StreamTrackIds
|
4
|
+
include Enumerable
|
5
|
+
|
6
|
+
def initialize(stream)
|
7
|
+
@stream = stream
|
8
|
+
end
|
9
|
+
|
10
|
+
def each
|
11
|
+
@stream.each do |track_id|
|
12
|
+
track_id.strip!
|
13
|
+
next if track_id.empty?
|
14
|
+
yield track_id
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,5 +1,11 @@
|
|
1
|
+
require 'grooveshark'
|
2
|
+
require 'spotify_to_mp3/app'
|
3
|
+
require 'spotify_to_mp3/grooveshark'
|
4
|
+
require 'spotify_to_mp3/spotify'
|
5
|
+
require 'spotify_to_mp3/track_id_resolver'
|
6
|
+
|
1
7
|
module SpotifyToMp3
|
2
|
-
class
|
8
|
+
class DependencyContainer
|
3
9
|
def track_id_resolver
|
4
10
|
@track_id_resolver ||= TrackIdResolver.new(Spotify.new)
|
5
11
|
end
|
data/spec/grooveshark_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'spotify_to_mp3'
|
1
|
+
require 'spotify_to_mp3/dependency_container'
|
2
2
|
|
3
3
|
module SpotifyToMp3
|
4
4
|
describe Grooveshark do
|
5
5
|
context "#get_track" do
|
6
6
|
before(:each) do
|
7
|
-
@grooveshark =
|
7
|
+
@grooveshark = DependencyContainer.new.grooveshark
|
8
8
|
end
|
9
9
|
|
10
10
|
it "finds by plain query" do
|
data/spec/spotify_spec.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'spotify_to_mp3'
|
1
|
+
require 'spotify_to_mp3/dependency_container'
|
2
2
|
|
3
3
|
module SpotifyToMp3
|
4
4
|
describe TrackIdResolver do
|
5
5
|
before(:each) do
|
6
|
-
@resolver =
|
6
|
+
@resolver = DependencyContainer.new.track_id_resolver
|
7
7
|
end
|
8
8
|
|
9
9
|
it "resolves Spotify HTTP URLs" do
|
data/spotify-to-mp3.gemspec
CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |gem|
|
|
2
2
|
gem.name = 'spotify-to-mp3'
|
3
3
|
gem.summary = 'Spotify to MP3'
|
4
4
|
gem.description = 'Download MP3 files of your Spotify tracks from Grooveshark'
|
5
|
-
gem.version = '0.
|
5
|
+
gem.version = '0.6.0'
|
6
6
|
gem.author = 'Francesc Rosàs'
|
7
7
|
gem.email = 'francescrosasbosque@gmail.com'
|
8
8
|
gem.homepage = 'https://github.com/frosas/spotify-to-mp3'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spotify-to-mp3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
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: 2014-
|
12
|
+
date: 2014-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: grooveshark
|
@@ -104,10 +104,9 @@ files:
|
|
104
104
|
- LICENSE
|
105
105
|
- README.md
|
106
106
|
- bin/spotify-to-mp3
|
107
|
-
- lib/spotify_to_mp3.rb
|
108
107
|
- lib/spotify_to_mp3/app.rb
|
109
|
-
- lib/spotify_to_mp3/app/
|
110
|
-
- lib/spotify_to_mp3/
|
108
|
+
- lib/spotify_to_mp3/app/stream_track_ids.rb
|
109
|
+
- lib/spotify_to_mp3/dependency_container.rb
|
111
110
|
- lib/spotify_to_mp3/grooveshark.rb
|
112
111
|
- lib/spotify_to_mp3/grooveshark/track.rb
|
113
112
|
- lib/spotify_to_mp3/spotify.rb
|
data/lib/spotify_to_mp3.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'grooveshark'
|
2
|
-
require 'open-uri'
|
3
|
-
require 'colorize'
|
4
|
-
require 'rest-client'
|
5
|
-
require 'fileutils'
|
6
|
-
require 'cgi'
|
7
|
-
|
8
|
-
require 'spotify_to_mp3/app'
|
9
|
-
require 'spotify_to_mp3/app/file_track_ids'
|
10
|
-
require 'spotify_to_mp3/dependency_injection'
|
11
|
-
require 'spotify_to_mp3/spotify'
|
12
|
-
require 'spotify_to_mp3/spotify/track'
|
13
|
-
require 'spotify_to_mp3/track_id_resolver'
|
14
|
-
require 'spotify_to_mp3/track'
|
15
|
-
require 'spotify_to_mp3/grooveshark'
|
16
|
-
require 'spotify_to_mp3/grooveshark/track'
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module SpotifyToMp3
|
2
|
-
class App
|
3
|
-
class FileTrackIds
|
4
|
-
include Enumerable
|
5
|
-
|
6
|
-
def initialize(file)
|
7
|
-
@file = file
|
8
|
-
end
|
9
|
-
|
10
|
-
def each
|
11
|
-
File.open(@file) do |file|
|
12
|
-
file.each do |track_id|
|
13
|
-
track_id.strip!
|
14
|
-
next if track_id.empty?
|
15
|
-
yield track_id
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|