Class: Rutaci::Source
- Inherits:
-
Object
- Object
- Rutaci::Source
- Defined in:
- lib/rutaci/source.rb
Overview
This class collects the taginfo from various sources. Planed are
-
Taglib: use taglib to get the info trom a file
-
Filename: use the file’s name and path to extract the info
-
Musicbrainz: use an acoustic fingerprint to lookup the info at musicbrainz.org
-
Commandline: get the info from commandline parameters (dummy, all the work is already done by the OptionParser)
Direct Known Subclasses
Class Method Summary collapse
-
.factory(filename, options = {}) ⇒ Object
this class function returns an source object, which type is determined by the options.
Class Method Details
.factory(filename, options = {}) ⇒ Object
this class function returns an source object, which type is determined by the options
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rutaci/source.rb', line 27 def self.factory(filename, = {}) # if the info is given in the command line, options.fields is a Hash (else: nil or Array) return CommandlineSource.new() if .fields.class == Hash if .musicbrainz require 'rutaci/musicbrainz_source' return MusicbrainzSource.new(filename, ) end if .format and .command == :set require 'rutaci/filename_source' return FilenameSource.new(filename, ) end # the default source is taglib require 'rutaci/taglib_source' return TaglibSource.new(filename, ) end |