mediafile 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 307185529981f4c30a6c4b5f0d0b62eafce6b6d7
4
- data.tar.gz: 452c79b918f2497ee19d1bb65879fe4610323ae3
3
+ metadata.gz: 7a7bcf6ac66198cbc1ced8c4dad57a421b972dcd
4
+ data.tar.gz: 67ca3e8a2a6d9faf352238812ff16c437a41e95f
5
5
  SHA512:
6
- metadata.gz: 7decae2949b7f13e4d158f4bb1ff02954859328030e6142514b8efd37a3dd28c57e00a261ffb965c7681712e3e752be840b0240c2c84248dc6e1081a39324033
7
- data.tar.gz: 5ef40fe3ec1e51688fe6e9c1ba7ca3e4bb41cd165ce42a7aa25293fdb8cd9f7fd9d18fcb7ee02a42baf4b4475326a56f6eb6e5b78a83e3d0a64af168bbdeed9c
6
+ metadata.gz: 26bdcdbea2842a5d3567cee06019d6a26dccbf3548ac6e14d674a7c4eaa4e2da7440eee7d2a6c77a797ec8238fefb9f04f4899d2c67e9c71381a9be3360d2790
7
+ data.tar.gz: c68c42c8ebb3ad8260b2dc54a93d05bac6f7803ecef6d0c9a94b06d026de08551f4b7223e8bf39de0e368c8aaff6d058fa17e795c9cf99190699333cafa8dcb9
data/bin/music_cp CHANGED
@@ -23,6 +23,7 @@ progress = true
23
23
  count = `grep -c '^processor' /proc/cpuinfo`.strip.to_i/2|1
24
24
  transcode = { flac: :mp3, wav: :mp3 }
25
25
  exclude_patterns = []
26
+ album_artist = nil
26
27
  file_types = "{flac,mp3,MP3,FLAC,wav,WAV,m4a,M4A}"
27
28
 
28
29
  opts = OptionParser.new do |opt|
@@ -61,6 +62,9 @@ opts = OptionParser.new do |opt|
61
62
  "Number of threads to spawn, useful for transcoding. Default: #{count}" ) do |n|
62
63
  count = n.to_i
63
64
  end
65
+ opt.on("--set-aa ALBUM_ARTIST", String, "Set the album_artist for all tracks") do |a|
66
+ album_artist = a
67
+ end
64
68
  opt.on("-V", "--version", "Disply the version and exit") do
65
69
  puts MediaFile::VERSION
66
70
  exit 0
@@ -140,7 +144,8 @@ copier = MediaFile::BulkMediaCopy.new(
140
144
  destination_root: dest,
141
145
  verbose: verbose,
142
146
  transcode: transcode,
143
- progress: progress
147
+ progress: progress,
148
+ album_artist: album_artist
144
149
  )
145
150
 
146
151
  copier.run count
@@ -1,5 +1,10 @@
1
1
  module MediaFile; class BulkMediaCopy
2
- def initialize( source, destination_root: ".", verbose: false, progress: false, transcode: {} )
2
+ def initialize(source,
3
+ album_artist: nil,
4
+ destination_root: ".",
5
+ progress: false,
6
+ transcode: {},
7
+ verbose: false)
3
8
  source = case source
4
9
  when String
5
10
  [source]
@@ -16,6 +21,7 @@ module MediaFile; class BulkMediaCopy
16
21
  @work = source.map { |s|
17
22
  MediaFile.new(s,
18
23
  base_dir: @destination_root,
24
+ force_album_artist: album_artist,
19
25
  verbose: @verbose,
20
26
  printer: proc{ |msg| self.safe_print( msg ) }
21
27
  )
@@ -5,14 +5,19 @@ module MediaFile; class MediaFile
5
5
 
6
6
  attr_reader :source, :type, :name, :base_dir
7
7
 
8
- def initialize(path, verbose: false, base_dir: '.', printer: proc {|msg| puts msg})
9
- @source = path
8
+ def initialize(path,
9
+ base_dir: '.',
10
+ force_album_artist: nil,
11
+ printer: proc {|msg| puts msg},
12
+ verbose: false)
10
13
  @base_dir = base_dir
11
- @verbose = verbose
12
- @name = File.basename( @source, File.extname( @source ) )
13
- @type = path[/(\w+)$/].downcase.to_sym
14
- @printer = printer
15
14
  @destinations = Hash.new{ |k,v| k[v] = {} }
15
+ @force_album_artist = force_album_artist
16
+ @name = File.basename( path, File.extname( path ) )
17
+ @printer = printer
18
+ @source = path
19
+ @type = path[/(\w+)$/].downcase.to_sym
20
+ @verbose = verbose
16
21
  end
17
22
 
18
23
  def source_md5
@@ -289,6 +294,11 @@ module MediaFile; class MediaFile
289
294
  end
290
295
  end
291
296
  end
297
+ if @force_album_artist
298
+ @album_artist = @force_album_artist
299
+ else
300
+ @album_artist ||= @artist
301
+ end
292
302
  @red = true
293
303
  end
294
304
  end; end
@@ -1,3 +1,3 @@
1
1
  module MediaFile
2
- VERSION = "0.1.3" unless defined?(::MediaFile::VERSION)
2
+ VERSION = "0.1.4" unless defined?(::MediaFile::VERSION)
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mediafile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Harvey-Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-17 00:00:00.000000000 Z
11
+ date: 2016-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: taglib-ruby
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  version: '0'
65
65
  requirements: []
66
66
  rubyforge_project:
67
- rubygems_version: 2.6.2
67
+ rubygems_version: 2.6.6
68
68
  signing_key:
69
69
  specification_version: 4
70
70
  summary: Parse media file metadata.