crossfader 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d4ae6c3745bd42a89787bc0acfa4d8299f85f57
4
- data.tar.gz: 4792df0411ea79976aa6bf44e26fa252f7053eb1
3
+ metadata.gz: c6f67a54b18691881185ee5dbf6f6e0f8d8ebfc6
4
+ data.tar.gz: 5bc26701e42ca926bd747469d8b3d50f4d0f6c11
5
5
  SHA512:
6
- metadata.gz: 6ed9b5a941561a678303850837a1aeec9cb7e8d62f781d6f6ccf7dd712caa23354dd214d4b95ca3db5fc833bd379e05d3ad790a33864e8412f95612945e311fb
7
- data.tar.gz: 5bf353eef8b5ff29cace939af38bd7fc3ceac7a3fc8be258592b1c44492d7d66a1611de689e08b93e3f9762e82bec1c40bb1a65bf78fb57a07973e1db7fb8e09
6
+ metadata.gz: f24ca87c81c649c939d75990848f0ded9d80517ef0933bd20b74d4a0fa34600b95423dbcd90c9525b13784212211e9f6aeabd3d1c55a99192194013ae18a14f3
7
+ data.tar.gz: 3b6bc9adc9349914070495acaa07ad99d645514ca5d51418de76142aad7a6214c510a392a3e5a2df17abef14b5455dfe41d485ded0322aef003741dc24c73543
@@ -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(/\\/, "").strip
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
- system "lame -b 160 -h '#{file_path}' '#{mp3_path}'"
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) == ".mp3"
106
- loop_audio = open(file_path, 'r+b')
107
- artwork = open(file_path.gsub('.mp3', '.jpg'), 'r+b')
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: loop_audio, artwork: artwork, published: 'true' }
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']
@@ -1,3 +1,3 @@
1
1
  module Crossfader
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-01-06 00:00:00.000000000 Z
11
+ date: 2014-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler