Class: Segue::Ffmpeg

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

Overview

Pulls tags out of a file by parsing what ffmpeg prints about it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Ffmpeg

Returns a new instance of Ffmpeg.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/segue/ffmpeg.rb', line 23

def initialize(path)
  @path = path
  parse

  @title = tag :title, :tit2
  @album = tag :album, :talb
  @artist = tag :artist, :tpe1, :tpe2
  @albumartist = tag :album_artist, :tso2
  @time = to_duration tag :duration
  @date = tag :date, :tdrc, :tyer
  @track = tag :track, :trck
  @puid = tag :"musicip puid"
  @mbartistid = tag :musicbrainz_artistid, :"musicbrainz artist id"
  @mbalbumid = tag :musicbrainz_albumid, :"musicbrainz album id"
  @mbalbumartistid = tag :musicbrainz_albumartistid, :"musicbrainz album artist id"
  @asin = tag :asin
end

Instance Attribute Details

#albumObject (readonly)

Returns the value of attribute album.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def album
  @album
end

#albumartistObject (readonly)

Returns the value of attribute albumartist.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def albumartist
  @albumartist
end

#artistObject (readonly)

Returns the value of attribute artist.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def artist
  @artist
end

#asinObject (readonly)

Returns the value of attribute asin.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def asin
  @asin
end

#dateObject (readonly)

Returns the value of attribute date.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def date
  @date
end

#mbalbumartistidObject (readonly)

Returns the value of attribute mbalbumartistid.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def mbalbumartistid
  @mbalbumartistid
end

#mbalbumidObject (readonly)

Returns the value of attribute mbalbumid.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def mbalbumid
  @mbalbumid
end

#mbartistidObject (readonly)

Returns the value of attribute mbartistid.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def mbartistid
  @mbartistid
end

#puidObject (readonly)

Returns the value of attribute puid.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def puid
  @puid
end

#timeObject (readonly)

Returns the value of attribute time.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def time
  @time
end

#titleObject (readonly)

Returns the value of attribute title.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def title
  @title
end

#trackObject (readonly)

Returns the value of attribute track.



8
9
10
# File 'lib/segue/ffmpeg.rb', line 8

def track
  @track
end

Instance Method Details

#tag(*names) ⇒ Object



41
42
43
44
# File 'lib/segue/ffmpeg.rb', line 41

def tag(*names)
  names.each { |name| return @meta[name] if @meta[name] }
  nil
end