mp3gain 1.0.0 → 1.0.1
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/README.md +9 -6
- data/lib/mp3gain/chainable.rb +30 -0
- data/lib/mp3gain.rb +10 -3
- data/mp3gain.gemspec +1 -1
- metadata +4 -4
- data/lib/.DS_Store +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da0afc0b561a79182fb3c649780977e80ef5e8ddad9214f5e6d88dc68c825448
|
|
4
|
+
data.tar.gz: c31cfdab79022b4b6bc20ed598b0bd7835f05ec1ae64db6ccbe27addabf9d6b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b77156a18879c6209a3c696b1cf29c0d637fbca2fee2a8508b80273ab016c5d790b01f511f84474516ce23be47b4143dead637fe6eb300f35ae1098f8a6559c
|
|
7
|
+
data.tar.gz: eea8d9c9dc9a437a58eaa069a7fba235f49d4b6e99fdc6c082fbd30ad1797fea2468d3c860c101c237a853fb8c698c8685981994dcffc003911042f704c98eae
|
data/README.md
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
# RubyMp3gain
|
|
2
2
|
|
|
3
|
-
RubyMP3Gain is an [Mp3Gain](http://mp3gain.sourceforge.net/) wrapper written in Ruby.
|
|
3
|
+
RubyMP3Gain is an [Mp3Gain](http://mp3gain.sourceforge.net/) wrapper written in Ruby. Works also with e.g. [aacgain](https://formulae.brew.sh/formula/aacgain) for Mac OSX.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
+
from [rubygems](https://rubygems.org/gems/mp3gain) using
|
|
8
|
+
```shell
|
|
9
|
+
gem install mp3gain
|
|
10
|
+
```
|
|
11
|
+
or from the sources using
|
|
7
12
|
```shell
|
|
8
13
|
gem build mp3gain.gemspec
|
|
9
14
|
```
|
|
@@ -11,11 +16,6 @@ And then execute:
|
|
|
11
16
|
```shell
|
|
12
17
|
$ gem install mp3gain-1.0.0.gem
|
|
13
18
|
```
|
|
14
|
-
Or from ruby gems using
|
|
15
|
-
or
|
|
16
|
-
```shell
|
|
17
|
-
gem install mp3gain
|
|
18
|
-
```
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
@@ -25,6 +25,9 @@ mp3gain = Mp3gain.init("path/to/MP3Gain/binary")
|
|
|
25
25
|
## optional target db and preserve timestamps
|
|
26
26
|
mp3gain = Mp3gain.init("aacgain", 100, preserve_timestamp: false)
|
|
27
27
|
|
|
28
|
+
# or use a chainable to
|
|
29
|
+
mp3gain =Mp3gain.path("path/to/MP3Gain/binary").with_target_db(100).do_preserve_timestamp(preserve: false)
|
|
30
|
+
|
|
28
31
|
# print current version
|
|
29
32
|
mp3gain.version
|
|
30
33
|
# analyze the gain of the given files
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mp3gain
|
|
4
|
+
# Offers methods like path, target_db etc. to be chained together
|
|
5
|
+
module Chainable
|
|
6
|
+
|
|
7
|
+
attr_accessor :mp3gain
|
|
8
|
+
|
|
9
|
+
def path(mp3_gain_path)
|
|
10
|
+
raise ArgumentError, 'Mp3gain path can\'t be null' if mp3_gain_path.nil?
|
|
11
|
+
|
|
12
|
+
@mp3gain = Mp3gain.new(mp3_gain_path)
|
|
13
|
+
@mp3gain.mp3gain = @mp3gain
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def with_target_db(target_db)
|
|
17
|
+
raise 'Please set a path first.' if @mp3gain.nil?
|
|
18
|
+
|
|
19
|
+
@mp3gain.target_db = target_db
|
|
20
|
+
@mp3gain
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def do_preserve_timestamp(preserve: true)
|
|
24
|
+
raise 'Please set a path first.' if @mp3gain.nil?
|
|
25
|
+
|
|
26
|
+
@mp3gain.preserve_timestamp = preserve
|
|
27
|
+
@mp3gain
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/lib/mp3gain.rb
CHANGED
|
@@ -2,24 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
require 'open3'
|
|
4
4
|
|
|
5
|
+
require 'mp3gain/chainable'
|
|
5
6
|
require 'mp3gain/add_gain_change'
|
|
6
7
|
require 'mp3gain/apply_gain_change'
|
|
7
8
|
require 'mp3gain/recommended_gain_change'
|
|
8
9
|
|
|
9
10
|
# wrapper for mp3gain http://mp3gain.sourceforge.net/
|
|
10
11
|
module Mp3gain
|
|
12
|
+
extend Chainable
|
|
11
13
|
|
|
12
14
|
def self.init(mp3gain_path,
|
|
13
15
|
target_db = 89,
|
|
14
16
|
preserve_timestamp: true)
|
|
15
|
-
Mp3gain.new(mp3gain_path, target_db, preserve_timestamp)
|
|
17
|
+
Mp3gain.new(mp3gain_path, target_db, preserve_timestamp: preserve_timestamp)
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
# Mp3gain entity to analyze and apply gain
|
|
19
21
|
class Mp3gain
|
|
22
|
+
include Chainable
|
|
20
23
|
|
|
21
24
|
MAX_FILES = 15
|
|
22
25
|
|
|
26
|
+
attr_accessor :mp3gain_path, :target_db, :preserve_timestamp
|
|
27
|
+
|
|
23
28
|
# constructor
|
|
24
29
|
#
|
|
25
30
|
# @param [String] mp3gain_path - path to mp3gain binary
|
|
@@ -27,7 +32,7 @@ module Mp3gain
|
|
|
27
32
|
# @param [Boolean] preserve_timestamp - keeps the existing timestamps when changing gain
|
|
28
33
|
def initialize(mp3gain_path,
|
|
29
34
|
target_db = 89,
|
|
30
|
-
preserve_timestamp
|
|
35
|
+
preserve_timestamp: true)
|
|
31
36
|
@mp3gain_path = mp3gain_path
|
|
32
37
|
@target_db = target_db
|
|
33
38
|
@preserve_timestamp = preserve_timestamp
|
|
@@ -214,4 +219,6 @@ module Mp3gain
|
|
|
214
219
|
|
|
215
220
|
private :apply_gain, :file_size?
|
|
216
221
|
end
|
|
217
|
-
end
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
|
data/mp3gain.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mp3gain
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Christian Feier
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-11-
|
|
11
|
+
date: 2021-11-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Takes mp3gain/aacgain binary path as an argument and offers methods to
|
|
14
14
|
analyze and modify the track/album gain of mp3 files.
|
|
@@ -24,10 +24,10 @@ files:
|
|
|
24
24
|
- LICENSE.txt
|
|
25
25
|
- README.md
|
|
26
26
|
- Rakefile
|
|
27
|
-
- lib/.DS_Store
|
|
28
27
|
- lib/mp3gain.rb
|
|
29
28
|
- lib/mp3gain/add_gain_change.rb
|
|
30
29
|
- lib/mp3gain/apply_gain_change.rb
|
|
30
|
+
- lib/mp3gain/chainable.rb
|
|
31
31
|
- lib/mp3gain/recommended_gain_change.rb
|
|
32
32
|
- mp3gain.gemspec
|
|
33
33
|
homepage: https://github.com/cfe86/RubyMp3gain
|
|
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '0'
|
|
54
54
|
requirements: []
|
|
55
|
-
rubygems_version: 3.2.
|
|
55
|
+
rubygems_version: 3.2.15
|
|
56
56
|
signing_key:
|
|
57
57
|
specification_version: 4
|
|
58
58
|
summary: Simple wrapper for some common mp3gain console commands.
|
data/lib/.DS_Store
DELETED
|
Binary file
|