taglib-ruby 0.6.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +1 -1
- data/{CHANGES.md → CHANGELOG.md} +46 -11
- data/README.md +61 -17
- data/Rakefile +12 -3
- data/docs/taglib/aiff.rb +95 -0
- data/docs/taglib/base.rb +30 -2
- data/docs/taglib/flac.rb +60 -4
- data/docs/taglib/id3v1.rb +29 -0
- data/docs/taglib/id3v2.rb +22 -3
- data/docs/taglib/mp4.rb +124 -13
- data/docs/taglib/mpeg.rb +30 -1
- data/docs/taglib/ogg.rb +47 -5
- data/docs/taglib/riff.rb +3 -0
- data/docs/taglib/vorbis.rb +1 -1
- data/docs/taglib/wav.rb +116 -0
- data/ext/extconf_common.rb +24 -3
- data/ext/taglib_aiff/extconf.rb +4 -0
- data/ext/taglib_aiff/taglib_aiff.i +84 -0
- data/ext/taglib_aiff/taglib_aiff_wrap.cxx +3111 -0
- data/ext/taglib_base/includes.i +34 -5
- data/ext/taglib_base/taglib_base.i +42 -2
- data/ext/taglib_base/taglib_base_wrap.cxx +226 -186
- data/ext/taglib_flac/taglib_flac.i +21 -18
- data/ext/taglib_flac/taglib_flac_wrap.cxx +519 -955
- data/ext/taglib_flac_picture/extconf.rb +4 -0
- data/ext/taglib_flac_picture/includes.i +15 -0
- data/ext/taglib_flac_picture/taglib_flac_picture.i +15 -0
- data/ext/taglib_flac_picture/taglib_flac_picture_wrap.cxx +3087 -0
- data/ext/taglib_id3v1/taglib_id3v1.i +19 -0
- data/ext/taglib_id3v1/taglib_id3v1_wrap.cxx +391 -193
- data/ext/taglib_id3v2/relativevolumeframe.i +4 -17
- data/ext/taglib_id3v2/taglib_id3v2.i +72 -2
- data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +3051 -1113
- data/ext/taglib_mp4/taglib_mp4.i +101 -20
- data/ext/taglib_mp4/taglib_mp4_wrap.cxx +1088 -282
- data/ext/taglib_mpeg/taglib_mpeg.i +11 -16
- data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +646 -317
- data/ext/taglib_ogg/taglib_ogg.i +11 -0
- data/ext/taglib_ogg/taglib_ogg_wrap.cxx +478 -192
- data/ext/taglib_vorbis/taglib_vorbis.i +8 -0
- data/ext/taglib_vorbis/taglib_vorbis_wrap.cxx +202 -156
- data/ext/taglib_wav/extconf.rb +4 -0
- data/ext/taglib_wav/taglib_wav.i +90 -0
- data/ext/taglib_wav/taglib_wav_wrap.cxx +3423 -0
- data/lib/taglib.rb +2 -0
- data/lib/taglib/aiff.rb +7 -0
- data/lib/taglib/mp4.rb +2 -1
- data/lib/taglib/version.rb +2 -2
- data/lib/taglib/wav.rb +11 -0
- data/taglib-ruby.gemspec +42 -8
- data/tasks/ext.rake +48 -20
- data/tasks/gemspec_check.rake +1 -1
- data/tasks/swig.rake +36 -2
- data/test/aiff_examples_test.rb +39 -0
- data/test/aiff_file_test.rb +103 -0
- data/test/aiff_file_write_test.rb +88 -0
- data/test/data/Makefile +8 -2
- data/test/data/aiff-sample.aiff +0 -0
- data/test/data/flac_nopic.flac +0 -0
- data/test/data/vorbis-create.cpp +20 -1
- data/test/data/vorbis.oga +0 -0
- data/test/data/wav-create.cpp +55 -0
- data/test/data/wav-dump.cpp +74 -0
- data/test/data/wav-sample.wav +0 -0
- data/test/file_test.rb +21 -0
- data/test/fileref_properties_test.rb +1 -1
- data/test/flac_file_test.rb +45 -30
- data/test/flac_picture_memory_test.rb +43 -0
- data/test/id3v1_genres_test.rb +23 -0
- data/test/id3v1_tag_test.rb +1 -0
- data/test/id3v2_frames_test.rb +64 -0
- data/test/id3v2_tag_test.rb +6 -6
- data/test/id3v2_unknown_frames_test.rb +30 -0
- data/test/id3v2_write_test.rb +10 -13
- data/test/mp4_file_test.rb +33 -4
- data/test/mp4_file_write_test.rb +5 -5
- data/test/mp4_items_test.rb +83 -29
- data/test/mpeg_file_test.rb +120 -7
- data/test/vorbis_file_test.rb +2 -2
- data/test/vorbis_tag_test.rb +61 -7
- data/test/wav_examples_test.rb +42 -0
- data/test/wav_file_test.rb +108 -0
- data/test/wav_file_write_test.rb +113 -0
- metadata +86 -56
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5a05d3733b4a04a791f619b399e24070ddc184ee2282d61d5b7f377726e3f2cd
|
4
|
+
data.tar.gz: cc92fc66ba1a8643a8a5b4ea1ff6398ba1277b756697dfbd3450007954103b48
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6350877ea0c574bc92c4a09cd501f15648f13b464cbce35aab4b38722fe4357f224a2b802dc15efe6aa17f6ee3e7d78ae837e54b3fbf061f61bf9a355a12f1d4
|
7
|
+
data.tar.gz: 23c439bbc1aabf7d4bf1b2b434de929fac6c1738468028054ca83f1001ae36f0bbabedb22db2db2da66fd701b328db2f2aceb4962dd661ec1983140963d11bbc
|
data/.yardopts
CHANGED
data/{CHANGES.md → CHANGELOG.md}
RENAMED
@@ -1,7 +1,42 @@
|
|
1
1
|
Changes in Releases of taglib-ruby
|
2
2
|
==================================
|
3
3
|
|
4
|
-
|
4
|
+
All notable changes to this project will be documented in this file.
|
5
|
+
|
6
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
7
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
8
|
+
|
9
|
+
## 1.1.0 - 2021-01-20
|
10
|
+
### Added
|
11
|
+
- Added support for CTOC and CHAP frames for ID3v2
|
12
|
+
|
13
|
+
## 1.0.1 - 2020-03-25
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- Fix segmentation fault with TagLib::FLAC picture lists (#91), thanks
|
17
|
+
@jameswyper!
|
18
|
+
|
19
|
+
## 1.0.0 - 2020-01-07
|
20
|
+
|
21
|
+
* Support for TagLib >= 1.11.1 (drop support for earlier versions) (#83)
|
22
|
+
* This includes a lot of new APIs and some changed APIs, see
|
23
|
+
`@since 1.0.0` in the docs
|
24
|
+
* Stop using tainted strings to fix warnings with Ruby 2.7 (#86)
|
25
|
+
|
26
|
+
## 0.7.1 - 2015-12-28
|
27
|
+
|
28
|
+
* Fix compile error during gem installation on Ruby 2.3 (MRI) (#67)
|
29
|
+
|
30
|
+
## 0.7.0 - 2014-08-21
|
31
|
+
|
32
|
+
* Add support for TagLib::RIFF::AIFF (#52, by @tchev)
|
33
|
+
* Add support for TagLib::RIFF::WAV (#57, by @tchev)
|
34
|
+
* Associate filesystem encoding to filename strings
|
35
|
+
* Allow CXX override during gem installation
|
36
|
+
* Try to detect location of vendor/taglib on Heroku (#28)
|
37
|
+
* Documentation updates
|
38
|
+
|
39
|
+
## 0.6.0 - 2013-04-26
|
5
40
|
|
6
41
|
* Add support for TagLib::MP4 (#3, by @jacobvosmaer)
|
7
42
|
* Add support for TagLib::ID3v2::Header (#19, by @kaethorn)
|
@@ -12,24 +47,24 @@ Changes in Releases of taglib-ruby
|
|
12
47
|
* Fix segfault when passing a non-String to a String argument
|
13
48
|
* Documentation updates
|
14
49
|
|
15
|
-
## 0.5.2
|
50
|
+
## 0.5.2 - 2012-10-06
|
16
51
|
|
17
52
|
* Fix memory bug with TagLib::MPEG::File#tag and TagLib::FLAC::File#tag
|
18
53
|
which could cause crashes (#14)
|
19
54
|
* Update TagLib of binary gem for Windows to 1.8
|
20
55
|
|
21
|
-
## 0.5.1
|
56
|
+
## 0.5.1 - 2012-06-16
|
22
57
|
|
23
58
|
* Fix crashes (segfault) with nil arguments, e.g. with `tag.title = nil`
|
24
59
|
* Document TagLib::MPEG::File#save and TagLib::MPEG::File#strip (#11)
|
25
60
|
* Update TagLib of binary gem for Windows to 1.7.2
|
26
61
|
|
27
|
-
## 0.5.0
|
62
|
+
## 0.5.0 - 2012-04-15
|
28
63
|
|
29
64
|
* Add support for FLAC
|
30
65
|
* Fix problem in SWIG causing compilation error on MacRuby (#10)
|
31
66
|
|
32
|
-
## 0.4.0
|
67
|
+
## 0.4.0 - 2012-03-18
|
33
68
|
|
34
69
|
* Pre-compiled binary gem for Windows (Ruby 1.9) with TagLib 1.7.1
|
35
70
|
* Unicode filename support on Windows
|
@@ -43,35 +78,35 @@ title = TagLib::FileRef.open("file.mp3") do |file|
|
|
43
78
|
end
|
44
79
|
```
|
45
80
|
|
46
|
-
## 0.3.1
|
81
|
+
## 0.3.1 - 2012-01-22
|
47
82
|
|
48
83
|
* Fix ObjectPreviouslyDeleted exception after calling
|
49
84
|
TagLib::ID3v2::Tag#add_frame (#8)
|
50
85
|
* Make installation under MacPorts work out of the box (#7)
|
51
86
|
|
52
|
-
## 0.3.0
|
87
|
+
## 0.3.0 - 2012-01-02
|
53
88
|
|
54
89
|
* Add support for Ogg Vorbis
|
55
90
|
* Add support for ID3v1 (#2)
|
56
91
|
* Add #close to File classes for explicitly releasing resources
|
57
92
|
* Fix compilation on Windows
|
58
93
|
|
59
|
-
## 0.2.1
|
94
|
+
## 0.2.1 - 2011-11-05
|
60
95
|
|
61
96
|
* Fix compilation error due to missing typedef on some systems (#5)
|
62
97
|
|
63
|
-
## 0.2.0
|
98
|
+
## 0.2.0 - 2011-10-22
|
64
99
|
|
65
100
|
* API documentation
|
66
101
|
* Add support for:
|
67
102
|
* TagLib::AudioProperties and TagLib::MPEG::Properties (#4)
|
68
103
|
* TagLib::ID3v2::RelativeVolumeFrame
|
69
104
|
|
70
|
-
## 0.1.1
|
105
|
+
## 0.1.1 - 2011-09-17
|
71
106
|
|
72
107
|
* Add installation instructions and clean up description
|
73
108
|
|
74
|
-
## 0.1.0
|
109
|
+
## 0.1.0 - 2011-09-17
|
75
110
|
|
76
111
|
* Initial release
|
77
112
|
* Coverage of the following API:
|
data/README.md
CHANGED
@@ -18,18 +18,17 @@ taglib-ruby currently supports the following:
|
|
18
18
|
|
19
19
|
Contributions for more coverage of the library are very welcome.
|
20
20
|
|
21
|
-
[![
|
22
|
-
|
23
|
-
[![flattr this project][flattr-img]][flattr-link]
|
21
|
+
[![Gem version][gem-img]][gem-link]
|
22
|
+
[![ci](https://github.com/robinst/taglib-ruby/workflows/ci/badge.svg)](https://github.com/robinst/taglib-ruby/actions?query=workflow%3Aci)
|
24
23
|
|
25
24
|
Installation
|
26
25
|
------------
|
27
26
|
|
28
|
-
Before you install the gem, make sure to have [taglib][taglib] installed
|
27
|
+
Before you install the gem, make sure to have [taglib 1.11.1 or higher][taglib] installed
|
29
28
|
with header files (and a C++ compiler of course):
|
30
29
|
|
31
30
|
* Debian/Ubuntu: `sudo apt-get install libtag1-dev`
|
32
|
-
* Fedora/RHEL: `sudo
|
31
|
+
* Fedora/RHEL: `sudo dnf install taglib-devel`
|
33
32
|
* Brew: `brew install taglib`
|
34
33
|
* MacPorts: `sudo port install taglib`
|
35
34
|
|
@@ -37,6 +36,14 @@ Then do:
|
|
37
36
|
|
38
37
|
gem install taglib-ruby
|
39
38
|
|
39
|
+
### OS X C++ compiler override
|
40
|
+
|
41
|
+
Not all versions of TagLib get along with `clang++`, the default C++ compiler
|
42
|
+
on OS X. To compile taglib-ruby's C++ extensions with a different compiler
|
43
|
+
during installation, set the `TAGLIB_RUBY_CXX` environment variable.
|
44
|
+
|
45
|
+
TAGLIB_RUBY_CXX=g++-4.2 gem install taglib-ruby
|
46
|
+
|
40
47
|
Usage
|
41
48
|
-----
|
42
49
|
|
@@ -48,27 +55,66 @@ Begin with the {TagLib} namespace.
|
|
48
55
|
Release Notes
|
49
56
|
-------------
|
50
57
|
|
51
|
-
See {file:
|
58
|
+
See {file:CHANGELOG.md}.
|
52
59
|
|
53
60
|
Contributing
|
54
61
|
------------
|
55
62
|
|
63
|
+
### Dependencies
|
64
|
+
|
65
|
+
Fedora:
|
66
|
+
|
67
|
+
sudo dnf install taglib-devel ruby-devel gcc-c++ redhat-rpm-config swig
|
68
|
+
|
56
69
|
### Building
|
57
70
|
|
58
|
-
|
71
|
+
Install dependencies (uses bundler, install it via `gem install bundler`
|
72
|
+
if you don't have it):
|
73
|
+
|
59
74
|
bundle install
|
60
|
-
|
75
|
+
|
76
|
+
Regenerate SWIG wrappers if you made changes in `.i` files (use version 3.0.7 of SWIG - 3.0.8 through 3.0.12 will not work):
|
77
|
+
|
61
78
|
rake swig
|
62
|
-
|
79
|
+
|
80
|
+
Force regeneration of all SWIG wrappers:
|
81
|
+
|
82
|
+
touch ext/*/*.i
|
83
|
+
rake swig
|
84
|
+
|
85
|
+
Compile extensions:
|
86
|
+
|
63
87
|
rake clean compile
|
64
|
-
|
88
|
+
|
89
|
+
Run tests:
|
90
|
+
|
65
91
|
rake test
|
66
|
-
|
92
|
+
|
93
|
+
Run irb with library:
|
94
|
+
|
95
|
+
irb -Ilib -rtaglib
|
96
|
+
|
97
|
+
Build and install gem into system gems:
|
98
|
+
|
67
99
|
rake install
|
68
100
|
|
101
|
+
Build a specific version of Taglib:
|
102
|
+
|
103
|
+
PLATFORM=x86_64-linux TAGLIB_VERSION=1.11.1 rake vendor
|
104
|
+
|
105
|
+
The above command will automatically download Taglib 1.11.1, build it and install it in `tmp/x86_64-linux/taglib-1.11.1`.
|
106
|
+
|
107
|
+
The `swig` and `compile` tasks can then be executed against that specific version of Taglib by setting the `TAGLIB_DIR` environment variable to `$PWD/tmp/x86_64-linux/taglib-1.11.1` (it is assumed that taglib headers are located at `$TAGLIB_DIR/include` and taglib libraries at `$TAGLIB_DIR/lib`).
|
108
|
+
|
109
|
+
The `test` task can then be run for that version of Taglib by adding `$PWD/tmp/x86_64-linux/taglib-1.11.1/lib` to the `LD_LIBRARY_PATH` environment variable.
|
110
|
+
|
111
|
+
To do everything in one command:
|
112
|
+
|
113
|
+
PLATFORM=x86_64-linux TAGLIB_VERSION=1.11.1 TAGLIB_DIR=$PWD/tmp/x86_64-linux/taglib-1.11.1 LD_LIBRARY_PATH=$PWD/tmp/x86_64-linux/taglib-1.11.1/lib rake vendor compile test
|
114
|
+
|
69
115
|
### Workflow
|
70
116
|
|
71
|
-
* Check out the latest
|
117
|
+
* Check out the latest main branch to make sure the feature hasn't been
|
72
118
|
implemented or the bug hasn't been fixed yet
|
73
119
|
* Check out the issue tracker to make sure someone already hasn't
|
74
120
|
requested it and/or contributed it
|
@@ -85,7 +131,7 @@ Contributing
|
|
85
131
|
License
|
86
132
|
-------
|
87
133
|
|
88
|
-
Copyright (c) 2010-
|
134
|
+
Copyright (c) 2010-2020 Robin Stocker and others, see Git history.
|
89
135
|
|
90
136
|
taglib-ruby is distributed under the MIT License,
|
91
137
|
see LICENSE.txt for details.
|
@@ -95,7 +141,5 @@ a DLL. TagLib is distributed under the GNU Lesser General Public License
|
|
95
141
|
version 2.1 (LGPL) and Mozilla Public License (MPL).
|
96
142
|
|
97
143
|
[taglib]: http://taglib.github.io/
|
98
|
-
[
|
99
|
-
[
|
100
|
-
[flattr-img]: http://api.flattr.com/button/flattr-badge-large.png
|
101
|
-
[flattr-link]: https://flattr.com/submit/auto?user_id=robinst&url=https://github.com/robinst/taglib-ruby&title=taglib-ruby&tags=github&category=software
|
144
|
+
[gem-img]: https://badge.fury.io/rb/taglib-ruby.svg
|
145
|
+
[gem-link]: https://rubygems.org/gems/taglib-ruby
|
data/Rakefile
CHANGED
@@ -23,7 +23,16 @@ YARD::Rake::YardocTask.new do |t|
|
|
23
23
|
t.options = ['--title', "taglib-ruby #{version}"]
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
$gemspec = Bundler.load_gemspec('taglib-ruby.gemspec')
|
26
|
+
$gemspec = Bundler::GemHelper.gemspec
|
28
27
|
|
29
|
-
|
28
|
+
import 'tasks/docs_coverage.rake'
|
29
|
+
import 'tasks/ext.rake'
|
30
|
+
import 'tasks/gemspec_check.rake'
|
31
|
+
|
32
|
+
# When importing swig.rake, the *_wrap.cxx files depend on being generated
|
33
|
+
# by Swig. Since the ExtensionTasks depend on the *_wrap.cxx files,
|
34
|
+
# compiling the extensions will trigger Swig, which is not desired as
|
35
|
+
# those files have already been generated and there's no reason to make
|
36
|
+
# Swig a variable of the CI. The environment variable can be set to
|
37
|
+
# prevent running swig.
|
38
|
+
import 'tasks/swig.rake' unless ENV['SKIP_SWIG'] == 'true'
|
data/docs/taglib/aiff.rb
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# @since 0.7.0
|
2
|
+
module TagLib::RIFF::AIFF
|
3
|
+
|
4
|
+
# The file class for `.aiff` files.
|
5
|
+
#
|
6
|
+
# @example Reading the title
|
7
|
+
# title = TagLib::RIFF::AIFF::File.open("sample.aiff") do |file|
|
8
|
+
# file.tag.title
|
9
|
+
# end
|
10
|
+
#
|
11
|
+
# @example Reading AIFF-specific audio properties
|
12
|
+
# TagLib::RIFF::AIFF::File.open("sample.aiff") do |file|
|
13
|
+
# file.audio_properties.sample_width #=> 16
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# @example Saving ID3v2 cover-art to disk
|
17
|
+
# TagLib::RIFF::AIFF::File.open("sample2.aif") do |file|
|
18
|
+
# id3v2_tag = file.tag
|
19
|
+
# cover = id3v2_tag.frame_list('APIC').first
|
20
|
+
# ext = cover.mime_type.rpartition('/')[2]
|
21
|
+
# File.open("cover-art.#{ext}", "wb") { |f| f.write cover.picture }
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# @see ID3v2::Tag ID3v2 examples.
|
25
|
+
#
|
26
|
+
class File < TagLib::File
|
27
|
+
# {include:::TagLib::FileRef.open}
|
28
|
+
#
|
29
|
+
# @param (see #initialize)
|
30
|
+
# @yield [file] the {File} object, as obtained by {#initialize}
|
31
|
+
# @return the return value of the block
|
32
|
+
#
|
33
|
+
def self.open(filename, read_properties=true)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Load an AIFF file.
|
37
|
+
#
|
38
|
+
# @param [String] filename
|
39
|
+
# @param [Boolean] read_properties if audio properties should be
|
40
|
+
# read
|
41
|
+
def initialize(filename, read_properties=true)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns the ID3v2 tag.
|
45
|
+
#
|
46
|
+
# @return [TagLib::ID3v2::Tag]
|
47
|
+
def tag
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns audio properties.
|
51
|
+
#
|
52
|
+
# @return [TagLib::RIFF::AIFF::Properties]
|
53
|
+
def audio_properties
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [Boolean] Whether or not the file on disk actually has an ID3v2 tag.
|
57
|
+
#
|
58
|
+
# @since 1.0.0
|
59
|
+
def id3v2_tag?
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
class Properties < TagLib::AudioProperties
|
65
|
+
# @return [Integer] Number of bits per audio sample.
|
66
|
+
#
|
67
|
+
# @since 1.0.0
|
68
|
+
attr_reader :bits_per_sample
|
69
|
+
|
70
|
+
# @return [Integer] Number of sample frames.
|
71
|
+
#
|
72
|
+
# @since 1.0.0
|
73
|
+
attr_reader :sample_frames
|
74
|
+
|
75
|
+
# @return [String] The compression type of the AIFF-C file.
|
76
|
+
# For example, "NONE" for not compressed, "ACE2" for ACE 2-to-1.
|
77
|
+
# If the file is in AIFF format, always returns an empty string.
|
78
|
+
#
|
79
|
+
# @since 1.0.0
|
80
|
+
attr_reader :compression_type
|
81
|
+
|
82
|
+
# @return [String] Returns the concrete compression name of the AIFF-C file.
|
83
|
+
# If the file is in AIFF format, always returns an empty string.
|
84
|
+
#
|
85
|
+
# @since 1.0.0
|
86
|
+
attr_reader :compression_name
|
87
|
+
|
88
|
+
# @return [Boolean] True if the file is in AIFF-C format, false if AIFF format.
|
89
|
+
#
|
90
|
+
# @since 1.0.0
|
91
|
+
def aiff_c?
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
data/docs/taglib/base.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# * Reading/writing basic tag and audio properties without having to
|
6
6
|
# know the tagging format: {TagLib::FileRef}
|
7
7
|
# * Reading properties of MPEG files: {TagLib::MPEG::File}
|
8
|
-
# * Reading/writing ID3v2 tags: {TagLib::MPEG::File} and
|
8
|
+
# * Reading/writing ID3v2 tags: {TagLib::MPEG::File}, {TagLib::RIFF::AIFF::File} and
|
9
9
|
# {TagLib::ID3v2::Tag}
|
10
10
|
# * Reading/writing Ogg Vorbis tags: {TagLib::Ogg::Vorbis::File}
|
11
11
|
# * Reading/writing FLAC tags: {TagLib::FLAC::File}
|
@@ -23,6 +23,27 @@
|
|
23
23
|
#
|
24
24
|
# For ID3v2 frames, you can also set a default text encoding globally
|
25
25
|
# using the {TagLib::ID3v2::FrameFactory}.
|
26
|
+
#
|
27
|
+
# ## Modifying attributes
|
28
|
+
#
|
29
|
+
# Mutable Ruby types (String, Array) returned by TagLib cannot be modified in-place.
|
30
|
+
#
|
31
|
+
# @example Modifying an attribute in-place does not work
|
32
|
+
# tag.title = 'Title'
|
33
|
+
# tag.title
|
34
|
+
# # => "Title"
|
35
|
+
# tag.title << ' of the song'
|
36
|
+
# # => "Title of the song"
|
37
|
+
# tag.title
|
38
|
+
# # => "Title"
|
39
|
+
#
|
40
|
+
# @example You need to replace the existing attribute value
|
41
|
+
# tag.title = 'Title'
|
42
|
+
# tag.title
|
43
|
+
# # => "Title"
|
44
|
+
# tag.title = 'Title of the song'
|
45
|
+
# tag.title
|
46
|
+
# # => "Title of the song"
|
26
47
|
module TagLib
|
27
48
|
|
28
49
|
# Major version of TagLib the extensions were compiled against
|
@@ -226,7 +247,14 @@ module TagLib
|
|
226
247
|
Accurate = 2
|
227
248
|
|
228
249
|
# @return [Integer] length of the file in seconds
|
229
|
-
|
250
|
+
#
|
251
|
+
# @since 1.0.0
|
252
|
+
attr_reader :length_in_seconds
|
253
|
+
|
254
|
+
# @return [Integer] length of the file in milliseconds
|
255
|
+
#
|
256
|
+
# @since 1.0.0
|
257
|
+
attr_reader :length_in_milliseconds
|
230
258
|
|
231
259
|
# @return [Integer] bit rate in kb/s (kilobit per second)
|
232
260
|
attr_reader :bitrate
|
data/docs/taglib/flac.rb
CHANGED
@@ -30,7 +30,14 @@ module TagLib::FLAC
|
|
30
30
|
# file.save
|
31
31
|
# end
|
32
32
|
class File < TagLib::File
|
33
|
-
|
33
|
+
|
34
|
+
NoTags = 0x0000
|
35
|
+
XiphComment = 0x0001
|
36
|
+
ID3v1 = 0x0002
|
37
|
+
ID3v2 = 0x0004
|
38
|
+
AllTags = 0xffff
|
39
|
+
|
40
|
+
# {include:::TagLib::FileRef.open}
|
34
41
|
#
|
35
42
|
# @param (see #initialize)
|
36
43
|
# @yield [file] the {File} object, as obtained by {#initialize}
|
@@ -82,6 +89,14 @@ module TagLib::FLAC
|
|
82
89
|
def picture_list
|
83
90
|
end
|
84
91
|
|
92
|
+
# Remove the specified picture.
|
93
|
+
#
|
94
|
+
# @param [TagLib::FLAC::Picture] picture
|
95
|
+
#
|
96
|
+
# @since 1.0.0
|
97
|
+
def remove_picture(picture)
|
98
|
+
end
|
99
|
+
|
85
100
|
# Remove all pictures.
|
86
101
|
#
|
87
102
|
# @return [void]
|
@@ -94,12 +109,46 @@ module TagLib::FLAC
|
|
94
109
|
# @return [void]
|
95
110
|
def add_picture(picture)
|
96
111
|
end
|
112
|
+
|
113
|
+
# Remove the tags matching the specified OR-ed types.
|
114
|
+
#
|
115
|
+
# @param [int] tags The types of tags to remove.
|
116
|
+
# @return [void]
|
117
|
+
#
|
118
|
+
# @since 1.0.0
|
119
|
+
def strip(tags=TagLib::FLAC::File::AllTags)
|
120
|
+
end
|
121
|
+
|
122
|
+
# @return [Boolean] Whether or not the file on disk actually has a XiphComment.
|
123
|
+
#
|
124
|
+
# @since 1.0.0
|
125
|
+
def xiph_comment?
|
126
|
+
end
|
127
|
+
|
128
|
+
# @return [Boolean] Whether or not the file on disk actually has an ID3v1 tag.
|
129
|
+
#
|
130
|
+
# @since 1.0.0
|
131
|
+
def id3v1_tag?
|
132
|
+
end
|
133
|
+
|
134
|
+
# @return [Boolean] Whether or not the file on disk actually has an ID3v2 tag.
|
135
|
+
#
|
136
|
+
# @since 1.0.0
|
137
|
+
def id3v2_tag?
|
138
|
+
end
|
97
139
|
end
|
98
140
|
|
99
141
|
# FLAC audio properties.
|
100
142
|
class Properties < TagLib::AudioProperties
|
101
|
-
# @return [Integer]
|
102
|
-
|
143
|
+
# @return [Integer] Number of bits per audio sample.
|
144
|
+
#
|
145
|
+
# @since 1.0.0
|
146
|
+
attr_reader :bits_per_sample
|
147
|
+
|
148
|
+
# @return [Integer] Number of sample frames.
|
149
|
+
#
|
150
|
+
# @since 1.0.0
|
151
|
+
attr_reader :sample_frames
|
103
152
|
|
104
153
|
# @return [binary String] MD5 signature of uncompressed audio stream
|
105
154
|
# (binary data)
|
@@ -172,5 +221,12 @@ module TagLib::FLAC
|
|
172
221
|
#
|
173
222
|
# @return [binary String]
|
174
223
|
attr_accessor :data
|
224
|
+
|
225
|
+
# Parse the picture data in the FLAC picture block format.
|
226
|
+
# @return [Boolean] True if the data has been parsed successfully, false otherwise.
|
227
|
+
#
|
228
|
+
# @since 1.0.0
|
229
|
+
def parse(rawdata)
|
230
|
+
end
|
175
231
|
end
|
176
|
-
end
|
232
|
+
end
|