taglib-ruby 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Changes in Releases of taglib-ruby
2
2
  ==================================
3
3
 
4
+ ## 0.5.1 (2012-06-16)
5
+
6
+ * Fix crashes (segfault) with nil arguments, e.g. with `tag.title = nil`
7
+ * Document TagLib::MPEG::File#save and TagLib::MPEG::File#strip (#11)
8
+ * Update TagLib of binary gem for Windows to 1.7.2
9
+
4
10
  ## 0.5.0 (2012-04-15)
5
11
 
6
12
  * Add support for FLAC
data/docs/taglib/base.rb CHANGED
@@ -116,6 +116,15 @@ module TagLib
116
116
 
117
117
  # @abstract Base class for files, see subclasses.
118
118
  class File
119
+
120
+ # Save the file and the associated tags.
121
+ #
122
+ # See subclasses, as some provide more control over what is saved.
123
+ #
124
+ # @return [Boolean] whether saving was successful
125
+ def save
126
+ end
127
+
119
128
  # Closes the file and releases all objects that were read from the
120
129
  # file (basically everything from the TagLib namespace).
121
130
  #
data/docs/taglib/mpeg.rb CHANGED
@@ -8,6 +8,12 @@ module TagLib::MPEG
8
8
  # end
9
9
  #
10
10
  class File < TagLib::File
11
+ NoTags = 0x0000
12
+ ID3v1 = 0x0001
13
+ ID3v2 = 0x0002
14
+ APE = 0x0004
15
+ AllTags = 0xffff
16
+
11
17
  # {include:TagLib::FileRef.open}
12
18
  #
13
19
  # @param (see #initialize)
@@ -55,6 +61,33 @@ module TagLib::MPEG
55
61
  # @return [TagLib::MPEG::Properties]
56
62
  def audio_properties
57
63
  end
64
+
65
+ # Save the file and the associated tags.
66
+ #
67
+ # @param [Integer] tags
68
+ # The tag types to save (see constants), e.g.
69
+ # {TagLib::MPEG::File::ID3v2}. To specify more than one tag type,
70
+ # or them together using `|`, e.g.
71
+ # `TagLib::MPEG::File::ID3v1 | TagLib::MPEG::File::ID3v2`.
72
+ # @param [Boolean] strip_others
73
+ # true if tag types other than the specified ones should be
74
+ # stripped from the file
75
+ # @return [Boolean] whether saving was successful
76
+ def save(tags=TagLib::MPEG::File::AllTags, strip_others=true)
77
+ end
78
+
79
+ # Strip the specified tags from the file. Note that this directly
80
+ # updates the file, a call to save afterwards is not necessary
81
+ # (closing the file is necessary as always, though).
82
+ #
83
+ # @param [Integer] tags
84
+ # The tag types to strip (see constants), e.g.
85
+ # {TagLib::MPEG::File::ID3v2}. To specify more than one tag type,
86
+ # or them together using `|`, e.g.
87
+ # `TagLib::MPEG::File::ID3v1 | TagLib::MPEG::File::ID3v2`.
88
+ # @return [Boolean] whether stripping was successful
89
+ def strip(tags=TagLib::MPEG::File::AllTags)
90
+ end
58
91
  end
59
92
 
60
93
  # Audio properties for MPEG files.
@@ -11,8 +11,12 @@ end
11
11
 
12
12
  dir_config('tag')
13
13
 
14
- if not have_library('stdc++')
15
- error "You must have libstdc++ installed."
14
+ # When compiling statically, -lstdc++ would make the resulting .so to
15
+ # have a dependency on an external libstdc++ instead of the static one.
16
+ unless $LDFLAGS.split(" ").include?("-static-libstdc++")
17
+ if not have_library('stdc++')
18
+ error "You must have libstdc++ installed."
19
+ end
16
20
  end
17
21
 
18
22
  if not have_library('tag')
@@ -39,7 +39,11 @@ VALUE taglib_bytevector_to_ruby_string(const TagLib::ByteVector &byteVector) {
39
39
  }
40
40
 
41
41
  TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
42
- return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
42
+ if (NIL_P(s)) {
43
+ return TagLib::ByteVector::null;
44
+ } else {
45
+ return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
46
+ }
43
47
  }
44
48
 
45
49
  VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
@@ -53,7 +57,11 @@ VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
53
57
  }
54
58
 
55
59
  TagLib::String ruby_string_to_taglib_string(VALUE s) {
56
- return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
60
+ if (NIL_P(s)) {
61
+ return TagLib::String::null;
62
+ } else {
63
+ return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
64
+ }
57
65
  }
58
66
 
59
67
  VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
@@ -67,6 +75,9 @@ VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
67
75
 
68
76
  TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
69
77
  TagLib::StringList result = TagLib::StringList();
78
+ if (NIL_P(ary)) {
79
+ return result;
80
+ }
70
81
  for (long i = 0; i < RARRAY_LEN(ary); i++) {
71
82
  VALUE e = RARRAY_PTR(ary)[i];
72
83
  TagLib::String s = ruby_string_to_taglib_string(e);
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 2.0.5
3
+ * Version 2.0.8
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -1843,7 +1843,7 @@ static VALUE mTagLib;
1843
1843
  #define SWIG_RUBY_THREAD_END_BLOCK
1844
1844
 
1845
1845
 
1846
- #define SWIGVERSION 0x020005
1846
+ #define SWIGVERSION 0x020008
1847
1847
  #define SWIG_VERSION SWIGVERSION
1848
1848
 
1849
1849
 
@@ -1883,7 +1883,11 @@ VALUE taglib_bytevector_to_ruby_string(const TagLib::ByteVector &byteVector) {
1883
1883
  }
1884
1884
 
1885
1885
  TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
1886
- return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1886
+ if (NIL_P(s)) {
1887
+ return TagLib::ByteVector::null;
1888
+ } else {
1889
+ return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1890
+ }
1887
1891
  }
1888
1892
 
1889
1893
  VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
@@ -1897,7 +1901,11 @@ VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
1897
1901
  }
1898
1902
 
1899
1903
  TagLib::String ruby_string_to_taglib_string(VALUE s) {
1900
- return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1904
+ if (NIL_P(s)) {
1905
+ return TagLib::String::null;
1906
+ } else {
1907
+ return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1908
+ }
1901
1909
  }
1902
1910
 
1903
1911
  VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
@@ -1911,6 +1919,9 @@ VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
1911
1919
 
1912
1920
  TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1913
1921
  TagLib::StringList result = TagLib::StringList();
1922
+ if (NIL_P(ary)) {
1923
+ return result;
1924
+ }
1914
1925
  for (long i = 0; i < RARRAY_LEN(ary); i++) {
1915
1926
  VALUE e = RARRAY_PTR(ary)[i];
1916
1927
  TagLib::String s = ruby_string_to_taglib_string(e);
@@ -2052,7 +2063,7 @@ SWIG_ruby_failed(void)
2052
2063
  }
2053
2064
 
2054
2065
 
2055
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2066
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2056
2067
  SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
2057
2068
  {
2058
2069
  VALUE obj = args[0];
@@ -2104,7 +2115,7 @@ SWIG_From_bool (bool value)
2104
2115
  }
2105
2116
 
2106
2117
 
2107
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2118
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2108
2119
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2109
2120
  {
2110
2121
  VALUE obj = args[0];
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 2.0.5
3
+ * Version 2.0.8
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -1850,7 +1850,7 @@ static VALUE mFLAC;
1850
1850
  #define SWIG_RUBY_THREAD_END_BLOCK
1851
1851
 
1852
1852
 
1853
- #define SWIGVERSION 0x020005
1853
+ #define SWIGVERSION 0x020008
1854
1854
  #define SWIG_VERSION SWIGVERSION
1855
1855
 
1856
1856
 
@@ -1891,7 +1891,11 @@ VALUE taglib_bytevector_to_ruby_string(const TagLib::ByteVector &byteVector) {
1891
1891
  }
1892
1892
 
1893
1893
  TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
1894
- return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1894
+ if (NIL_P(s)) {
1895
+ return TagLib::ByteVector::null;
1896
+ } else {
1897
+ return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1898
+ }
1895
1899
  }
1896
1900
 
1897
1901
  VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
@@ -1905,7 +1909,11 @@ VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
1905
1909
  }
1906
1910
 
1907
1911
  TagLib::String ruby_string_to_taglib_string(VALUE s) {
1908
- return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1912
+ if (NIL_P(s)) {
1913
+ return TagLib::String::null;
1914
+ } else {
1915
+ return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1916
+ }
1909
1917
  }
1910
1918
 
1911
1919
  VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
@@ -1919,6 +1927,9 @@ VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
1919
1927
 
1920
1928
  TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1921
1929
  TagLib::StringList result = TagLib::StringList();
1930
+ if (NIL_P(ary)) {
1931
+ return result;
1932
+ }
1922
1933
  for (long i = 0; i < RARRAY_LEN(ary); i++) {
1923
1934
  VALUE e = RARRAY_PTR(ary)[i];
1924
1935
  TagLib::String s = ruby_string_to_taglib_string(e);
@@ -1983,7 +1994,7 @@ SWIG_ruby_failed(void)
1983
1994
  }
1984
1995
 
1985
1996
 
1986
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1997
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1987
1998
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1988
1999
  {
1989
2000
  VALUE obj = args[0];
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 2.0.5
3
+ * Version 2.0.8
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -1838,7 +1838,7 @@ static VALUE mID3v1;
1838
1838
  #define SWIG_RUBY_THREAD_END_BLOCK
1839
1839
 
1840
1840
 
1841
- #define SWIGVERSION 0x020005
1841
+ #define SWIGVERSION 0x020008
1842
1842
  #define SWIG_VERSION SWIGVERSION
1843
1843
 
1844
1844
 
@@ -1874,7 +1874,11 @@ VALUE taglib_bytevector_to_ruby_string(const TagLib::ByteVector &byteVector) {
1874
1874
  }
1875
1875
 
1876
1876
  TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
1877
- return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1877
+ if (NIL_P(s)) {
1878
+ return TagLib::ByteVector::null;
1879
+ } else {
1880
+ return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1881
+ }
1878
1882
  }
1879
1883
 
1880
1884
  VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
@@ -1888,7 +1892,11 @@ VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
1888
1892
  }
1889
1893
 
1890
1894
  TagLib::String ruby_string_to_taglib_string(VALUE s) {
1891
- return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1895
+ if (NIL_P(s)) {
1896
+ return TagLib::String::null;
1897
+ } else {
1898
+ return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1899
+ }
1892
1900
  }
1893
1901
 
1894
1902
  VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
@@ -1902,6 +1910,9 @@ VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
1902
1910
 
1903
1911
  TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1904
1912
  TagLib::StringList result = TagLib::StringList();
1913
+ if (NIL_P(ary)) {
1914
+ return result;
1915
+ }
1905
1916
  for (long i = 0; i < RARRAY_LEN(ary); i++) {
1906
1917
  VALUE e = RARRAY_PTR(ary)[i];
1907
1918
  TagLib::String s = ruby_string_to_taglib_string(e);
@@ -2009,7 +2020,7 @@ SWIG_ruby_failed(void)
2009
2020
  }
2010
2021
 
2011
2022
 
2012
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2023
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2013
2024
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2014
2025
  {
2015
2026
  VALUE obj = args[0];
@@ -2065,7 +2076,7 @@ SWIG_From_unsigned_SS_int (unsigned int value)
2065
2076
  }
2066
2077
 
2067
2078
 
2068
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2079
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2069
2080
  SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
2070
2081
  {
2071
2082
  VALUE obj = args[0];
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 2.0.5
3
+ * Version 2.0.8
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -1861,7 +1861,7 @@ static VALUE mID3v2;
1861
1861
  #define SWIG_RUBY_THREAD_END_BLOCK
1862
1862
 
1863
1863
 
1864
- #define SWIGVERSION 0x020005
1864
+ #define SWIGVERSION 0x020008
1865
1865
  #define SWIG_VERSION SWIGVERSION
1866
1866
 
1867
1867
 
@@ -1911,7 +1911,11 @@ VALUE taglib_bytevector_to_ruby_string(const TagLib::ByteVector &byteVector) {
1911
1911
  }
1912
1912
 
1913
1913
  TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
1914
- return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1914
+ if (NIL_P(s)) {
1915
+ return TagLib::ByteVector::null;
1916
+ } else {
1917
+ return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1918
+ }
1915
1919
  }
1916
1920
 
1917
1921
  VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
@@ -1925,7 +1929,11 @@ VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
1925
1929
  }
1926
1930
 
1927
1931
  TagLib::String ruby_string_to_taglib_string(VALUE s) {
1928
- return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1932
+ if (NIL_P(s)) {
1933
+ return TagLib::String::null;
1934
+ } else {
1935
+ return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1936
+ }
1929
1937
  }
1930
1938
 
1931
1939
  VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
@@ -1939,6 +1947,9 @@ VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
1939
1947
 
1940
1948
  TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1941
1949
  TagLib::StringList result = TagLib::StringList();
1950
+ if (NIL_P(ary)) {
1951
+ return result;
1952
+ }
1942
1953
  for (long i = 0; i < RARRAY_LEN(ary); i++) {
1943
1954
  VALUE e = RARRAY_PTR(ary)[i];
1944
1955
  TagLib::String s = ruby_string_to_taglib_string(e);
@@ -2062,7 +2073,7 @@ SWIG_ruby_failed(void)
2062
2073
  }
2063
2074
 
2064
2075
 
2065
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2076
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2066
2077
  SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
2067
2078
  {
2068
2079
  VALUE obj = args[0];
@@ -2161,7 +2172,7 @@ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
2161
2172
 
2162
2173
 
2163
2174
 
2164
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2175
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2165
2176
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2166
2177
  {
2167
2178
  VALUE obj = args[0];
@@ -2306,7 +2317,7 @@ SWIG_From_float (float value)
2306
2317
  #include <float.h>
2307
2318
 
2308
2319
 
2309
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2320
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2310
2321
  SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
2311
2322
  {
2312
2323
  VALUE obj = args[0];
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 2.0.5
3
+ * Version 2.0.8
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -1848,7 +1848,7 @@ static VALUE mMPEG;
1848
1848
  #define SWIG_RUBY_THREAD_END_BLOCK
1849
1849
 
1850
1850
 
1851
- #define SWIGVERSION 0x020005
1851
+ #define SWIGVERSION 0x020008
1852
1852
  #define SWIG_VERSION SWIGVERSION
1853
1853
 
1854
1854
 
@@ -1889,7 +1889,11 @@ VALUE taglib_bytevector_to_ruby_string(const TagLib::ByteVector &byteVector) {
1889
1889
  }
1890
1890
 
1891
1891
  TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
1892
- return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1892
+ if (NIL_P(s)) {
1893
+ return TagLib::ByteVector::null;
1894
+ } else {
1895
+ return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1896
+ }
1893
1897
  }
1894
1898
 
1895
1899
  VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
@@ -1903,7 +1907,11 @@ VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
1903
1907
  }
1904
1908
 
1905
1909
  TagLib::String ruby_string_to_taglib_string(VALUE s) {
1906
- return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1910
+ if (NIL_P(s)) {
1911
+ return TagLib::String::null;
1912
+ } else {
1913
+ return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1914
+ }
1907
1915
  }
1908
1916
 
1909
1917
  VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
@@ -1917,6 +1925,9 @@ VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
1917
1925
 
1918
1926
  TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1919
1927
  TagLib::StringList result = TagLib::StringList();
1928
+ if (NIL_P(ary)) {
1929
+ return result;
1930
+ }
1920
1931
  for (long i = 0; i < RARRAY_LEN(ary); i++) {
1921
1932
  VALUE e = RARRAY_PTR(ary)[i];
1922
1933
  TagLib::String s = ruby_string_to_taglib_string(e);
@@ -2058,7 +2069,7 @@ SWIG_ruby_failed(void)
2058
2069
  }
2059
2070
 
2060
2071
 
2061
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2072
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2062
2073
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2063
2074
  {
2064
2075
  VALUE obj = args[0];
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 2.0.5
3
+ * Version 2.0.8
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -1840,7 +1840,7 @@ static VALUE mOgg;
1840
1840
  #define SWIG_RUBY_THREAD_END_BLOCK
1841
1841
 
1842
1842
 
1843
- #define SWIGVERSION 0x020005
1843
+ #define SWIGVERSION 0x020008
1844
1844
  #define SWIG_VERSION SWIGVERSION
1845
1845
 
1846
1846
 
@@ -1878,7 +1878,11 @@ VALUE taglib_bytevector_to_ruby_string(const TagLib::ByteVector &byteVector) {
1878
1878
  }
1879
1879
 
1880
1880
  TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
1881
- return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1881
+ if (NIL_P(s)) {
1882
+ return TagLib::ByteVector::null;
1883
+ } else {
1884
+ return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1885
+ }
1882
1886
  }
1883
1887
 
1884
1888
  VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
@@ -1892,7 +1896,11 @@ VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
1892
1896
  }
1893
1897
 
1894
1898
  TagLib::String ruby_string_to_taglib_string(VALUE s) {
1895
- return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1899
+ if (NIL_P(s)) {
1900
+ return TagLib::String::null;
1901
+ } else {
1902
+ return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1903
+ }
1896
1904
  }
1897
1905
 
1898
1906
  VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
@@ -1906,6 +1914,9 @@ VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
1906
1914
 
1907
1915
  TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1908
1916
  TagLib::StringList result = TagLib::StringList();
1917
+ if (NIL_P(ary)) {
1918
+ return result;
1919
+ }
1909
1920
  for (long i = 0; i < RARRAY_LEN(ary); i++) {
1910
1921
  VALUE e = RARRAY_PTR(ary)[i];
1911
1922
  TagLib::String s = ruby_string_to_taglib_string(e);
@@ -1969,7 +1980,7 @@ SWIG_ruby_failed(void)
1969
1980
  }
1970
1981
 
1971
1982
 
1972
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1983
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1973
1984
  SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
1974
1985
  {
1975
1986
  VALUE obj = args[0];
@@ -2092,7 +2103,7 @@ SWIG_From_unsigned_SS_int (unsigned int value)
2092
2103
  }
2093
2104
 
2094
2105
 
2095
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2106
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2096
2107
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2097
2108
  {
2098
2109
  VALUE obj = args[0];
@@ -1,6 +1,6 @@
1
1
  /* ----------------------------------------------------------------------------
2
2
  * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 2.0.5
3
+ * Version 2.0.8
4
4
  *
5
5
  * This file is not intended to be easily readable and contains a number of
6
6
  * coding conventions designed to improve portability and efficiency. Do not make
@@ -1844,7 +1844,7 @@ static VALUE mVorbis;
1844
1844
  #define SWIG_RUBY_THREAD_END_BLOCK
1845
1845
 
1846
1846
 
1847
- #define SWIGVERSION 0x020005
1847
+ #define SWIGVERSION 0x020008
1848
1848
  #define SWIG_VERSION SWIGVERSION
1849
1849
 
1850
1850
 
@@ -1882,7 +1882,11 @@ VALUE taglib_bytevector_to_ruby_string(const TagLib::ByteVector &byteVector) {
1882
1882
  }
1883
1883
 
1884
1884
  TagLib::ByteVector ruby_string_to_taglib_bytevector(VALUE s) {
1885
- return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1885
+ if (NIL_P(s)) {
1886
+ return TagLib::ByteVector::null;
1887
+ } else {
1888
+ return TagLib::ByteVector(RSTRING_PTR(s), RSTRING_LEN(s));
1889
+ }
1886
1890
  }
1887
1891
 
1888
1892
  VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
@@ -1896,7 +1900,11 @@ VALUE taglib_string_to_ruby_string(const TagLib::String & string) {
1896
1900
  }
1897
1901
 
1898
1902
  TagLib::String ruby_string_to_taglib_string(VALUE s) {
1899
- return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1903
+ if (NIL_P(s)) {
1904
+ return TagLib::String::null;
1905
+ } else {
1906
+ return TagLib::String(RSTRING_PTR(CONVERT_TO_UTF8(s)), TagLib::String::UTF8);
1907
+ }
1900
1908
  }
1901
1909
 
1902
1910
  VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
@@ -1910,6 +1918,9 @@ VALUE taglib_string_list_to_ruby_array(const TagLib::StringList & list) {
1910
1918
 
1911
1919
  TagLib::StringList ruby_array_to_taglib_string_list(VALUE ary) {
1912
1920
  TagLib::StringList result = TagLib::StringList();
1921
+ if (NIL_P(ary)) {
1922
+ return result;
1923
+ }
1913
1924
  for (long i = 0; i < RARRAY_LEN(ary); i++) {
1914
1925
  VALUE e = RARRAY_PTR(ary)[i];
1915
1926
  TagLib::String s = ruby_string_to_taglib_string(e);
@@ -1973,7 +1984,7 @@ SWIG_ruby_failed(void)
1973
1984
  }
1974
1985
 
1975
1986
 
1976
- /*@SWIG:/usr/local/share/swig/2.0.5/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1987
+ /*@SWIG:/usr/local/share/swig/2.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1977
1988
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1978
1989
  {
1979
1990
  VALUE obj = args[0];
@@ -2,7 +2,7 @@ module TagLib
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 5
5
- PATCH = 0
5
+ PATCH = 1
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
data/tasks/ext.rake CHANGED
@@ -7,9 +7,10 @@ tmp = "#{Dir.pwd}/tmp/#{plat}"
7
7
  toolchain_file = "#{Dir.pwd}/ext/win.cmake"
8
8
  install_dir = "#{tmp}/install"
9
9
  install_dll = "#{install_dir}/bin/libtag.dll"
10
- $cross_config_options = ["--with-opt-dir=#{install_dir}"]
10
+ ldflags = "-static-libgcc -static-libstdc++"
11
+ $cross_config_options = [%(--with-opt-dir=#{install_dir} --with-ldflags="#{ldflags}")]
11
12
 
12
- taglib_version = '1.7.1'
13
+ taglib_version = '1.7.2'
13
14
  taglib = "taglib-#{taglib_version}"
14
15
  taglib_url = "http://cloud.github.com/downloads/taglib/taglib/#{taglib}.tar.gz"
15
16
  # WITH_MP4, WITH_ASF only needed with taglib 1.7, will be default in 1.8
@@ -57,8 +58,8 @@ task :taglib => [install_dll]
57
58
 
58
59
  file install_dll => ["#{tmp}/#{taglib}"] do
59
60
  chdir "#{tmp}/#{taglib}" do
60
- sh "cmake -DCMAKE_INSTALL_PREFIX=#{install_dir} -DCMAKE_TOOLCHAIN_FILE=#{toolchain_file} #{taglib_options}"
61
- sh "make"
61
+ sh %(cmake -DCMAKE_INSTALL_PREFIX=#{install_dir} -DCMAKE_TOOLCHAIN_FILE=#{toolchain_file} -DCMAKE_SHARED_LINKER_FLAGS="#{ldflags}" #{taglib_options})
62
+ sh "make VERBOSE=1"
62
63
  sh "make install"
63
64
  end
64
65
  end
@@ -41,6 +41,10 @@ class TestID3v2Frames < Test::Unit::TestCase
41
41
  assert_equal TagLib::ID3v2::UserTextIdentificationFrame, txxx.class
42
42
  end
43
43
 
44
+ should "not fail for nil String" do
45
+ assert_equal [], @tag.frame_list(nil)
46
+ end
47
+
44
48
  should "be removable" do
45
49
  assert_equal 11, @tag.frame_list.size
46
50
  tit2 = @tag.frame_list('TIT2').first
@@ -8,6 +8,12 @@ class TestID3v2Write < Test::Unit::TestCase
8
8
  OUTPUT_FILE = "test/data/output.mp3"
9
9
  PICTURE_FILE = "test/data/globe_east_540.jpg"
10
10
 
11
+ def reloaded
12
+ TagLib::MPEG::File.open(OUTPUT_FILE, false) do |file|
13
+ yield file
14
+ end
15
+ end
16
+
11
17
  context "TagLib::MPEG::File" do
12
18
  setup do
13
19
  FileUtils.cp SAMPLE_FILE, OUTPUT_FILE
@@ -19,6 +25,39 @@ class TestID3v2Write < Test::Unit::TestCase
19
25
  success = @file.strip
20
26
  assert success
21
27
  assert_nil @file.id3v2_tag
28
+ @file.close
29
+ @file = nil
30
+
31
+ reloaded do |file|
32
+ assert_equal true, file.id3v1_tag.empty?
33
+ assert_equal true, file.id3v2_tag.empty?
34
+ end
35
+ end
36
+
37
+ should "be able to save only ID3v2 tag" do
38
+ assert_not_nil @file.id3v2_tag
39
+ assert_not_nil @file.id3v1_tag
40
+ @file.save(TagLib::MPEG::File::ID3v2)
41
+ @file.close
42
+ @file = nil
43
+
44
+ reloaded do |file|
45
+ id3v1_tag = file.id3v1_tag
46
+ id3v2_tag = file.id3v2_tag
47
+
48
+ # TagLib always creates the tags
49
+ assert_not_nil id3v1_tag
50
+ assert_not_nil id3v2_tag
51
+
52
+ assert_equal true, file.id3v1_tag.empty?
53
+ assert_equal false, file.id3v2_tag.empty?
54
+ end
55
+ end
56
+
57
+ should "be able to set fields to nil" do
58
+ tag = @file.id3v2_tag
59
+ tag.title = nil
60
+ assert_equal [], tag.frame_list('TIT2')
22
61
  end
23
62
 
24
63
  context "with a fresh tag" do
@@ -72,6 +111,12 @@ class TestID3v2Write < Test::Unit::TestCase
72
111
  assert success
73
112
  end
74
113
 
114
+ should "not fail when field_list is nil" do
115
+ tit2 = TagLib::ID3v2::TextIdentificationFrame.new("TIT2", TagLib::String::UTF8)
116
+ tit2.field_list = nil
117
+ assert_equal [], tit2.field_list
118
+ end
119
+
75
120
  if HAVE_ENCODING
76
121
  should "be able to set unicode fields" do
77
122
  # Hello, Unicode Snowman (not in Latin1)
metadata CHANGED
@@ -1,95 +1,74 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: taglib-ruby
3
- version: !ruby/object:Gem::Version
4
- hash: 11
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 5
9
- - 0
10
- version: 0.5.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Robin Stocker
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-15 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
12
+ date: 2012-06-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: &14544380 !ruby/object:Gem::Requirement
22
17
  none: false
23
- requirements:
18
+ requirements:
24
19
  - - ~>
25
- - !ruby/object:Gem::Version
26
- hash: 19
27
- segments:
28
- - 1
29
- - 1
30
- - 0
20
+ - !ruby/object:Gem::Version
31
21
  version: 1.1.0
32
- prerelease: false
33
- requirement: *id001
34
22
  type: :development
35
- name: bundler
36
- - !ruby/object:Gem::Dependency
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
40
- - - ~>
41
- - !ruby/object:Gem::Version
42
- hash: 27
43
- segments:
44
- - 0
45
- - 8
46
- version: "0.8"
47
23
  prerelease: false
48
- requirement: *id002
49
- type: :development
24
+ version_requirements: *14544380
25
+ - !ruby/object:Gem::Dependency
50
26
  name: rake-compiler
51
- - !ruby/object:Gem::Dependency
52
- version_requirements: &id003 !ruby/object:Gem::Requirement
27
+ requirement: &14543840 !ruby/object:Gem::Requirement
53
28
  none: false
54
- requirements:
29
+ requirements:
55
30
  - - ~>
56
- - !ruby/object:Gem::Version
57
- hash: 15
58
- segments:
59
- - 1
60
- - 0
61
- version: "1.0"
62
- prerelease: false
63
- requirement: *id003
31
+ - !ruby/object:Gem::Version
32
+ version: '0.8'
64
33
  type: :development
34
+ prerelease: false
35
+ version_requirements: *14543840
36
+ - !ruby/object:Gem::Dependency
65
37
  name: shoulda-context
66
- - !ruby/object:Gem::Dependency
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
38
+ requirement: &14543240 !ruby/object:Gem::Requirement
68
39
  none: false
69
- requirements:
40
+ requirements:
70
41
  - - ~>
71
- - !ruby/object:Gem::Version
72
- hash: 5
73
- segments:
74
- - 0
75
- - 7
76
- version: "0.7"
77
- prerelease: false
78
- requirement: *id004
42
+ - !ruby/object:Gem::Version
43
+ version: '1.0'
79
44
  type: :development
45
+ prerelease: false
46
+ version_requirements: *14543240
47
+ - !ruby/object:Gem::Dependency
80
48
  name: yard
81
- description: |
82
- Ruby interface for the taglib C++ library, for reading and writing
49
+ requirement: &14542120 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '0.7'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *14542120
58
+ description: ! 'Ruby interface for the taglib C++ library, for reading and writing
59
+
83
60
  meta-data (tags) of many audio formats.
84
-
61
+
62
+
85
63
  In contrast to other libraries, this one wraps the C++ API using SWIG,
64
+
86
65
  not only the minimal C API. This means that all tags can be accessed.
87
66
 
88
- email:
67
+ '
68
+ email:
89
69
  - robin@nibor.org
90
70
  executables: []
91
-
92
- extensions:
71
+ extensions:
93
72
  - ext/taglib_base/extconf.rb
94
73
  - ext/taglib_mpeg/extconf.rb
95
74
  - ext/taglib_id3v1/extconf.rb
@@ -97,11 +76,11 @@ extensions:
97
76
  - ext/taglib_ogg/extconf.rb
98
77
  - ext/taglib_vorbis/extconf.rb
99
78
  - ext/taglib_flac/extconf.rb
100
- extra_rdoc_files:
79
+ extra_rdoc_files:
101
80
  - CHANGES.md
102
81
  - LICENSE.txt
103
82
  - README.md
104
- files:
83
+ files:
105
84
  - .yardopts
106
85
  - CHANGES.md
107
86
  - Gemfile
@@ -190,32 +169,31 @@ files:
190
169
  - test/vorbis_tag_test.rb
191
170
  - ext/taglib_flac/extconf.rb
192
171
  homepage: http://robinst.github.com/taglib-ruby/
193
- licenses:
172
+ licenses:
194
173
  - MIT
195
174
  post_install_message:
196
175
  rdoc_options: []
197
-
198
- require_paths:
176
+ require_paths:
199
177
  - lib
200
- required_ruby_version: !ruby/object:Gem::Requirement
178
+ required_ruby_version: !ruby/object:Gem::Requirement
201
179
  none: false
202
- requirements:
203
- - - ">="
204
- - !ruby/object:Gem::Version
205
- hash: 3
206
- segments:
180
+ requirements:
181
+ - - ! '>='
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ segments:
207
185
  - 0
208
- version: "0"
209
- required_rubygems_version: !ruby/object:Gem::Requirement
186
+ hash: -53851698811964232
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
210
188
  none: false
211
- requirements:
212
- - - ">="
213
- - !ruby/object:Gem::Version
214
- hash: 3
215
- segments:
189
+ requirements:
190
+ - - ! '>='
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ segments:
216
194
  - 0
217
- version: "0"
218
- requirements:
195
+ hash: -53851698811964232
196
+ requirements:
219
197
  - taglib (libtag1-dev in Debian/Ubuntu, taglib-devel in Fedora/RHEL)
220
198
  rubyforge_project:
221
199
  rubygems_version: 1.8.10
@@ -223,5 +201,4 @@ signing_key:
223
201
  specification_version: 3
224
202
  summary: Ruby interface for the taglib C++ library
225
203
  test_files: []
226
-
227
204
  has_rdoc: