Created
October 29, 2010 10:05
-
-
Save rochefort/653268 to your computer and use it in GitHub Desktop.
remove_buzzword_from_itunes_lyric
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
#! /usr/bin/env ruby | |
begin require 'rubygems'; rescue LoadError; end | |
$KCODE = "UTF8" | |
require 'rbosa' | |
OSA.utf8_strings = true | |
itunes = OSA.app('iTunes') | |
plist = itunes.current_playlist | |
pl_Array = plist.tracks() | |
pl_Array.each{ |track| | |
preLyric = track.lyrics | |
song = track.name | |
artist = track.artist | |
if preLyric != nil && preLyric.length != 0 | |
buzWords = preLyric.scan(/(<IMG src=.*>|\[.*http:\/\/.*\])/m) | |
if buzWords.length != 0 | |
puts "#{artist}\t#{song}\t#{buzWords}" | |
end | |
#置換 | |
track.lyrics = preLyric.gsub((/(<IMG src=.*>|\[.*http:\/\/.*\])/m),"") | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
RubyでiTunesのコメントを修正 - うんたらかんたら日記
http://d.hatena.ne.jp/rochefort/20081025/p1