Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First commit. Adds hard-coded tags and artwork from sample.png to sam…
…ple.mp3.
- Loading branch information
0 parents
commit 89860c5
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# custom | ||
sample copy.mp3 | ||
|
||
# osx noise | ||
.DS_Store | ||
profile | ||
|
||
# xcode noise | ||
build/* | ||
*.mode1 | ||
*.mode1v3 | ||
*.mode2v3 | ||
*.perspective | ||
*.perspectivev3 | ||
*.pbxuser | ||
*.xcworkspace | ||
xcuserdata | ||
|
||
# svn & cvs | ||
.svn | ||
CVS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
### Depends on: ### | ||
# taglib: http://developer.kde.org/~wheeler/taglib.html `brew install taglib` | ||
# taglib-ruby: http://robinst.github.com/taglib-ruby/ `gem install taglib-ruby` | ||
|
||
require 'rubygems' | ||
require 'taglib' | ||
|
||
#Define attributes | ||
title = "Track Name Goes Here" | ||
artist = "Artist Goes Here" | ||
album = "Album Goes Here" | ||
year = 2012 | ||
track_number = 1 | ||
genre = "Genre Goes Here" | ||
|
||
#Open file | ||
TagLib::MPEG::File.open("sample.mp3") do |file| | ||
tag = file.id3v2_tag(true) | ||
|
||
# Set attributes | ||
tag.title = title | ||
tag.artist = artist | ||
tag.album = album | ||
tag.year = year | ||
tag.track = track_number | ||
tag.genre = genre | ||
|
||
#Add artwork | ||
artframe = TagLib::ID3v2::AttachedPictureFrame.new | ||
artframe.mime_type = "image/png" | ||
artframe.description = "Cover" | ||
artframe.type = TagLib::ID3v2::AttachedPictureFrame::FrontCover | ||
artframe.picture = File.open("sample.png", 'rb') { |f| f.read } | ||
|
||
tag.add_frame(artframe) | ||
|
||
#Save file | ||
file.save | ||
end |
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.