rutaci 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,55 @@
1
+ # rutaci is a ruby tagger with a command line interface
2
+ # Copyright (C) 2008 Jonas Bähr <jonas.baehr@fs.ei.tum.de>
3
+ #
4
+ # This program is free software; you can redistribute it and/or
5
+ # modify it under the terms of the GNU General Public License
6
+ # as published by the Free Software Foundation; either version 2
7
+ # of the License, or (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
+
18
+ module Rutaci
19
+ # This class collects the taginfo from various sources.
20
+ # Planed are
21
+ # - Taglib: use taglib to get the info trom a file
22
+ # - Filename: use the file's name and path to extract the info
23
+ # - Musicbrainz: use an acoustic fingerprint to lookup the info at musicbrainz.org
24
+ # - Commandline: get the info from commandline parameters (dummy, all the work is already done by the OptionParser)
25
+ class Source
26
+ # this class function returns an source object, which type is determined by the options
27
+ def self.factory(filename, options = {})
28
+ # if the info is given in the command line, options.fields is a Hash (else: nil or Array)
29
+ return CommandlineSource.new(options) if options.fields.class == Hash
30
+
31
+ if options.musicbrainz
32
+ require 'rutaci/musicbrainz_source'
33
+ return MusicbrainzSource.new(filename, options)
34
+ end
35
+
36
+ if options.format and options.command == :set
37
+ require 'rutaci/filename_source'
38
+ return FilenameSource.new(filename, options)
39
+ end
40
+
41
+ # the default source is taglib
42
+ require 'rutaci/taglib_source'
43
+ return TaglibSource.new(filename, options)
44
+ end
45
+ end # class Source
46
+
47
+ # this is just a convinience wrapper around the commanline info from OptionParser
48
+ class CommandlineSource < Source
49
+ attr_reader :info
50
+ def initialize(options)
51
+ raise ArgumentError, "options.fields need to be a hash" unless options.fields.class == Hash
52
+ @info = options.fields
53
+ end
54
+ end # class CommandlineSource
55
+ end # module Rutaci
@@ -0,0 +1,38 @@
1
+ # rutaci is a ruby tagger with a command line interface
2
+ # Copyright (C) 2008 Jonas Bähr <jonas.baehr@fs.ei.tum.de>
3
+ #
4
+ # This program is free software; you can redistribute it and/or
5
+ # modify it under the terms of the GNU General Public License
6
+ # as published by the Free Software Foundation; either version 2
7
+ # of the License, or (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
+
18
+ require 'rtaglib'
19
+
20
+ module Rutaci
21
+ # This class collects the taginfo from various sources.
22
+ class TaglibSource < Source
23
+ attr_reader :info
24
+ def initialize(filename, options)
25
+ raise ArgumentError, "options.fields need to be an array" unless options.fields.class == Array
26
+ @tagfile = TagFile::File.new filename
27
+ @info = self.get_fields options.fields
28
+ end
29
+
30
+ def get_fields(fieldlist)
31
+ info = Hash.new
32
+ fieldlist.each do |field|
33
+ info[field] = @tagfile.send field
34
+ end
35
+ return info
36
+ end
37
+ end # class CommandlineSource
38
+ end # module Rutaci
data/lib/rutaci.rb ADDED
@@ -0,0 +1,26 @@
1
+ # This file is part of rutaci, see the README for more information
2
+ # Copyright (C) 2008 Jonas Bähr <jonas.baehr@fs.ei.tum.de>
3
+ #
4
+ # This program is free software; you can redistribute it and/or
5
+ # modify it under the terms of the GNU General Public License
6
+ # as published by the Free Software Foundation; either version 2
7
+ # of the License, or (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
+
18
+ require 'rutaci/application.rb'
19
+
20
+ module Rutaci
21
+ class << self
22
+ def application
23
+ @application ||= Rutaci::Application.new
24
+ end
25
+ end
26
+ end # module Rutaci
data/rutaci.gemspec ADDED
@@ -0,0 +1,111 @@
1
+
2
+ # Gem::Specification for Rutaci-0.1.0
3
+ # Originally generated by Echoe
4
+
5
+ --- !ruby/object:Gem::Specification
6
+ name: rutaci
7
+ version: !ruby/object:Gem::Version
8
+ version: 0.1.0
9
+ platform: ruby
10
+ authors:
11
+ - "Jonas B\xC3\xA4hr"
12
+ autorequire:
13
+ bindir: bin
14
+
15
+ date: 2008-09-24 00:00:00 +02:00
16
+ default_executable:
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: rtaglib
20
+ type: :runtime
21
+ version_requirement:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">"
25
+ - !ruby/object:Gem::Version
26
+ version: "0"
27
+ - - "="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.1.2
30
+ version:
31
+ - !ruby/object:Gem::Dependency
32
+ name: echoe
33
+ type: :development
34
+ version_requirement:
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: "0"
40
+ version:
41
+ description: A command line tool for manupulating the metadata of music files
42
+ email: jonas@fs.ei.tum.de
43
+ executables:
44
+ - rutaci
45
+ extensions: []
46
+
47
+ extra_rdoc_files:
48
+ - LICENSE
49
+ - README
50
+ - TODO
51
+ - bin/rutaci
52
+ - lib/rutaci.rb
53
+ - lib/rutaci/application.rb
54
+ - lib/rutaci/filename_source.rb
55
+ - lib/rutaci/formater.rb
56
+ - lib/rutaci/getter.rb
57
+ - lib/rutaci/interaction.rb
58
+ - lib/rutaci/renamer.rb
59
+ - lib/rutaci/setter.rb
60
+ - lib/rutaci/source.rb
61
+ - lib/rutaci/taglib_source.rb
62
+ files:
63
+ - LICENSE
64
+ - Manifest
65
+ - README
66
+ - Rakefile
67
+ - TODO
68
+ - rutaci.gemspec
69
+ - bin/rutaci
70
+ - lib/rutaci.rb
71
+ - lib/rutaci/application.rb
72
+ - lib/rutaci/filename_source.rb
73
+ - lib/rutaci/formater.rb
74
+ - lib/rutaci/getter.rb
75
+ - lib/rutaci/interaction.rb
76
+ - lib/rutaci/renamer.rb
77
+ - lib/rutaci/setter.rb
78
+ - lib/rutaci/source.rb
79
+ - lib/rutaci/taglib_source.rb
80
+ - templates/rubyfile.rb
81
+ has_rdoc: true
82
+ homepage: http://rutaci.rubyforge.org
83
+ post_install_message:
84
+ rdoc_options:
85
+ - --line-numbers
86
+ - --inline-source
87
+ - --title
88
+ - Rutaci
89
+ - --main
90
+ - README
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
98
+ version:
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "="
102
+ - !ruby/object:Gem::Version
103
+ version: "1.2"
104
+ version:
105
+ requirements: []
106
+
107
+ rubyforge_project: rutaci
108
+ rubygems_version: 1.2.0
109
+ specification_version: 2
110
+ summary: A command line tool for manupulating the metadata of music files
111
+ test_files: []
@@ -0,0 +1,20 @@
1
+ # rutaci is a ruby tagger with a command line interface
2
+ # Copyright (C) 2008 Jonas Bähr <jonas.baehr@fs.ei.tum.de>
3
+ #
4
+ # This program is free software; you can redistribute it and/or
5
+ # modify it under the terms of the GNU General Public License
6
+ # as published by the Free Software Foundation; either version 2
7
+ # of the License, or (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
+
18
+ module Rutaci
19
+
20
+ end # module Rutaci
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rutaci
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - "Jonas B\xC3\xA4hr"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-09-24 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rtaglib
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ - - "="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.2
27
+ version:
28
+ - !ruby/object:Gem::Dependency
29
+ name: echoe
30
+ type: :development
31
+ version_requirement:
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: "0"
37
+ version:
38
+ description: A command line tool for manupulating the metadata of music files
39
+ email: jonas@fs.ei.tum.de
40
+ executables:
41
+ - rutaci
42
+ extensions: []
43
+
44
+ extra_rdoc_files:
45
+ - LICENSE
46
+ - README
47
+ - TODO
48
+ - bin/rutaci
49
+ - lib/rutaci.rb
50
+ - lib/rutaci/application.rb
51
+ - lib/rutaci/filename_source.rb
52
+ - lib/rutaci/formater.rb
53
+ - lib/rutaci/getter.rb
54
+ - lib/rutaci/interaction.rb
55
+ - lib/rutaci/renamer.rb
56
+ - lib/rutaci/setter.rb
57
+ - lib/rutaci/source.rb
58
+ - lib/rutaci/taglib_source.rb
59
+ files:
60
+ - LICENSE
61
+ - Manifest
62
+ - README
63
+ - Rakefile
64
+ - TODO
65
+ - rutaci.gemspec
66
+ - bin/rutaci
67
+ - lib/rutaci.rb
68
+ - lib/rutaci/application.rb
69
+ - lib/rutaci/filename_source.rb
70
+ - lib/rutaci/formater.rb
71
+ - lib/rutaci/getter.rb
72
+ - lib/rutaci/interaction.rb
73
+ - lib/rutaci/renamer.rb
74
+ - lib/rutaci/setter.rb
75
+ - lib/rutaci/source.rb
76
+ - lib/rutaci/taglib_source.rb
77
+ - templates/rubyfile.rb
78
+ has_rdoc: true
79
+ homepage: http://rutaci.rubyforge.org
80
+ post_install_message:
81
+ rdoc_options:
82
+ - --line-numbers
83
+ - --inline-source
84
+ - --title
85
+ - Rutaci
86
+ - --main
87
+ - README
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: "0"
95
+ version:
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - "="
99
+ - !ruby/object:Gem::Version
100
+ version: "1.2"
101
+ version:
102
+ requirements: []
103
+
104
+ rubyforge_project: rutaci
105
+ rubygems_version: 1.2.0
106
+ signing_key:
107
+ specification_version: 2
108
+ summary: A command line tool for manupulating the metadata of music files
109
+ test_files: []
110
+