id3dit 1.1.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.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +24 -0
- data/Makefile +50 -0
- data/README.md +60 -0
- data/bin/id3dit +279 -0
- data/examples/id3dit_20151116_143921.png +0 -0
- data/examples/id3dit_20151116_144224.png +0 -0
- data/id3dit.gemspec +31 -0
- data/id3dit.sublime-project +10 -0
- data/lib/id3dit/tags.rb +125 -0
- data/lib/id3dit/version.rb +20 -0
- data/lib/id3dit.rb +3 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 50dd9d679398dbd0314f2c761339fb3ec38b2ffa
|
4
|
+
data.tar.gz: cb33c5b19ce5172a5e6819a7db8272e5490f4716
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7eab5ec485e60608920f1bcb7cfcad7dddf237971d05f7096cf943a06562b3757fa11c5ddda8b8e211da6305e8c65d3fccfbef09a4794527f223cb79b9bca4d6
|
7
|
+
data.tar.gz: d163cce4367256a93a9b114fc2a0e688694c88d9e645023b012236f5c5860252474a0f78f78a21a5333c2780e95153662b849b91a31f864d2c0872ec529c79d0
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
id3dit (1.1.0)
|
5
|
+
highline (~> 1.7)
|
6
|
+
id3lib-ruby (~> 0.6)
|
7
|
+
rainbow (~> 2.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
highline (1.7.8)
|
13
|
+
id3lib-ruby (0.6.0)
|
14
|
+
rainbow (2.0.0)
|
15
|
+
|
16
|
+
PLATFORMS
|
17
|
+
ruby
|
18
|
+
|
19
|
+
DEPENDENCIES
|
20
|
+
bundler (~> 1.10)
|
21
|
+
id3dit!
|
22
|
+
|
23
|
+
BUNDLED WITH
|
24
|
+
1.10.2
|
data/Makefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
MV = mv -nv
|
3
|
+
RM = rm -rf
|
4
|
+
MKDIR = mkdir -p
|
5
|
+
BUNDLER = bundle
|
6
|
+
GEM_NAME = id3dit
|
7
|
+
GEMSPEC_FILE = $(GEM_NAME).gemspec
|
8
|
+
|
9
|
+
|
10
|
+
.PHONY: all
|
11
|
+
all: setup
|
12
|
+
|
13
|
+
.PHONY: setup
|
14
|
+
setup: .setup
|
15
|
+
|
16
|
+
.setup:
|
17
|
+
$(BUNDLER) install
|
18
|
+
touch $@
|
19
|
+
|
20
|
+
.PHONY: install
|
21
|
+
install:
|
22
|
+
gem_file=$$(gem build $(GEMSPEC_FILE) | grep 'File:' | tail -1 | awk '{ print $$2 }'); \
|
23
|
+
sudo gem install $$gem_file; \
|
24
|
+
$(RM) $$gem_file
|
25
|
+
|
26
|
+
.PHONY: uninstall
|
27
|
+
uninstall:
|
28
|
+
sudo gem uninstall $(GEM_NAME)
|
29
|
+
|
30
|
+
.PHONY: update
|
31
|
+
update:
|
32
|
+
$(BUNDLER) update
|
33
|
+
|
34
|
+
.PHONY: clean
|
35
|
+
clean:
|
36
|
+
$(RM) .setup
|
37
|
+
$(RM) Gemfile.lock
|
38
|
+
|
39
|
+
.PHONY: release
|
40
|
+
release: | releases
|
41
|
+
set -e; \
|
42
|
+
gem_file=$$(gem build $(GEMSPEC_FILE) | grep 'File:' | tail -1 | awk '{ print $$2 }'); \
|
43
|
+
dst="releases/$$gem_file"; \
|
44
|
+
[ ! -f $$dst ]; \
|
45
|
+
$(MV) $$gem_file releases; \
|
46
|
+
gem push $$dst; \
|
47
|
+
echo 'done'
|
48
|
+
|
49
|
+
releases:
|
50
|
+
$(MKDIR) $@
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# ID3dit
|
2
|
+
|
3
|
+
[ID3](https://en.wikipedia.org/wiki/ID3) tags editor for the command line written in Ruby.
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+

|
8
|
+
|
9
|
+
## Install
|
10
|
+
|
11
|
+
The preferred method of installation is via RubyGems.org:
|
12
|
+
<https://rubygems.org/gems/id3dit>
|
13
|
+
|
14
|
+
gem install id3dit
|
15
|
+
|
16
|
+
or via `Gemfile`:
|
17
|
+
|
18
|
+
gem 'id3dit', '~>1.1'
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Video: <https://asciinema.org/a/a3tt619cc1r529av8skskgz5w>
|
23
|
+
|
24
|
+
### Print Help
|
25
|
+
|
26
|
+
id3dit -h
|
27
|
+
|
28
|
+
### Interactive Mode
|
29
|
+
|
30
|
+
id3dit FILES...
|
31
|
+
|
32
|
+
### Set Tag
|
33
|
+
|
34
|
+
id3dit --artist STRING FILES...
|
35
|
+
|
36
|
+
### Remove All Tags
|
37
|
+
|
38
|
+
id3dit --remove-all FILES...
|
39
|
+
|
40
|
+
### Remove a Tag
|
41
|
+
|
42
|
+
id3dit --remove-comment FILES...
|
43
|
+
|
44
|
+
### Examples
|
45
|
+
|
46
|
+
- `id3dit my_music.mp3`
|
47
|
+
- `id3dit track01.mp3 track02.mp3`
|
48
|
+
- `id3dit --artist EAV track01.mp3`
|
49
|
+
- `id3dit --artist AC/DC *.mp3`
|
50
|
+
- `id3dit --year 1987 --bpm 180 track01.mp3`
|
51
|
+
- `id3dit --remove-all track01.mp3`
|
52
|
+
- `id3dit --remove-comment track01.mp3 track02.mp3`
|
53
|
+
- `id3dit --remove-disc --remove-track track01.mp3 track02.mp3`
|
54
|
+
|
55
|
+
## License
|
56
|
+
Copyright (C) 2015 Christian Mayer <http://fox21.at>
|
57
|
+
|
58
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
59
|
+
|
60
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
data/bin/id3dit
ADDED
@@ -0,0 +1,279 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: UTF-8
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'id3lib'
|
6
|
+
require 'highline/import'
|
7
|
+
require 'rainbow'
|
8
|
+
require 'id3dit'
|
9
|
+
|
10
|
+
|
11
|
+
options = {
|
12
|
+
:interactive => true,
|
13
|
+
}
|
14
|
+
opts = OptionParser.new do |opts|
|
15
|
+
opts.banner = 'Usage: id3dit [OPTIONS...] FILES...'
|
16
|
+
opts.separator('')
|
17
|
+
opts.separator('Options:')
|
18
|
+
|
19
|
+
ID3dit::USED_TAGS.each do |tag_name, tag|
|
20
|
+
opts.on("--#{tag_name} STRING", "Set new value for '#{tag_name}' tag. (#{tag[:id]})") do |v|
|
21
|
+
options[:interactive] = false
|
22
|
+
options["set_tag_#{tag_name}"] = v
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on('-r', '--remove-all', 'Remove all tags.') do |v|
|
27
|
+
options[:interactive] = false
|
28
|
+
options['remove_all_tags'] = true
|
29
|
+
end
|
30
|
+
ID3dit::USED_TAGS.each do |tag_name, tag|
|
31
|
+
opts.on("--remove-#{tag_name}", "Remove '#{tag_name}' tag. (#{tag[:id]})") do |v|
|
32
|
+
options[:interactive] = false
|
33
|
+
options["remove_tag_#{tag_name}"] = v
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on_tail('--version', 'Show version.') do
|
38
|
+
puts "ID3dit #{ID3dit::VERSION}"
|
39
|
+
puts ID3dit::HOMEPAGE
|
40
|
+
exit
|
41
|
+
end
|
42
|
+
|
43
|
+
opts.on_tail('-h', '--help', 'Show this message.') do
|
44
|
+
puts opts
|
45
|
+
exit 3
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
opts.parse(ARGV)
|
50
|
+
|
51
|
+
files = []
|
52
|
+
ARGV.each do |arg|
|
53
|
+
if File.exist?(arg)
|
54
|
+
files << arg
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
if files.count == 0
|
59
|
+
opts.parse(['-h'])
|
60
|
+
end
|
61
|
+
|
62
|
+
if options[:interactive]
|
63
|
+
puts "ID3dit #{ID3dit::VERSION}"
|
64
|
+
|
65
|
+
tags = ID3dit::Tags.new(files.map{ |file| ID3Lib::Tag.new(file) })
|
66
|
+
|
67
|
+
actions = ['i']
|
68
|
+
while true
|
69
|
+
case actions.pop
|
70
|
+
when 'i'
|
71
|
+
puts
|
72
|
+
if files.count >= 2
|
73
|
+
puts "#{files.count} songs selected."
|
74
|
+
else
|
75
|
+
puts "File '#{files.first}'."
|
76
|
+
end
|
77
|
+
|
78
|
+
puts
|
79
|
+
if tags.are_set?
|
80
|
+
tags.are_set.each do |tag_name, tag_infos|
|
81
|
+
printf "%15s ", tag_name
|
82
|
+
if tag_infos[:is_mixed]
|
83
|
+
print '< Mixed >'
|
84
|
+
else
|
85
|
+
print "'" + Rainbow(tag_infos[:old_value]).bright + "'"
|
86
|
+
end
|
87
|
+
if tag_infos[:has_changed]
|
88
|
+
if tag_infos[:is_removed]
|
89
|
+
print " => remove"
|
90
|
+
else
|
91
|
+
print " => '#{tag_infos[:new_value]}'"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
puts
|
95
|
+
end
|
96
|
+
else
|
97
|
+
puts 'File(s) contain no ID3 tags.'
|
98
|
+
end
|
99
|
+
when 'e'
|
100
|
+
puts
|
101
|
+
puts 'Type new value for tags.'
|
102
|
+
puts '- Leave blank for unchanged.'
|
103
|
+
puts '- Leave input prematurely with "#".'
|
104
|
+
puts
|
105
|
+
|
106
|
+
has_set_tags = false
|
107
|
+
pre_break = false
|
108
|
+
tags.are_for_edit.each do |tag_name, tag_infos|
|
109
|
+
has_set_tags = true
|
110
|
+
|
111
|
+
printf "%15s ", tag_name
|
112
|
+
if tag_infos[:is_mixed]
|
113
|
+
print '< Mixed >'
|
114
|
+
else
|
115
|
+
print "'" + Rainbow(tag_infos[:new_value].nil? ? tag_infos[:old_value] : tag_infos[:new_value]).bright + "'"
|
116
|
+
end
|
117
|
+
|
118
|
+
print ' >'
|
119
|
+
new_val = ask('').strip
|
120
|
+
if new_val != ''
|
121
|
+
if new_val == '#'
|
122
|
+
pre_break = true
|
123
|
+
puts 'Break.'
|
124
|
+
break
|
125
|
+
end
|
126
|
+
printf "%15s '%s'\n", "New #{tag_name}", new_val
|
127
|
+
tags[tag_name] = new_val
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
show_unset_tags = false
|
132
|
+
if has_set_tags
|
133
|
+
if !pre_break
|
134
|
+
puts
|
135
|
+
res = ask('Edit more tags? [yN] ').strip.downcase
|
136
|
+
if res == 'y'
|
137
|
+
show_unset_tags = true
|
138
|
+
end
|
139
|
+
end
|
140
|
+
else
|
141
|
+
show_unset_tags = true
|
142
|
+
end
|
143
|
+
|
144
|
+
if show_unset_tags
|
145
|
+
puts
|
146
|
+
tags.are_for_further_edit.each do |tag_name, tag_infos|
|
147
|
+
printf "%15s '' >", tag_name
|
148
|
+
new_val = ask('').strip
|
149
|
+
if new_val != ''
|
150
|
+
if new_val == '#'
|
151
|
+
pre_break = true
|
152
|
+
puts 'Break.'
|
153
|
+
break
|
154
|
+
end
|
155
|
+
printf "%15s '%s'\n", "New #{tag_name}", new_val
|
156
|
+
tags[tag_name] = new_val
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
when 'r'
|
161
|
+
puts
|
162
|
+
puts 'Remove tags.'
|
163
|
+
puts '- Default is no on non-empty fields.'
|
164
|
+
puts '- Leave input prematurely with "#".'
|
165
|
+
puts
|
166
|
+
|
167
|
+
tags.are_for_remove.each do |tag_name, tag_infos|
|
168
|
+
printf "%15s ", tag_name
|
169
|
+
if tag_infos[:is_mixed]
|
170
|
+
print '< Mixed >'
|
171
|
+
else
|
172
|
+
print "'" + Rainbow(tag_infos[:new_value].nil? ? tag_infos[:old_value] : tag_infos[:new_value]).bright + "'"
|
173
|
+
end
|
174
|
+
|
175
|
+
print ' ['
|
176
|
+
default_v = 'n'
|
177
|
+
if !tag_infos[:old_value].nil? && tag_infos[:old_value] != '' ||
|
178
|
+
!tag_infos[:new_value].nil? && tag_infos[:new_value] != '' ||
|
179
|
+
tag_infos[:is_mixed]
|
180
|
+
print 'yN'
|
181
|
+
else
|
182
|
+
print 'Yn'
|
183
|
+
default_v = 'y'
|
184
|
+
end
|
185
|
+
print '#]? '
|
186
|
+
|
187
|
+
res = ask('').strip.downcase
|
188
|
+
if res == ''
|
189
|
+
res = default_v
|
190
|
+
end
|
191
|
+
if res == 'y' || res == 'r'
|
192
|
+
printf "%15s\n", "Remove #{tag_name}"
|
193
|
+
tags.delete(tag_name)
|
194
|
+
elsif res == '#'
|
195
|
+
puts 'Break.'
|
196
|
+
break
|
197
|
+
end
|
198
|
+
end
|
199
|
+
when 'x'
|
200
|
+
actions << 'q'
|
201
|
+
actions << 'w'
|
202
|
+
when 'w'
|
203
|
+
puts
|
204
|
+
|
205
|
+
changes = tags.have_changed
|
206
|
+
if changes.count > 0
|
207
|
+
puts "Write #{changes.count} change(s)."
|
208
|
+
files.each do |file|
|
209
|
+
puts "Write file '#{file}'."
|
210
|
+
|
211
|
+
tag = ID3Lib::Tag.new(file)
|
212
|
+
changes.each do |tag_name, tag_infos|
|
213
|
+
if tag_infos[:is_removed]
|
214
|
+
used_tag = ID3dit::USED_TAGS[tag_name]
|
215
|
+
tag.delete_if{ |frame| frame[:id] == used_tag[:id] }
|
216
|
+
else
|
217
|
+
tag.send("#{tag_name}=", tag_infos[:new_value])
|
218
|
+
end
|
219
|
+
end
|
220
|
+
tag.update!
|
221
|
+
end
|
222
|
+
|
223
|
+
tags.update
|
224
|
+
else
|
225
|
+
puts 'Nothing has changed, no file(s) written.'
|
226
|
+
end
|
227
|
+
when 'q'
|
228
|
+
puts 'Quitting.'
|
229
|
+
break
|
230
|
+
when '?'
|
231
|
+
puts
|
232
|
+
puts 'i - show all tags.'
|
233
|
+
puts 'e - edit all tags.'
|
234
|
+
puts 'r - remove tags.'
|
235
|
+
puts 'x - same as wq.'
|
236
|
+
puts 'w - write - after edit, apply changes to the files.'
|
237
|
+
puts 'q - quit without saving.'
|
238
|
+
puts '? - print help.'
|
239
|
+
else
|
240
|
+
puts "WARNING: invalid input. Type '?' for help."
|
241
|
+
end
|
242
|
+
|
243
|
+
next if actions.count > 0
|
244
|
+
|
245
|
+
puts
|
246
|
+
actions << ask('[ierxwq?] '){ |q|
|
247
|
+
q.character = true
|
248
|
+
}.downcase
|
249
|
+
end
|
250
|
+
else
|
251
|
+
files.each do |file|
|
252
|
+
puts "Check file '#{file}'."
|
253
|
+
|
254
|
+
changed = false
|
255
|
+
tag = ID3Lib::Tag.new(file)
|
256
|
+
options.select{ |tag_name, tag_value| /^set_tag_/.match(tag_name) }.each do |tag_name, tag_value|
|
257
|
+
name = tag_name.sub(/^set_tag_/, '')
|
258
|
+
tag.send("#{name}=", tag_value)
|
259
|
+
changed = true
|
260
|
+
end
|
261
|
+
if options.has_key?('remove_all_tags')
|
262
|
+
tag.delete_if{ true }
|
263
|
+
changed = true
|
264
|
+
else
|
265
|
+
options.select{ |tag_name, tag_value| /^remove_tag_/.match(tag_name) }.each do |tag_name, tag_value|
|
266
|
+
name = tag_name.sub(/^remove_tag_/, '')
|
267
|
+
used_tag = ID3dit::USED_TAGS[name.to_sym]
|
268
|
+
count = tag.count
|
269
|
+
tag.delete_if{ |frame| frame[:id] == used_tag[:id] }
|
270
|
+
|
271
|
+
changed = true if tag.count < count
|
272
|
+
end
|
273
|
+
end
|
274
|
+
if changed
|
275
|
+
puts "Write file '#{file}'."
|
276
|
+
tag.update!
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
Binary file
|
Binary file
|
data/id3dit.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: UTF-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
require 'id3dit/version'
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = 'id3dit'
|
10
|
+
spec.version = ID3dit::VERSION
|
11
|
+
spec.date = ID3dit::DATE
|
12
|
+
spec.author = 'Christian Mayer'
|
13
|
+
spec.email = 'christian@fox21.at'
|
14
|
+
|
15
|
+
spec.summary = %q{ID3 Tags Editor}
|
16
|
+
spec.description = %q{ID3 tags editor for the command line written in Ruby.}
|
17
|
+
spec.homepage = ID3dit::HOMEPAGE
|
18
|
+
spec.license = 'GPL-3.0'
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`.split("\x0").reject{ |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
spec.bindir = 'bin'
|
22
|
+
spec.executables = ['id3dit']
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
spec.required_ruby_version = '>=2.2.0'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler', '~>1.10'
|
27
|
+
|
28
|
+
spec.add_dependency 'id3lib-ruby', '~>0.6'
|
29
|
+
spec.add_dependency 'highline', '~>1.7'
|
30
|
+
spec.add_dependency 'rainbow', '~>2.0'
|
31
|
+
end
|
data/lib/id3dit/tags.rb
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
|
2
|
+
require 'id3dit/version'
|
3
|
+
|
4
|
+
module ID3dit
|
5
|
+
|
6
|
+
class Tags < Hash
|
7
|
+
attr_accessor :raw
|
8
|
+
|
9
|
+
def initialize(tags)
|
10
|
+
@raw = USED_TAGS.map{ |tag_name, tag|
|
11
|
+
[tag_name, {
|
12
|
+
:old_value => nil,
|
13
|
+
:new_value => nil,
|
14
|
+
:has_init => false,
|
15
|
+
:is_mixed => false,
|
16
|
+
:is_removed => false,
|
17
|
+
:has_changed => false,
|
18
|
+
}] }.to_h
|
19
|
+
|
20
|
+
tags.each do |tag|
|
21
|
+
@raw.each do |tag_name, tag_infos|
|
22
|
+
field = tag.send(tag_name)
|
23
|
+
|
24
|
+
if tag_infos[:has_init]
|
25
|
+
if !tag_infos[:is_mixed]
|
26
|
+
if field != tag_infos[:old_value]
|
27
|
+
tag_infos[:is_mixed] = true
|
28
|
+
tag_infos[:old_value] = nil
|
29
|
+
tag_infos[:new_value] = nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
else
|
33
|
+
tag_infos[:has_init] = true
|
34
|
+
tag_infos[:old_value] = field
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def [](key)
|
41
|
+
@raw[key]
|
42
|
+
end
|
43
|
+
|
44
|
+
def []=(key, val)
|
45
|
+
tag = @raw[key]
|
46
|
+
tag[:has_changed] = true
|
47
|
+
tag[:has_init] = true
|
48
|
+
tag[:is_removed] = false
|
49
|
+
tag[:new_value] = val
|
50
|
+
end
|
51
|
+
|
52
|
+
def delete(key)
|
53
|
+
tag = @raw[key]
|
54
|
+
tag[:has_changed] = true
|
55
|
+
tag[:is_removed] = true
|
56
|
+
end
|
57
|
+
|
58
|
+
def are_inited
|
59
|
+
@raw.select{ |tag_name, tag_infos| tag_infos[:has_init] }
|
60
|
+
end
|
61
|
+
|
62
|
+
def have_changed
|
63
|
+
are_inited.select{ |tag_name, tag_infos| tag_infos[:has_changed] }
|
64
|
+
end
|
65
|
+
|
66
|
+
def are_unchanged
|
67
|
+
are_inited.select{ |tag_name, tag_infos| !tag_infos[:has_changed] }
|
68
|
+
end
|
69
|
+
|
70
|
+
def have_no_old_value
|
71
|
+
are_unchanged.select{ |tag_name, tag_infos| tag_infos[:old_value].nil? }
|
72
|
+
end
|
73
|
+
|
74
|
+
def are_set
|
75
|
+
are_inited.select{ |tag_name, tag_infos|
|
76
|
+
!tag_infos[:old_value].nil? ||
|
77
|
+
!tag_infos[:new_value].nil? ||
|
78
|
+
tag_infos[:is_mixed] ||
|
79
|
+
tag_infos[:has_changed]
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
def are_set?
|
84
|
+
are_set.count > 0
|
85
|
+
end
|
86
|
+
|
87
|
+
def are_not_removed
|
88
|
+
are_inited.select{ |tag_name, tag_infos| !tag_infos[:is_removed] }
|
89
|
+
end
|
90
|
+
|
91
|
+
def are_for_edit
|
92
|
+
are_not_removed.select{ |tag_name, tag_infos|
|
93
|
+
!tag_infos[:old_value].nil? ||
|
94
|
+
tag_infos[:has_changed] ||
|
95
|
+
tag_infos[:is_mixed]
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
def are_for_further_edit
|
100
|
+
have_no_old_value.select{ |tag_name, tag_infos| !tag_infos[:is_mixed] }
|
101
|
+
end
|
102
|
+
|
103
|
+
def are_for_remove
|
104
|
+
are_not_removed.select{ |tag_name, tag_infos|
|
105
|
+
!tag_infos[:old_value].nil? ||
|
106
|
+
!tag_infos[:new_value].nil? ||
|
107
|
+
tag_infos[:is_mixed]
|
108
|
+
}
|
109
|
+
end
|
110
|
+
|
111
|
+
def update
|
112
|
+
have_changed.each do |tag_name, tag_infos|
|
113
|
+
# Set tag infos to default.
|
114
|
+
tag_infos[:old_value] = tag_infos[:is_removed] ? nil : tag_infos[:new_value]
|
115
|
+
tag_infos[:new_value] = nil
|
116
|
+
# tag_infos[:has_init] = false
|
117
|
+
tag_infos[:is_mixed] = false
|
118
|
+
tag_infos[:is_removed] = false
|
119
|
+
tag_infos[:has_changed] = false
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
module ID3dit
|
3
|
+
VERSION = '1.1.0'
|
4
|
+
DATE = '2015-12-07'
|
5
|
+
HOMEPAGE = 'https://github.com/TheFox/id3dit'
|
6
|
+
USED_TAGS = {
|
7
|
+
:title => {:id => :TIT2},
|
8
|
+
:artist => {:id => :TPE1},
|
9
|
+
:composer => {:id => :TCOM},
|
10
|
+
:year => {:id => :TYER},
|
11
|
+
:genre => {:id => :TCON},
|
12
|
+
:bpm => {:id => :TBPM},
|
13
|
+
:grouping => {:id => :TIT1},
|
14
|
+
:comment => {:id => :COMM},
|
15
|
+
:album => {:id => :TALB},
|
16
|
+
:band => {:id => :TPE2},
|
17
|
+
:disc => {:id => :TPOS},
|
18
|
+
:track => {:id => :TRCK},
|
19
|
+
}
|
20
|
+
end
|
data/lib/id3dit.rb
ADDED
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: id3dit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Christian Mayer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: id3lib-ruby
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: highline
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rainbow
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
description: ID3 tags editor for the command line written in Ruby.
|
70
|
+
email: christian@fox21.at
|
71
|
+
executables:
|
72
|
+
- id3dit
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- Gemfile.lock
|
79
|
+
- Makefile
|
80
|
+
- README.md
|
81
|
+
- bin/id3dit
|
82
|
+
- examples/id3dit_20151116_143921.png
|
83
|
+
- examples/id3dit_20151116_144224.png
|
84
|
+
- id3dit.gemspec
|
85
|
+
- id3dit.sublime-project
|
86
|
+
- lib/id3dit.rb
|
87
|
+
- lib/id3dit/tags.rb
|
88
|
+
- lib/id3dit/version.rb
|
89
|
+
homepage: https://github.com/TheFox/id3dit
|
90
|
+
licenses:
|
91
|
+
- GPL-3.0
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.2.0
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.4.7
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: ID3 Tags Editor
|
113
|
+
test_files: []
|
114
|
+
has_rdoc:
|