Class: Tags
- Inherits:
-
Object
- Object
- Tags
- Includes:
- SanitizePlugin
- Defined in:
- lib/what_cd/sanitize_plugins/tags.rb
Instance Method Summary collapse
-
#initialize ⇒ Tags
constructor
A new instance of Tags.
- #sanitize(context) ⇒ Object
Constructor Details
#initialize ⇒ Tags
Returns a new instance of Tags.
10 11 12 13 14 15 16 17 18 |
# File 'lib/what_cd/sanitize_plugins/tags.rb', line 10 def initialize @log = Logging.logger[self] @log.appenders = Logging.appenders.stdout if $verbose @log.level = :debug else @log.level = :info end end |
Instance Method Details
#sanitize(context) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/what_cd/sanitize_plugins/tags.rb', line 20 def sanitize(context) path = context[:path] Dir.entries(path).each do |f| if !File.directory?(f) and File.extname(f) == ".mp3" file_path = path + f Mp3Info.open(file_path) do |mp3| # Remove all comments if not mp3.tag.comments.nil? or not mp3.tag2.COMM.nil? mp3.tag.comments = nil mp3.tag2.COMM = nil end # Handle publisher tag mp3.tag2.TPUB = nil end end end return context end |