crossfader 0.0.2 → 0.0.3
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/lib/crossfader/cli.rb +12 -9
- data/lib/crossfader/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6f67a54b18691881185ee5dbf6f6e0f8d8ebfc6
|
4
|
+
data.tar.gz: 5bc26701e42ca926bd747469d8b3d50f4d0f6c11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f24ca87c81c649c939d75990848f0ded9d80517ef0933bd20b74d4a0fa34600b95423dbcd90c9525b13784212211e9f6aeabd3d1c55a99192194013ae18a14f3
|
7
|
+
data.tar.gz: 3b6bc9adc9349914070495acaa07ad99d645514ca5d51418de76142aad7a6214c510a392a3e5a2df17abef14b5455dfe41d485ded0322aef003741dc24c73543
|
data/lib/crossfader/cli.rb
CHANGED
@@ -32,7 +32,7 @@ module Crossfader
|
|
32
32
|
say "Let's convert wavs to MP3s!"
|
33
33
|
dir = ask('Select a folder of loops to convert: ')
|
34
34
|
dir = dir.gsub(/\\/, "").strip
|
35
|
-
Dir.foreach(dir) { |file| convert_wav_to_mp3(file, dir) }
|
35
|
+
Dir.foreach(dir) { |file| convert_wav_to_mp3(file.to_s, dir.to_s) }
|
36
36
|
say "The loops were converted successfully"
|
37
37
|
end
|
38
38
|
|
@@ -78,10 +78,10 @@ module Crossfader
|
|
78
78
|
pack_name = ask "What do you want to name your new pack?"
|
79
79
|
pack_sub = ask "Enter the subtitle for this pack:"
|
80
80
|
dir = ask('Select a folder of loops to process and upload:')
|
81
|
-
clean_dir = dir.gsub(/\\/,
|
81
|
+
clean_dir = dir.gsub(/\\/, '').strip
|
82
82
|
say clean_dir
|
83
|
-
Dir.foreach(clean_dir) { |file| convert_wav_to_mp3(file, clean_dir) }
|
84
|
-
Dir.foreach(clean_dir) { |file| create_loop_from_file(file, clean_dir) }
|
83
|
+
Dir.foreach(clean_dir) { |file| convert_wav_to_mp3(file.to_s, clean_dir.to_s) }
|
84
|
+
Dir.foreach(clean_dir) { |file| create_loop_from_file(file.to_s, clean_dir.to_s) }
|
85
85
|
response = create_new_pack(pack_name, pack_sub)
|
86
86
|
if response.code == 200
|
87
87
|
say "Success!"
|
@@ -96,18 +96,21 @@ module Crossfader
|
|
96
96
|
file_path = File.join(dir, file)
|
97
97
|
if File.file? file_path and File.extname(file_path) == ".wav"
|
98
98
|
mp3_path = "#{file_path}.mp3".gsub!('.wav', '')
|
99
|
-
|
99
|
+
mp3_path_low = "#{file_path}-low.mp3".gsub!('.wav', '')
|
100
|
+
%x(lame -b 192 -h "#{file_path}" "#{mp3_path}")
|
101
|
+
%x(lame -b 96 -m m -h "#{file_path}" "#{mp3_path_low}")
|
100
102
|
end
|
101
103
|
end
|
102
104
|
|
103
105
|
def create_loop_from_file(file, dir)
|
104
106
|
file_path = File.join(dir, file)
|
105
|
-
if File.file? file_path and File.extname(file_path) == ".
|
106
|
-
|
107
|
-
|
107
|
+
if File.file? file_path and File.extname(file_path) == ".wav"
|
108
|
+
loop_high = open(file_path.gsub('.wav', '.mp3'), 'r+b')
|
109
|
+
loop_low = open(file_path.gsub('.wav', '-low.mp3'), 'r+b')
|
110
|
+
artwork = open(file_path.gsub('.wav', '.jpg'), 'r+b')
|
108
111
|
length, bpm, key, artist, title = file.to_s.gsub('.mp3', '').split(' - ')
|
109
112
|
headers = { 'Authorization' => "Token: #{@rcfile.api_access_token}" }
|
110
|
-
body = { title: title, type: 'loop', content: { artist_name: artist, bpm: bpm, key: key, bar_count: length, loop_type: "Instrumental Song" }, loop:
|
113
|
+
body = { title: title, type: 'loop', content: { artist_name: artist, bpm: bpm, key: key, bar_count: length, loop_type: "Instrumental Song" }, loop: loop_high, loop_low: loop_low, artwork: artwork, published: 'true' }
|
111
114
|
options = { headers: headers , body: body }
|
112
115
|
response = self.class.post('/feed_items', options)
|
113
116
|
@loop_ids << response['id']
|
data/lib/crossfader/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.3
|
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-
|
11
|
+
date: 2014-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|