taffy 1.0.0

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.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +19 -0
  3. data/README.md +55 -0
  4. data/bin/taffy +104 -0
  5. data/taffy.gemspec +17 -0
  6. metadata +68 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a5bf0ec96d13e39c428d1cefc0d512c18cf00d63
4
+ data.tar.gz: 83f113d30021a166a9ccf3496253f9e418d4ea73
5
+ SHA512:
6
+ metadata.gz: 6abd3d0c624c8b9b022285fecd2c58b9783c0194055eb973d3450933303b72c78462b725238243d2191fd2534c3e1f906785f268bd172661a49be7018f300d5a
7
+ data.tar.gz: 05e2ceddb7183f239accddbb279c3f50f06cc598f8635a64aecff6fe889a7cb7e77bc27bcca468b5f210d2f991fadb6a0c90e922a3232773f475cf561ed32e31
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2015 Brandon Mulcahy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ Taffy
2
+ =====
3
+ Taffy is a command-line interface for reading and writing audio (and
4
+ video) metadata, as supported by [TagLib](http://taglib.github.io/).
5
+ That means it can edit tags for MP3, Ogg Vorbis, FLAC, WAV, and MP4
6
+ files, along with a few other file formats I've never used.
7
+
8
+ Installation
9
+ ------------
10
+ gem install taffy
11
+
12
+ Usage
13
+ -----
14
+ Usage: taffy [options] file ...
15
+
16
+ Tag options:
17
+ -l, --album=ALBUM Set album tag
18
+ -r, --artist=ARTIST Set artist tag
19
+ -c, --comment=COMMENT Set comment tag
20
+ -g, --genre=GENRE Set genre tag
21
+ -t, --title=TITLE Set title tag
22
+ -n, --track=TRACK Set track tag
23
+ -y, --year=YEAR Set year tag
24
+ --no-album Clear album tag
25
+ --no-artist Clear artist tag
26
+ --no-comment Clear comment tag
27
+ --no-genre Clear genre tag
28
+ --no-title Clear title tag
29
+ --no-track Clear track tag
30
+ --no-year Clear year tag
31
+ --clear Clear all tags
32
+
33
+ If no tag options are given, file tags are printed instead.
34
+
35
+ Other options:
36
+ -h, --help Show this message
37
+ --version Show version
38
+
39
+ Examples
40
+ --------
41
+ Tag an audio file with a title:
42
+
43
+ taffy -t "Queen of the Mole People" song.mp3
44
+
45
+ Tag a series of files with an artist, album, and year:
46
+
47
+ taffy -r Deerhoof -l "The Man, The King, The Girl" -y 1997 *.mp3
48
+
49
+ Clear tags from a file:
50
+
51
+ taffy --clear song.mp3
52
+
53
+ Etymology
54
+ ---------
55
+ Taffy tags audio files for you.
data/bin/taffy ADDED
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'taglib'
5
+
6
+ VERSION = [1, 0, 0]
7
+
8
+ FIELDS = [
9
+ ['l', 'album', String],
10
+ ['r', 'artist', String],
11
+ ['c', 'comment', String],
12
+ ['g', 'genre', String],
13
+ ['t', 'title', String],
14
+ ['n', 'track', Integer],
15
+ ['y', 'year', Integer],
16
+ ]
17
+
18
+ actions = []
19
+ status = 0
20
+
21
+ options = OptionParser.new do |opts|
22
+ opts.banner += " file ..."
23
+
24
+ opts.separator ""
25
+ opts.separator "Tag options:"
26
+
27
+ FIELDS.each do |f|
28
+ short = "-#{f[0]}#{f[1].upcase}"
29
+ long = "--#{f[1]}=#{f[1].upcase}"
30
+ opts.on(short, long, f[2], "Set #{f[1]} tag") do |x|
31
+ actions << ->(r) { r.send("#{f[1]}=", x) }
32
+ end
33
+ end
34
+
35
+ FIELDS.each do |f|
36
+ long = "--no-#{f[1]}"
37
+ opts.on(long, "Clear #{f[1]} tag") do
38
+ actions << ->(r) { r.send("#{f[1]}=", f[2] == String ? nil : 0) }
39
+ end
40
+ end
41
+
42
+ opts.on("--clear", "Clear all tags") do
43
+ FIELDS.each do |f|
44
+ actions << ->(r) { r.send("#{f[1]}=", f[2] == String ? nil : 0) }
45
+ end
46
+ end
47
+
48
+ opts.separator ""
49
+ opts.separator "If no tag options are given, file tags are printed instead."
50
+ opts.separator ""
51
+ opts.separator "Other options:"
52
+
53
+ opts.on_tail("-h", "--help", "Show this message") do
54
+ puts opts
55
+ exit
56
+ end
57
+
58
+ opts.on_tail("--version", "Show version") do
59
+ puts VERSION.join('.')
60
+ exit
61
+ end
62
+ end
63
+
64
+ begin
65
+ options.parse!
66
+ rescue OptionParser::ParseError => err
67
+ warn(err)
68
+ exit(1)
69
+ end
70
+
71
+ if ARGV.empty?
72
+ puts options
73
+ exit(1)
74
+ end
75
+
76
+ def print_info(filename, tag)
77
+ puts filename
78
+
79
+ FIELDS.each do |f|
80
+ value = tag.send(f[1])
81
+ puts "#{f[1]}:#{' ' * (8 - f[1].size)}#{value}" if value && value != 0
82
+ end
83
+
84
+ puts
85
+ end
86
+
87
+ ARGV.each do |filename|
88
+ TagLib::FileRef.open(filename) do |fileref|
89
+ if fileref.null?
90
+ warn("Could not open file: #{filename}")
91
+ status = 2
92
+ next
93
+ end
94
+
95
+ if actions.empty?
96
+ print_info(filename, fileref.tag)
97
+ else
98
+ actions.each { |action| action.call(fileref.tag) }
99
+ fileref.save
100
+ end
101
+ end
102
+ end
103
+
104
+ exit(status)
data/taffy.gemspec ADDED
@@ -0,0 +1,17 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'taffy'
3
+ s.version = '1.0.0'
4
+ s.date = '2015-04-26'
5
+ s.summary = 'command-line media tagging interface'
6
+ s.description = "A command-line interface for reading and writing audio \
7
+ metadata.".squeeze(' ')
8
+ s.authors = ['Brandon Mulcahy']
9
+ s.email = 'brandon@jangler.info'
10
+ s.files = `git ls-files`.split
11
+ s.homepage = 'https://github.com/jangler/taffy'
12
+ s.license = 'MIT'
13
+
14
+ s.executables << 'taffy'
15
+ s.add_runtime_dependency 'taglib-ruby', '~> 0.7', '>= 0.7.0'
16
+ s.required_ruby_version = '>= 2.0.0'
17
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: taffy
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Brandon Mulcahy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: taglib-ruby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.7.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.7'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.7.0
33
+ description: A command-line interface for reading and writing audio metadata.
34
+ email: brandon@jangler.info
35
+ executables:
36
+ - taffy
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - LICENSE
41
+ - README.md
42
+ - bin/taffy
43
+ - taffy.gemspec
44
+ homepage: https://github.com/jangler/taffy
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 2.0.0
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 2.4.5
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: command-line media tagging interface
68
+ test_files: []