taglib-ruby 1.1.2 → 2.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.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/CHANGELOG.md +22 -0
- data/README.md +16 -12
- data/docs/taglib/mpeg.rb +1 -9
- data/ext/extconf_common.rb +21 -12
- data/ext/taglib_aiff/taglib_aiff.i +5 -0
- data/ext/taglib_aiff/taglib_aiff_wrap.cxx +327 -111
- data/ext/taglib_base/includes.i +14 -14
- data/ext/taglib_base/taglib_base.i +37 -4
- data/ext/taglib_base/taglib_base_wrap.cxx +414 -422
- data/ext/taglib_flac/taglib_flac.i +8 -3
- data/ext/taglib_flac/taglib_flac_wrap.cxx +356 -406
- data/ext/taglib_flac_picture/taglib_flac_picture.i +4 -0
- data/ext/taglib_flac_picture/taglib_flac_picture_wrap.cxx +229 -122
- data/ext/taglib_id3v1/taglib_id3v1_wrap.cxx +196 -102
- data/ext/taglib_id3v2/taglib_id3v2.i +5 -0
- data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +727 -568
- data/ext/taglib_mp4/taglib_mp4.i +22 -18
- data/ext/taglib_mp4/taglib_mp4_wrap.cxx +2141 -1493
- data/ext/taglib_mpeg/taglib_mpeg.i +6 -0
- data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +546 -379
- data/ext/taglib_ogg/taglib_ogg.i +0 -2
- data/ext/taglib_ogg/taglib_ogg_wrap.cxx +162 -107
- data/ext/taglib_vorbis/taglib_vorbis.i +1 -0
- data/ext/taglib_vorbis/taglib_vorbis_wrap.cxx +141 -109
- data/ext/taglib_wav/taglib_wav.i +6 -2
- data/ext/taglib_wav/taglib_wav_wrap.cxx +290 -147
- data/lib/taglib/version.rb +3 -3
- data/taglib-ruby.gemspec +1 -0
- data/tasks/ext.rake +23 -39
- data/tasks/swig.rake +14 -4
- data/test/id3v2_write_test.rb +1 -1
- data/test/wav_examples_test.rb +1 -1
- data/test/wav_file_test.rb +1 -1
- data/test/wav_file_write_test.rb +6 -6
- metadata +4 -3
data/lib/taglib/version.rb
CHANGED
data/taglib-ruby.gemspec
CHANGED
data/tasks/ext.rake
CHANGED
@@ -1,25 +1,19 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
+
require_relative 'build'
|
4
|
+
|
3
5
|
# Extension tasks and cross-compiling
|
4
6
|
|
5
7
|
host = 'i686-w64-mingw32'
|
6
|
-
$plat = ENV['PLATFORM'] || 'i386-mingw32'
|
7
|
-
|
8
|
-
taglib_version = ENV['TAGLIB_VERSION'] || '1.9.1'
|
9
|
-
taglib = "taglib-#{taglib_version}"
|
10
|
-
|
11
|
-
tmp = "#{Dir.pwd}/tmp"
|
12
|
-
tmp_arch = "#{tmp}/#{$plat}"
|
13
8
|
toolchain_file = "#{Dir.pwd}/ext/win.cmake"
|
14
|
-
|
15
|
-
|
16
|
-
install_so = "#{install_dir}/lib/libtag.so"
|
17
|
-
$cross_config_options = ["--with-opt-dir=#{install_dir}"]
|
9
|
+
install_dll = "#{Build.install_dir}/bin/libtag.dll"
|
10
|
+
$cross_config_options = ["--with-opt-dir=#{Build.install_dir}"]
|
18
11
|
|
19
|
-
taglib_url = "https://github.com/taglib/taglib/archive/v#{
|
12
|
+
taglib_url = "https://github.com/taglib/taglib/archive/v#{Build.version}.tar.gz"
|
20
13
|
taglib_options = ['-DCMAKE_BUILD_TYPE=Release',
|
21
14
|
'-DBUILD_EXAMPLES=OFF',
|
22
15
|
'-DBUILD_TESTS=OFF',
|
16
|
+
'-DBUILD_TESTING=OFF', # used since 1.13 instead of BUILD_TESTS
|
23
17
|
'-DBUILD_BINDINGS=OFF', # 1.11 builds bindings by default
|
24
18
|
'-DBUILD_SHARED_LIBS=ON', # 1.11 builds static by default
|
25
19
|
'-DWITH_MP4=ON', # WITH_MP4, WITH_ASF only needed with taglib 1.7, will be default in 1.8
|
@@ -27,7 +21,7 @@ taglib_options = ['-DCMAKE_BUILD_TYPE=Release',
|
|
27
21
|
|
28
22
|
def configure_cross_compile(ext)
|
29
23
|
ext.cross_compile = true
|
30
|
-
ext.cross_platform =
|
24
|
+
ext.cross_platform = Build.plat
|
31
25
|
ext.cross_config_options.concat($cross_config_options)
|
32
26
|
ext.cross_compiling do |gem|
|
33
27
|
gem.files << 'lib/libtag.dll'
|
@@ -75,43 +69,33 @@ task :cross do
|
|
75
69
|
ENV['CXX'] = "#{host}-g++"
|
76
70
|
end
|
77
71
|
|
78
|
-
file "#{tmp_arch}/stage/lib/libtag.dll" => [install_dll] do |f|
|
72
|
+
file "#{Build.tmp_arch}/stage/lib/libtag.dll" => [install_dll] do |f|
|
79
73
|
install install_dll, f
|
80
74
|
end
|
81
75
|
|
82
|
-
file install_dll => [
|
83
|
-
chdir
|
84
|
-
sh %(cmake -DCMAKE_INSTALL_PREFIX=#{install_dir} -DCMAKE_TOOLCHAIN_FILE=#{toolchain_file} #{taglib_options})
|
76
|
+
file install_dll => [Build.source] do
|
77
|
+
chdir Build.source do
|
78
|
+
sh %(cmake -DCMAKE_INSTALL_PREFIX=#{Build.install_dir} -DCMAKE_TOOLCHAIN_FILE=#{toolchain_file} #{taglib_options})
|
85
79
|
sh 'make VERBOSE=1'
|
86
80
|
sh 'make install'
|
87
81
|
end
|
88
82
|
end
|
89
83
|
|
90
|
-
task vendor: [
|
84
|
+
task vendor: [Build.library]
|
91
85
|
|
92
|
-
file
|
93
|
-
chdir
|
94
|
-
sh %(cmake -DCMAKE_INSTALL_PREFIX=#{install_dir} #{taglib_options} #{
|
95
|
-
sh 'make install VERBOSE=1'
|
86
|
+
file Build.library => [Build.install_dir, Build.build_dir, Build.source] do
|
87
|
+
chdir Build.build_dir do
|
88
|
+
sh %(cmake -DCMAKE_INSTALL_PREFIX=#{Build.install_dir} #{taglib_options} #{Build.source})
|
89
|
+
sh 'make install -j 4 VERBOSE=1'
|
96
90
|
end
|
97
91
|
end
|
98
92
|
|
99
|
-
directory
|
100
|
-
directory
|
93
|
+
directory Build.install_dir
|
94
|
+
directory Build.build_dir
|
95
|
+
directory Build.tmp
|
101
96
|
|
102
|
-
file
|
103
|
-
|
104
|
-
|
105
|
-
|
97
|
+
file Build.source do
|
98
|
+
sh "git clone --depth=1 --branch=v#{Build.version} https://github.com/taglib/taglib.git #{Build.source}"
|
99
|
+
sh "git -C #{Build.source} submodule init"
|
100
|
+
sh "git -C #{Build.source} submodule update --depth=1"
|
106
101
|
end
|
107
|
-
|
108
|
-
file "#{tmp}/#{taglib}.tar.gz" => [tmp] do |t|
|
109
|
-
require 'open-uri'
|
110
|
-
puts "Downloading #{taglib_url}"
|
111
|
-
|
112
|
-
File.open(t.name, 'wb') do |f|
|
113
|
-
IO.copy_stream(open(taglib_url), f)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
directory tmp
|
data/tasks/swig.rake
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
+
require_relative 'build'
|
4
|
+
|
3
5
|
# Tasks for generating SWIG wrappers in ext
|
4
6
|
|
5
7
|
# Execute SWIG for the specified extension.
|
@@ -11,9 +13,11 @@
|
|
11
13
|
def run_swig(mod)
|
12
14
|
swig = `which swig`.chomp
|
13
15
|
swig = `which swig2.0`.chomp if swig.empty?
|
16
|
+
swiglib = `swig -swiglib`.chomp
|
17
|
+
abort 'swig failed' unless $?.success?
|
14
18
|
|
15
19
|
# Standard search location for headers
|
16
|
-
include_args =
|
20
|
+
include_args = "-I#{Build.install_dir}/include"
|
17
21
|
|
18
22
|
if ENV.key?('TAGLIB_DIR')
|
19
23
|
unless File.directory?(ENV['TAGLIB_DIR'])
|
@@ -21,14 +25,20 @@ def run_swig(mod)
|
|
21
25
|
end
|
22
26
|
|
23
27
|
# Push it in front to get it searched first.
|
24
|
-
include_args
|
28
|
+
include_args = "-I#{ENV['TAGLIB_DIR']}/include"
|
25
29
|
end
|
26
30
|
|
27
|
-
|
31
|
+
Dir.chdir("ext/#{mod}") do
|
32
|
+
sh "#{swig} -c++ -ruby -autorename -initname #{mod} #{include_args} #{mod}.i"
|
33
|
+
wrap = "#{mod}_wrap.cxx"
|
34
|
+
wrapdata = File.read(wrap)
|
35
|
+
File.write(wrap, wrapdata.gsub(swiglib, '/swig'))
|
36
|
+
end
|
28
37
|
end
|
29
38
|
|
30
39
|
task swig:
|
31
|
-
[
|
40
|
+
[Build.library,
|
41
|
+
'ext/taglib_base/taglib_base_wrap.cxx',
|
32
42
|
'ext/taglib_mpeg/taglib_mpeg_wrap.cxx',
|
33
43
|
'ext/taglib_id3v1/taglib_id3v1_wrap.cxx',
|
34
44
|
'ext/taglib_id3v2/taglib_id3v2_wrap.cxx',
|
data/test/id3v2_write_test.rb
CHANGED
@@ -54,7 +54,7 @@ class TestID3v2Write < Test::Unit::TestCase
|
|
54
54
|
end
|
55
55
|
|
56
56
|
should 'be able to save ID3v2.3' do
|
57
|
-
success = @file.save(TagLib::MPEG::File::ID3v2,
|
57
|
+
success = @file.save(TagLib::MPEG::File::ID3v2, TagLib::File::StripOthers, TagLib::ID3v2::V3)
|
58
58
|
assert_equal true, success
|
59
59
|
@file.close
|
60
60
|
@file = nil
|
data/test/wav_examples_test.rb
CHANGED
@@ -19,7 +19,7 @@ class WAVExamples < Test::Unit::TestCase
|
|
19
19
|
|
20
20
|
# Saving ID3v2 cover-art to disk
|
21
21
|
TagLib::RIFF::WAV::File.open("#{DATA_FILE_PREFIX}sample.wav") do |file|
|
22
|
-
id3v2_tag = file.
|
22
|
+
id3v2_tag = file.id3v2_tag
|
23
23
|
cover = id3v2_tag.frame_list('APIC').first
|
24
24
|
ext = cover.mime_type.rpartition('/')[2]
|
25
25
|
File.open("#{DATA_FILE_PREFIX}cover-art.#{ext}", 'wb') { |f| f.write cover.picture }
|
data/test/wav_file_test.rb
CHANGED
data/test/wav_file_write_test.rb
CHANGED
@@ -33,18 +33,18 @@ class WAVFileWriteTest < Test::Unit::TestCase
|
|
33
33
|
end
|
34
34
|
|
35
35
|
should 'have one picture frame' do
|
36
|
-
assert_equal 2, @file.
|
36
|
+
assert_equal 2, @file.id3v2_tag.frame_list('APIC').size
|
37
37
|
end
|
38
38
|
|
39
39
|
should 'be able to remove all picture frames' do
|
40
|
-
@file.
|
40
|
+
@file.id3v2_tag.remove_frames('APIC')
|
41
41
|
success = @file.save
|
42
42
|
assert success
|
43
43
|
@file.close
|
44
44
|
@file = nil
|
45
45
|
|
46
46
|
reloaded do |file|
|
47
|
-
assert_equal 0, file.
|
47
|
+
assert_equal 0, file.id3v2_tag.frame_list('APIC').size
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -58,18 +58,18 @@ class WAVFileWriteTest < Test::Unit::TestCase
|
|
58
58
|
apic.picture = picture_data
|
59
59
|
apic.type = TagLib::ID3v2::AttachedPictureFrame::BackCover
|
60
60
|
|
61
|
-
@file.
|
61
|
+
@file.id3v2_tag.add_frame(apic)
|
62
62
|
success = @file.save
|
63
63
|
assert success
|
64
64
|
@file.close
|
65
65
|
@file = nil
|
66
66
|
|
67
67
|
reloaded do |file|
|
68
|
-
assert_equal 3, file.
|
68
|
+
assert_equal 3, file.id3v2_tag.frame_list('APIC').size
|
69
69
|
end
|
70
70
|
|
71
71
|
reloaded do |file|
|
72
|
-
written_apic = file.
|
72
|
+
written_apic = file.id3v2_tag.frame_list('APIC')[2]
|
73
73
|
assert_equal 'image/jpeg', written_apic.mime_type
|
74
74
|
assert_equal 'desc', written_apic.description
|
75
75
|
assert_equal picture_data, written_apic.picture
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taglib-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Stocker
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-10-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -128,6 +128,7 @@ extra_rdoc_files:
|
|
128
128
|
- LICENSE.txt
|
129
129
|
- README.md
|
130
130
|
files:
|
131
|
+
- ".github/FUNDING.yml"
|
131
132
|
- ".rubocop.yml"
|
132
133
|
- ".yardopts"
|
133
134
|
- CHANGELOG.md
|
@@ -279,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
280
|
version: '0'
|
280
281
|
requirements:
|
281
282
|
- taglib (libtag1-dev in Debian/Ubuntu, taglib-devel in Fedora/RHEL)
|
282
|
-
rubygems_version: 3.4.
|
283
|
+
rubygems_version: 3.4.10
|
283
284
|
signing_key:
|
284
285
|
specification_version: 4
|
285
286
|
summary: Ruby interface for the taglib C++ library
|