1 diff -aur ruby-taglib-1.1/.config ruby-taglib-1.1+patch2_ruby1.9//.config
2 --- ruby-taglib-1.1/lib/taglib.rb 2006-05-09 16:39:37.000000000 +0200
3 +++ ruby-taglib-1.1+patch2_ruby1.9//lib/taglib.rb 2010-07-26 18:03:14.000000000 +0200
5 # Copyright (C) 2004 Neil Stevens <neil@hakubi.us>
6 +# Copyright (C) 2010 Vincent Carmona <vinc4mai@gmail.com>
8 # Permission is hereby granted, free of charge, to any person obtaining a copy
9 # of this software and associated documentation files (the "Software"), to deal
14 -extend DL::Importable
16 + extend DL::Importer#Since ruby 1.9
18 + extend DL::Importable#Old ruby versions
23 + #dlload 'libtag_c.so.0'# for debian-like or use a link.
26 dlload 'libtag_c.dylib'
28 extern 'char* taglib_tag_album(void*)'
29 extern 'char* taglib_tag_comment(void*)'
30 extern 'char* taglib_tag_genre(void*)'
31 -extern 'uint taglib_tag_year(void*)'
32 -extern 'uint taglib_tag_track(void*)'
33 +extern 'unsigned int taglib_tag_year(void*)'
34 +extern 'unsigned int taglib_tag_track(void*)'
35 extern 'void taglib_tag_set_title(void*, char*)'
36 extern 'void taglib_tag_set_artist(void*, char*)'
37 extern 'void taglib_tag_set_album(void*, char*)'
38 extern 'void taglib_tag_set_comment(void*, char*)'
39 extern 'void taglib_tag_set_genre(void*, char*)'
40 -extern 'void taglib_tag_set_year(void*, uint)'
41 -extern 'void taglib_tag_set_track(void*, uint)'
42 +extern 'void taglib_tag_set_year(void*, unsigned int)'
43 +extern 'void taglib_tag_set_track(void*, unsigned int)'
45 extern 'int taglib_audioproperties_length(void*)'
46 extern 'int taglib_audioproperties_bitrate(void*)'
54 + raise BadPath.new unless @path
59 @file = TagLib.taglib_file_new(@path)
71 +#I have had to_s method to be sure that methods return a string and not a char*.
72 +#The behaviour is inconsistent depending on ruby version.
73 +#I hope that is not too ugly.
77 - return TagLib.taglib_tag_title(tag)
78 + TagLib.taglib_tag_title(tag).to_s
86 - return TagLib.taglib_tag_artist(tag)
87 + TagLib.taglib_tag_artist(tag).to_s
95 - return TagLib.taglib_tag_album(tag)
96 + TagLib.taglib_tag_album(tag).to_s
104 - return TagLib.taglib_tag_comment(tag)
105 + TagLib.taglib_tag_comment(tag).to_s
113 - return TagLib.taglib_tag_genre(tag)
114 + TagLib.taglib_tag_genre(tag).to_s
122 - return TagLib.taglib_tag_year(tag)
123 + TagLib.taglib_tag_year(tag)
131 - return TagLib.taglib_tag_track(tag)
132 + TagLib.taglib_tag_track(tag)
136 @@ -196,46 +205,36 @@
140 - return TagLib.taglib_audioproperties_length(audio)
141 + TagLib.taglib_audioproperties_length(audio)
145 - return TagLib.taglib_audioproperties_bitrate(audio)
146 + TagLib.taglib_audioproperties_bitrate(audio)
150 - return TagLib.taglib_audioproperties_samplerate(audio)
151 + TagLib.taglib_audioproperties_samplerate(audio)
155 - return TagLib.taglib_audioproperties_channels(audio)
156 + TagLib.taglib_audioproperties_channels(audio)
162 - @tag = TagLib.taglib_file_tag(@file)
168 + @tag ||= TagLib.taglib_file_tag(@file)
169 + raise BadTag.new unless @tag
175 - @audio = TagLib.taglib_file_audioproperties(@file)
177 - raise BadAudioProperties.new
181 + @audio ||= TagLib.taglib_file_audioproperties(@file)
182 + raise BadAudioProperties.new unless @audio
186 def taglibForMime(mime)
187 - if mime.include?('MP3')
188 - return TagLib::MPEG
190 + return TagLib::MPEG if mime.include?('MP3')
192 if mime.include?('Ogg') or mime.include?('ogg')
193 if mime.include?('Vorbis') or mime.include?('vorbis')