Class: Etree::InfoFile
- Inherits:
-
Object
- Object
- Etree::InfoFile
- Defined in:
- lib/etree/info_file.rb
Overview
This will parse the info file that comes with a show Typical usage might look like:
info_file = Etree::InfoFile.new :directory => "ph1999-12-31.flacf"
info_file.parse
info_file.band # => "Phish"
info_file.date # => "1999-12-31"
info_file.venue # => "Big Cypress Seminole Indian Reservation, Big Cypress, FL"
info_file.discs.first # => ["Runaway Jim", "Funky Bitch", ...]
Constant Summary collapse
- REGEXPS =
{ :spots => %r{fob|dfc|btp|d?aud|d?sbd|soundboard|on(\s*|-)stage|matrix|mix|balcony|rail|stand}ix, :mics => %r{caps|omni|cardioid|sc?ho?ep[sz]|neumann|mbho|akg|b&k|dpa|audio.technica}ix, :configs => %r{\b(?:ortf|x[-\/]?y|degrees|blumlein|binaural|nos|din)\b}ix, :cables => %r{kc5|actives?|patch(?:ed)?|coax|optical}ix, :pres => %r{lunatec|apogee|ad1000|ad2k\+?|oade|sonosax|sbm-?1|usb-pre|mini[\s-]?me}ix, :dats => %r{dat|pcm|d[378]|da20|d10|m1|sv-25[05]|da-?p1|tascam|sony|teac|aiwa|panasonic|hhb|portadat|44\.1(?:k(?:hz))|mini-?disc|fostex}ix, :laptops => %r{laptop|dell|ibm|apple|toshiba|(power|i)-?book}ix, :digicards => %r{ieee1394|s.?pdif|zefiro|za-?2|rme|digiface|sb-?live|fiji|turtle\sbeach|delta\sdio|event\sgina|montego|zoltrix|prodif}ix, :software => %r{cd-?wave?|mkwact|shn(?:v3)?|shorten|samplitude|cool[-\s]?edit|sound.?forge|wavelab}ix, :venues => %r{(?:arts cent|theat)(?:er|re)|playhouse|arena|club|university|festival|lounge|room|cafe|field|house|airport|ballroom|college|hall|auditorium|village|temple}ix, :states => %r{A[BLKZR]|BC|CA|CO|CT|DE|FL|GA|HI|I[DLNA]|KS|KY|LA|M[ABEDINSOT]|N[BCDEFVHJMSY]|O[HKNR]|P[AQ]|PEI|QC|RI|S[CDK]|TN|TX|UT|VT|VA|W[AVIY]|DC}x, :countries => %r{Japan|England|Ireland|Brazil|Jamaica|United\s+Kingdom|Italy|South\s+Africa|Sweden|Portugal|Israel|Egypt|Norway|France|India|Finland|United\s+States|China|Mexico|Costa\s+Rica|Ecuador|New\s+Zealand|Puerto\s+Rico|Djibouti}i }
- TRACK_REGEXP =
%r{^(?:d\d+)?t?(\d+) # sometimes you see d<n>t<m> \s* (?:[[:punct:]]+)? # whitespace, some punctuation \s* (.*)}mix
Instance Attribute Summary collapse
-
#band ⇒ Object
whitespace, the track title.
-
#comments ⇒ Object
whitespace, the track title.
-
#date ⇒ Object
whitespace, the track title.
-
#directory ⇒ Object
whitespace, the track title.
-
#discs ⇒ Object
whitespace, the track title.
-
#info_file ⇒ Object
whitespace, the track title.
-
#source ⇒ Object
whitespace, the track title.
-
#venue ⇒ Object
whitespace, the track title.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ InfoFile
constructor
A new instance of InfoFile.
- #parse(info_file = nil) ⇒ Object
- #songs_count ⇒ Object
- #tracks ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ InfoFile
Returns a new instance of InfoFile.
36 37 38 39 40 |
# File 'lib/etree/info_file.rb', line 36 def initialize(attrs={}) attrs.each do |k,v| send("#{k}=", v) end end |
Instance Attribute Details
#band ⇒ Object
whitespace, the track title
34 35 36 |
# File 'lib/etree/info_file.rb', line 34 def band @band end |
#comments ⇒ Object
whitespace, the track title
34 35 36 |
# File 'lib/etree/info_file.rb', line 34 def comments @comments end |
#date ⇒ Object
whitespace, the track title
34 35 36 |
# File 'lib/etree/info_file.rb', line 34 def date @date end |
#directory ⇒ Object
whitespace, the track title
34 35 36 |
# File 'lib/etree/info_file.rb', line 34 def directory @directory end |
#discs ⇒ Object
whitespace, the track title
34 35 36 |
# File 'lib/etree/info_file.rb', line 34 def discs @discs end |
#info_file ⇒ Object
whitespace, the track title
34 35 36 |
# File 'lib/etree/info_file.rb', line 34 def info_file @info_file end |
#source ⇒ Object
whitespace, the track title
34 35 36 |
# File 'lib/etree/info_file.rb', line 34 def source @source end |
#venue ⇒ Object
whitespace, the track title
34 35 36 |
# File 'lib/etree/info_file.rb', line 34 def venue @venue end |
Instance Method Details
#parse(info_file = nil) ⇒ Object
42 43 44 45 |
# File 'lib/etree/info_file.rb', line 42 def parse(info_file=nil) self.info_file = info_file if info_file parse_info end |
#songs_count ⇒ Object
58 59 60 |
# File 'lib/etree/info_file.rb', line 58 def songs_count Dir["#{directory}/*.flac"].size end |