crossfader 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/bin/crossfader +0 -8
- data/lib/crossfader/cli.rb +40 -36
- data/lib/crossfader/version.rb +1 -1
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d00acb28342f6511cf2c08cea434e6a4d2a5943
|
4
|
+
data.tar.gz: 19b4e2e37ee160e6b988f0c795c89ba75a3624cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 763b4ffd30d12944e43f0f81886fd8286f220d0b2b8e9cd6f2446036fbc95043b157537de4c5790c100d1c6589f3fd8a976d25ece7a4737d4c013588ca985dd0
|
7
|
+
data.tar.gz: 3e38eb12e0edd4af6876df74fcbd0ae0d62679d81f76851e2ad96b349debfdb639ef1ab9d39c4251bca33f6ddcb0cebc6a5dfdb9c215b6d7f02b47b69458fdb4
|
data/bin/crossfader
CHANGED
@@ -4,16 +4,8 @@ Signal.trap('INT') { exit 1 }
|
|
4
4
|
|
5
5
|
require 'crossfader'
|
6
6
|
|
7
|
-
def pute(*args)
|
8
|
-
first = args.shift.dup
|
9
|
-
first.insert(0, "#{$PROGRAM_NAME}: ")
|
10
|
-
args.unshift(first)
|
11
|
-
$stderr.puts(*args)
|
12
|
-
end
|
13
|
-
|
14
7
|
begin
|
15
8
|
Crossfader::CLI.start(ARGV)
|
16
9
|
rescue Interrupt
|
17
|
-
pute 'Quitting...'
|
18
10
|
exit 1
|
19
11
|
end
|
data/lib/crossfader/cli.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
2
4
|
require 'httmultiparty'
|
3
5
|
require 'crossfader/rcfile'
|
4
6
|
module Crossfader
|
5
7
|
class CLI < Thor
|
6
8
|
include HTTMultiParty
|
7
|
-
base_uri 'http://api.
|
9
|
+
base_uri 'http://api.lvh.me:5000/v3'
|
8
10
|
def initialize(*)
|
9
11
|
@rcfile = Crossfader::RCFile.instance
|
10
|
-
@loop_ids = []
|
11
12
|
super
|
12
13
|
end
|
13
14
|
|
@@ -31,8 +32,8 @@ module Crossfader
|
|
31
32
|
def convert
|
32
33
|
say "Let's convert wavs to MP3s!"
|
33
34
|
dir = ask('Select a folder of loops to convert: ')
|
34
|
-
|
35
|
-
|
35
|
+
files = FileList.new("#{dir}/*.wav")
|
36
|
+
files.each{|file| convert_wav_to_mp3(file) }
|
36
37
|
say "The loops were converted successfully"
|
37
38
|
end
|
38
39
|
|
@@ -40,8 +41,8 @@ module Crossfader
|
|
40
41
|
def upload
|
41
42
|
say "Time to upload some loops!"
|
42
43
|
dir = ask('Select a folder of loops to upload: ')
|
43
|
-
|
44
|
-
|
44
|
+
wavs = FileList["#{dir}/*.wav"]
|
45
|
+
wavs.each{|file| create_loop_from_file(file) }
|
45
46
|
say "The loops were uploaded successfully"
|
46
47
|
end
|
47
48
|
|
@@ -51,7 +52,7 @@ module Crossfader
|
|
51
52
|
pack_name = ask "What should we call this pack?"
|
52
53
|
pack_sub = ask "Enter the subtitle for this pack:"
|
53
54
|
response = create_new_pack(pack_name, pack_sub)
|
54
|
-
say response
|
55
|
+
say response.code
|
55
56
|
if response.code == 200
|
56
57
|
say "Successfully created a pack named #{pack_name}"
|
57
58
|
else
|
@@ -68,6 +69,7 @@ module Crossfader
|
|
68
69
|
say "\`crossfader upload\` : Upload a folder of .mp3s to the server to create new loops.\n"
|
69
70
|
say "\`crossfader batch\` : Create a new pack, convert a folder of .wav files to .mp3 files and upload them to the server in one step.\n"
|
70
71
|
say "\`crossfader create_pack\` : Create a new empty pack.\n\n"
|
72
|
+
say "\`crossfader clean\` : Remove all MP3s from a folder.\n\n"
|
71
73
|
say "---\n"
|
72
74
|
say "Have questions, comments, or feed back? Contact Adam at adam@djz.com\n\n"
|
73
75
|
end
|
@@ -78,11 +80,11 @@ module Crossfader
|
|
78
80
|
pack_name = ask "What do you want to name your new pack?"
|
79
81
|
pack_sub = ask "Enter the subtitle for this pack:"
|
80
82
|
dir = ask('Select a folder of loops to process and upload:')
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
response = create_new_pack(pack_name, pack_sub)
|
83
|
+
files = FileList.new("#{dir}/*.wav")
|
84
|
+
files.each{|file| convert_wav_to_mp3(file) }
|
85
|
+
loop_responses = files.map{|file| create_loop_from_file(file) }
|
86
|
+
loop_ids = loop_responses.map{|r| r['id'] }
|
87
|
+
response = create_new_pack(pack_name, pack_sub, loop_ids)
|
86
88
|
if response.code == 200
|
87
89
|
say "Success!"
|
88
90
|
else
|
@@ -90,37 +92,39 @@ module Crossfader
|
|
90
92
|
end
|
91
93
|
end
|
92
94
|
|
95
|
+
desc 'clean', "Remove all MP3s from a folder."
|
96
|
+
def clean
|
97
|
+
dir = ask('Select a folder of MP3s to delete: ')
|
98
|
+
mp3s = FileList["#{dir}/*.mp3"]
|
99
|
+
Rake::Cleaner.cleanup_files(mp3s)
|
100
|
+
say "Removed MP3s successfully."
|
101
|
+
end
|
102
|
+
|
93
103
|
private
|
94
104
|
|
95
|
-
def convert_wav_to_mp3(file
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
%x(lame -b 192 -h "#{file_path}" "#{mp3_path}")
|
101
|
-
%x(lame -b 96 -m m -h "#{file_path}" "#{mp3_path_low}")
|
102
|
-
end
|
105
|
+
def convert_wav_to_mp3(file)
|
106
|
+
mp3 = file.ext(".mp3")
|
107
|
+
mp3_low = "#{file.ext}-low.mp3"
|
108
|
+
%x(lame -b 192 -h "#{file}" "#{mp3}")
|
109
|
+
%x(lame -b 96 -m m -h "#{file}" "#{mp3_low}")
|
103
110
|
end
|
104
111
|
|
105
|
-
def create_loop_from_file(file
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
@loop_ids << response['id']
|
117
|
-
say "New loop for #{title} created with an id of #{response['id']}"
|
118
|
-
end
|
112
|
+
def create_loop_from_file(file)
|
113
|
+
mp3 = File.open(file.ext(".mp3"), 'r+b')
|
114
|
+
mp3_low = File.open("#{file.ext}-low.mp3", 'r+b')
|
115
|
+
artwork = File.open(file.ext('.jpg'), 'r+b')
|
116
|
+
length, bpm, key, artist, title = file.ext.split("-").map(&:strip)
|
117
|
+
headers = { 'Authorization' => "Token: #{@rcfile.api_access_token}" }
|
118
|
+
body = { title: title, type: 'loop', content: { artist_name: artist, bpm: bpm, key: key, bar_count: length, loop_type: "Instrumental Song" }, loop: mp3, loop_low: mp3_low, artwork: artwork, published: 'true' }
|
119
|
+
options = { headers: headers , body: body }
|
120
|
+
response = self.class.post('/feed_items', options)
|
121
|
+
say "Uploaded #{title} successfully with an id of #{response['id']}."
|
122
|
+
response
|
119
123
|
end
|
120
124
|
|
121
|
-
def create_new_pack(pack_name, pack_sub)
|
125
|
+
def create_new_pack(pack_name, pack_sub, loop_ids)
|
122
126
|
headers = { 'Authorization' => "Token: #{@rcfile.api_access_token}" }
|
123
|
-
body = { title: pack_name, content: { subtitle: pack_sub }, type: 'pack', pack_items:
|
127
|
+
body = { title: pack_name, content: { subtitle: pack_sub }, type: 'pack', pack_items: loop_ids }
|
124
128
|
options = { headers: headers , body: body }
|
125
129
|
response = self.class.post('/feed_items', options)
|
126
130
|
return response
|
data/lib/crossfader/version.rb
CHANGED
metadata
CHANGED
@@ -1,103 +1,103 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crossfader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Barber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02
|
11
|
+
date: 2014-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
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: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: thor
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.18.1
|
48
|
-
- - <
|
48
|
+
- - "<"
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '2'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: 0.18.1
|
58
|
-
- - <
|
58
|
+
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '2'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: lame
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: httparty
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: httmultiparty
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
description: '["Crossfader allows for easy batch conversion and upload of loops for
|
@@ -109,7 +109,7 @@ executables:
|
|
109
109
|
extensions: []
|
110
110
|
extra_rdoc_files: []
|
111
111
|
files:
|
112
|
-
- .gitignore
|
112
|
+
- ".gitignore"
|
113
113
|
- Gemfile
|
114
114
|
- LICENSE.txt
|
115
115
|
- README.md
|
@@ -130,17 +130,17 @@ require_paths:
|
|
130
130
|
- lib
|
131
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
132
132
|
requirements:
|
133
|
-
- -
|
133
|
+
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- -
|
138
|
+
- - ">="
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.2.
|
143
|
+
rubygems_version: 2.2.2
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: '["Quickly convert and upload loops for Crossfader.fm"]'
|