RubyGems Navigation menu

taglib-ruby 0.1.0

taglib-ruby =========== Ruby interface for the [TagLib C++ library][taglib]. In contrast to other libraries, this one wraps the full C++ API using SWIG, not only the minimal C API. This means that all tags can be accessed. taglib-ruby is work in progress, here are some of the things still left to do (contributors very welcome): * Wrap TagLib::MPEG::Properties * Pre-compiled Gem for Windows * More coverage of the library besides ID3v2 Usage ----- Here's an example for reading an ID3v2 tag: require 'taglib' # Load an ID3v2 tag from a file file = TagLib::MPEG::File.new("wake_up.mp3") tag = file.id3v2_tag # Read basic attributes tag.title #=> "Wake Up" tag.artist #=> "Arcade Fire" tag.track #=> 7 # Access all frames tag.frame_list.size #=> 13 # Track frame track = tag.frame_list('TRCK').first track.to_s #=> "7/10" # Attached picture frame cover = tag.frame_list('APIC').first cover.mime_type #=> "image/jpeg" cover.picture #=> "\xFF\xD8\xFF\xE0\x00\x10JFIF..." And here's an example for writing one: file = TagLib::MPEG::File.new("joga.mp3") tag = file.id3v2_tag # Write basic attributes tag.artist = "Björk" tag.title = "Jóga" # Add attached picture frame apic = TagLib::ID3v2::AttachedPictureFrame.new apic.mime_type = "image/jpeg" apic.description = "Cover" apic.type = TagLib::ID3v2::AttachedPictureFrame::FrontCover apic.picture = File.open("cover.jpg", 'rb'){ |f| f.read } tag.add_frame(apic) file.save ### Encoding By default, taglib stores text frames as ISO-8859-1 (Latin-1), if the text contains only characters that are available in that encoding. If not (e.g. with Cyrillic, Chinese, Japanese), it prints a warning and stores the text as UTF-8. When you already know that you want to store the text as UTF-8, you can change the default text encoding: frame_factory = TagLib::ID3v2::FrameFactory.instance frame_factory.default_text_encoding = TagLib::String::UTF8 Another option is using the advanced API: title = tag.frame_list('TIT2').first title.text = "Jóga" title.text_encoding = TagLib::String::UTF8 Contributing ------------ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it * Fork the project * Start a feature/bugfix branch * Commit and push until you are happy with your contribution * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. License ------- taglib-ruby is distributed under the MIT License, see LICENSE.txt for details. Copyright (c) 2010, 2011 Robin Stocker. [taglib]: http://developer.kde.org/~wheeler/taglib.html

Gemfile:
=

安裝:
=

版本列表:

  1. 2.0.0 October 28, 2024 (820.5 KB)
  2. 1.1.3 December 29, 2022 (817.0 KB)
  3. 1.1.2 April 13, 2022 (810.5 KB)
  4. 1.1.1 April 12, 2022 (810.0 KB)
  5. 1.1.0 January 20, 2021 (803.0 KB)
  6. 0.1.0 September 17, 2011 (273.5 KB)
顯示所有版本(共 25)

Development 相依性套件 (6):

bundler ~> 1.0.0
jeweler ~> 1.6.4
rake-compiler ~> 0.7
rcov >= 0
rdoc ~> 3.9
shoulda ~> 2.11

擁有者:

作者:

  • Robin Stocker

SHA 256 總和檢查碼:

=

總下載次數 339,138

這個版本 3,127

版本发布:

授權:

Ruby 版本需求:

相關連結: