flac2lame 0.2
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 +7 -0
- data/bin/flac2lame +64 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d7624751f4b3097d6967ba5ff7217ee4b09c7d7f
|
4
|
+
data.tar.gz: e1643f7184c45de4c618e1ca993c85c98ba677d3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 59aa02310239572df0fe4f6373cfe415518952f54eb2872d6c78046feb121e375f45245439d79e1efb02aea14d918765befae2770a116d95845ca90520e65cc0
|
7
|
+
data.tar.gz: a3867129c2558be0e62ce4c8e977e9ff81985c35f1b90d7cd1f15de51a74575dd6b50eb23a7aab8d50ee18c37e0c195bee8f086665fa7f73fc3bb601e8c4d331
|
data/bin/flac2lame
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
## flac2lame, january 2012, pete gamache, gamache!@#$!@gmail.com
|
3
|
+
##
|
4
|
+
## Use flac2lame to take properly-tagged FLAC files and turn them into
|
5
|
+
## properly tagged MP3s.
|
6
|
+
## I wanted to call it flac2mp3 but that is already a Bash script.
|
7
|
+
##
|
8
|
+
## Requires: flac (and metaflac), lame
|
9
|
+
|
10
|
+
VERSION = '0.2'
|
11
|
+
|
12
|
+
def usage
|
13
|
+
<<-EOT
|
14
|
+
flac2lame v#{VERSION} (https://github.com/gamache/flac2lame)
|
15
|
+
Usage: #{$0} path/to/file1.flac ... path/to/fileN.flac
|
16
|
+
Outputs file1.mp3 ... fileN.mp3 in the current directory.
|
17
|
+
Run '#{$0} -h' to see this message.
|
18
|
+
EOT
|
19
|
+
end
|
20
|
+
|
21
|
+
## environment variables
|
22
|
+
METAFLAC = ENV['METAFLAC'] || 'metaflac'
|
23
|
+
FLAC = ENV['FLAC'] || 'flac'
|
24
|
+
FLAC_OPTS = ENV['FLAC_OPTS'] || '' ## -c -d will be appended
|
25
|
+
LAME = ENV['LAME'] || 'lame'
|
26
|
+
LAME_OPTS = ENV['LAME_OPTS'] || '-V0' ## override tags or encoding here
|
27
|
+
|
28
|
+
## I monkeypatch String to provide double-quote escaping; pure sugar
|
29
|
+
class String; def dqe; self.gsub('"', '\\"') end; end
|
30
|
+
|
31
|
+
## key is FLAC tag key, value is LAME cmdline opt
|
32
|
+
tag_map = {
|
33
|
+
'ARTIST' => '--ta',
|
34
|
+
'ALBUM' => '--tl',
|
35
|
+
'TITLE' => '--tt',
|
36
|
+
'DATE' => '--ty',
|
37
|
+
'TRACKNUMBER' => '--tn',
|
38
|
+
'COMMENTS' => '--tc',
|
39
|
+
}
|
40
|
+
|
41
|
+
ARGV.each do |flac|
|
42
|
+
if (flac == '-h' || flac == '--help')
|
43
|
+
puts usage
|
44
|
+
exit 0
|
45
|
+
end
|
46
|
+
|
47
|
+
mp3 = File.basename(flac, '.flac') + '.mp3'
|
48
|
+
|
49
|
+
metadata = %x{#{METAFLAC} --list "#{flac.dqe}"}
|
50
|
+
tags = tag_map.keys.inject({}) do |hsh,field|
|
51
|
+
if m=metadata.match(/#{field}=(.+?)\s*\n/)
|
52
|
+
hsh.merge(field => m[1])
|
53
|
+
else
|
54
|
+
hsh
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
lame_tags = tags.keys.inject('') do |tagstr,field|
|
59
|
+
tagstr + %Q{ #{tag_map[field]} "#{tags[field].dqe}" }
|
60
|
+
end
|
61
|
+
cmd = %Q{#{FLAC} #{FLAC_OPTS} -c -d "#{flac.dqe}" | #{LAME} #{lame_tags} #{LAME_OPTS} - "#{mp3.dqe}"}
|
62
|
+
system(cmd)
|
63
|
+
end
|
64
|
+
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flac2lame
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.2'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- pete gamache
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-17 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |2
|
14
|
+
flac2lame creates properly-tagged MP3s from properly-tagged FLACs.
|
15
|
+
It requires 'flac' and 'lame' to be installed.
|
16
|
+
Type 'flac2lame -h' for usage instructions.
|
17
|
+
email: pete@gamache.org
|
18
|
+
executables:
|
19
|
+
- flac2lame
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- bin/flac2lame
|
24
|
+
homepage: https://github.com/gamache/flac2lame
|
25
|
+
licenses:
|
26
|
+
- MIT
|
27
|
+
metadata: {}
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.0.0.rc.2
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: Create properly-tagged MP3s from properly-tagged FLACs
|
48
|
+
test_files: []
|