taffy 1.0.0 → 1.1.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 +43 -34
- data/bin/taffy +41 -9
- data/taffy.gemspec +4 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 727ec7db507261872cfb085e9f2cb700ce306432
|
4
|
+
data.tar.gz: 0372a2d4f1751c73fffdbe78f9bfe98e2b0e1bd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6df863135ca65cc7c494029d0a706042f4fe1009ef66d02d2132f5408b5fb7b1e63beb676e891c134a8c8025715b9a79f4d150c3bc71feb62bae5f7eab074036
|
7
|
+
data.tar.gz: b9ee4171e030a1d3d45fdbb3b12bc21e86ee90c46ce757a511dae335ce517a39e83e05b888660be601c59925760707683fd1fe5f732a37ccac3aa6fe5c1914f5
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Taffy
|
2
2
|
=====
|
3
|
-
Taffy is a command-line
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
Taffy is a command-line tool for reading and writing audio metadata, as
|
4
|
+
supported by [TagLib](http://taglib.github.io/). That means it can edit
|
5
|
+
tags for MP3, Ogg Vorbis, FLAC, WAV, and MP4 files, along with a few
|
6
|
+
other file formats I've never used.
|
7
7
|
|
8
8
|
Installation
|
9
9
|
------------
|
@@ -11,44 +11,53 @@ Installation
|
|
11
11
|
|
12
12
|
Usage
|
13
13
|
-----
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
+
Filename options:
|
34
|
+
--rename SPEC Rename file based on tags
|
35
|
+
|
36
|
+
If no options are given, file tags are printed instead.
|
37
|
+
|
38
|
+
In a filename spec, a sequence such as %R or %r stands for
|
39
|
+
the corresponding tag, in this case the artist name. %R
|
40
|
+
leaves letter case intact, while %r downcases the tag. A
|
41
|
+
sequence such as %_t maps special characters in the tag
|
42
|
+
to the given substitute, in this case an underscore.
|
43
|
+
|
44
|
+
Other options:
|
45
|
+
-h, --help Show this message and exit
|
46
|
+
--version Show version and exit
|
38
47
|
|
39
48
|
Examples
|
40
49
|
--------
|
41
|
-
|
42
|
-
|
43
|
-
taffy
|
50
|
+
Print tags from an audio file:
|
51
|
+
|
52
|
+
taffy song.mp3
|
44
53
|
|
45
54
|
Tag a series of files with an artist, album, and year:
|
46
55
|
|
47
56
|
taffy -r Deerhoof -l "The Man, The King, The Girl" -y 1997 *.mp3
|
48
57
|
|
49
|
-
|
50
|
-
|
51
|
-
taffy --
|
58
|
+
Tag an audio file, then rename it to "14 - Queen of the Mole People.mp3":
|
59
|
+
|
60
|
+
taffy -n 14 -t "Queen of the Mole People" --rename "%n - %T" song.mp3
|
52
61
|
|
53
62
|
Etymology
|
54
63
|
---------
|
data/bin/taffy
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'optparse'
|
4
|
+
require 'shellwords'
|
5
|
+
|
4
6
|
require 'taglib'
|
5
7
|
|
6
|
-
VERSION = [1,
|
8
|
+
VERSION = [1, 1, 1]
|
7
9
|
|
8
10
|
FIELDS = [
|
9
11
|
['l', 'album', String],
|
@@ -16,6 +18,7 @@ FIELDS = [
|
|
16
18
|
]
|
17
19
|
|
18
20
|
actions = []
|
21
|
+
rename_spec = nil
|
19
22
|
status = 0
|
20
23
|
|
21
24
|
options = OptionParser.new do |opts|
|
@@ -26,19 +29,17 @@ options = OptionParser.new do |opts|
|
|
26
29
|
|
27
30
|
FIELDS.each do |f|
|
28
31
|
short = "-#{f[0]}#{f[1].upcase}"
|
29
|
-
long = "--#{f[1]}
|
32
|
+
long = "--#{f[1]} #{f[1].upcase}"
|
30
33
|
opts.on(short, long, f[2], "Set #{f[1]} tag") do |x|
|
31
34
|
actions << ->(r) { r.send("#{f[1]}=", x) }
|
32
35
|
end
|
33
36
|
end
|
34
|
-
|
35
37
|
FIELDS.each do |f|
|
36
38
|
long = "--no-#{f[1]}"
|
37
39
|
opts.on(long, "Clear #{f[1]} tag") do
|
38
40
|
actions << ->(r) { r.send("#{f[1]}=", f[2] == String ? nil : 0) }
|
39
41
|
end
|
40
42
|
end
|
41
|
-
|
42
43
|
opts.on("--clear", "Clear all tags") do
|
43
44
|
FIELDS.each do |f|
|
44
45
|
actions << ->(r) { r.send("#{f[1]}=", f[2] == String ? nil : 0) }
|
@@ -46,17 +47,30 @@ options = OptionParser.new do |opts|
|
|
46
47
|
end
|
47
48
|
|
48
49
|
opts.separator ""
|
49
|
-
opts.separator "
|
50
|
+
opts.separator "Filename options:"
|
51
|
+
|
52
|
+
opts.on("--rename SPEC", String, "Rename file based on tags") do |spec|
|
53
|
+
rename_spec = spec
|
54
|
+
end
|
55
|
+
|
56
|
+
opts.separator ""
|
57
|
+
opts.separator "If no options are given, file tags are printed instead."
|
58
|
+
opts.separator ""
|
59
|
+
opts.separator "In a filename spec, a sequence such as %R or %r stands for"
|
60
|
+
opts.separator "the corresponding tag, in this case the artist name. %R"
|
61
|
+
opts.separator "leaves letter case intact, while %r downcases the tag. A"
|
62
|
+
opts.separator "sequence such as %_t maps special characters in the tag"
|
63
|
+
opts.separator "to the given substitute, in this case an underscore."
|
50
64
|
opts.separator ""
|
51
65
|
opts.separator "Other options:"
|
52
66
|
|
53
|
-
opts.on_tail("-h", "--help", "Show this message") do
|
67
|
+
opts.on_tail("-h", "--help", "Show this message and exit") do
|
54
68
|
puts opts
|
55
69
|
exit
|
56
70
|
end
|
57
71
|
|
58
|
-
opts.on_tail("--version", "Show version") do
|
59
|
-
puts VERSION.join('.')
|
72
|
+
opts.on_tail("--version", "Show version and exit") do
|
73
|
+
puts "taffy #{VERSION.join('.')}"
|
60
74
|
exit
|
61
75
|
end
|
62
76
|
end
|
@@ -84,6 +98,19 @@ def print_info(filename, tag)
|
|
84
98
|
puts
|
85
99
|
end
|
86
100
|
|
101
|
+
def rename(tag, spec)
|
102
|
+
FIELDS.each do |f|
|
103
|
+
tag_string = tag.send(f[1]).to_s
|
104
|
+
tag_string = tag_string.rjust(2, '0') if f[1] == 'track'
|
105
|
+
spec.gsub!(/%(\W|_)?(#{f[0]}|#{f[0].upcase})/) do |match|
|
106
|
+
sub = $2 == f[0] ? tag_string.downcase : tag_string
|
107
|
+
match.size == 3 ? sub.shellescape.gsub(/\\./, $1) : sub
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
spec
|
112
|
+
end
|
113
|
+
|
87
114
|
ARGV.each do |filename|
|
88
115
|
TagLib::FileRef.open(filename) do |fileref|
|
89
116
|
if fileref.null?
|
@@ -92,12 +119,17 @@ ARGV.each do |filename|
|
|
92
119
|
next
|
93
120
|
end
|
94
121
|
|
95
|
-
if actions.empty?
|
122
|
+
if actions.empty? and !rename_spec
|
96
123
|
print_info(filename, fileref.tag)
|
97
124
|
else
|
98
125
|
actions.each { |action| action.call(fileref.tag) }
|
99
126
|
fileref.save
|
100
127
|
end
|
128
|
+
|
129
|
+
if rename_spec
|
130
|
+
name = rename(fileref.tag, rename_spec) + File.extname(filename)
|
131
|
+
File.rename(filename, File.join(File.dirname(filename), name))
|
132
|
+
end
|
101
133
|
end
|
102
134
|
end
|
103
135
|
|
data/taffy.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'taffy'
|
3
|
-
s.version = '1.
|
4
|
-
s.date = '2015-04-
|
5
|
-
s.summary = 'command-line
|
6
|
-
s.description = "A command-line
|
3
|
+
s.version = '1.1.1'
|
4
|
+
s.date = '2015-04-27'
|
5
|
+
s.summary = 'A command-line audio tagging tool'
|
6
|
+
s.description = "A command-line tool for reading and writing audio \
|
7
7
|
metadata.".squeeze(' ')
|
8
8
|
s.authors = ['Brandon Mulcahy']
|
9
9
|
s.email = 'brandon@jangler.info'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taffy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mulcahy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: taglib-ruby
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.7.0
|
33
|
-
description: A command-line
|
33
|
+
description: A command-line tool for reading and writing audio metadata.
|
34
34
|
email: brandon@jangler.info
|
35
35
|
executables:
|
36
36
|
- taffy
|
@@ -64,5 +64,5 @@ rubyforge_project:
|
|
64
64
|
rubygems_version: 2.4.5
|
65
65
|
signing_key:
|
66
66
|
specification_version: 4
|
67
|
-
summary: command-line
|
67
|
+
summary: A command-line audio tagging tool
|
68
68
|
test_files: []
|