Class: Podcast::Mp3File

Inherits:
Object
  • Object
show all
Defined in:
lib/podcast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(f) ⇒ Mp3File

Returns a new instance of Mp3File.



114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/podcast.rb', line 114

def initialize(f)
  file = File.new(f)
  info = Mp3Info.open(f)
  tag = info.tag()
  @file = f
  @artist = tag['artist']
  @album = tag['album']
  @title = tag['title']
  @path = file.path()
  @length = file.stat.size()
  @mtime = file.stat.mtime()
  @type = 'audio/mpeg'
end

Instance Attribute Details

#albumObject

Returns the value of attribute album.



111
112
113
# File 'lib/podcast.rb', line 111

def album
  @album
end

#artistObject

Returns the value of attribute artist.



111
112
113
# File 'lib/podcast.rb', line 111

def artist
  @artist
end

#fileObject

Returns the value of attribute file.



111
112
113
# File 'lib/podcast.rb', line 111

def file
  @file
end

#lengthObject

Returns the value of attribute length.



111
112
113
# File 'lib/podcast.rb', line 111

def length
  @length
end

#mtimeObject

Returns the value of attribute mtime.



111
112
113
# File 'lib/podcast.rb', line 111

def mtime
  @mtime
end

#pathObject

Returns the value of attribute path.



111
112
113
# File 'lib/podcast.rb', line 111

def path
  @path
end

#titleObject

Returns the value of attribute title.



111
112
113
# File 'lib/podcast.rb', line 111

def title
  @title
end

#typeObject

Returns the value of attribute type.



111
112
113
# File 'lib/podcast.rb', line 111

def type
  @type
end

Instance Method Details

#to_sObject



128
129
130
# File 'lib/podcast.rb', line 128

def to_s
  @title
end