sweeper 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +2 -0
- data/LICENSE +184 -0
- data/Manifest +26 -0
- data/README +40 -0
- data/bin/sweeper +40 -0
- data/ext/Makefile +1 -0
- data/ext/extconf.rb +6 -0
- data/lib/sweeper.rb +129 -0
- data/sweeper.gemspec +49 -0
- data/test/integration/sweeper_test.rb +53 -0
- data/vendor/lastfm.fpclient.beta2.OSX-intel/lastfmfpclient +0 -0
- data/vendor/lastfm.fpclient.beta2.OSX-intel/libcurl.dylib +0 -0
- data/vendor/lastfm.fpclient.beta2.OSX-intel/libmad.dylib +0 -0
- data/vendor/lastfm.fpclient.beta2.OSX-intel/libsamplerate.dylib +0 -0
- data/vendor/lastfm.fpclient.beta2.OSX-intel/libtag.dylib +0 -0
- data/vendor/lastfm.fpclient.beta2.OSX-intel/readme.txt +5 -0
- data/vendor/lastfm.fpclient.beta2.linux-32/lastfmfpclient +0 -0
- data/vendor/lastfm.fpclient.beta2.linux-32/readme.txt +13 -0
- data/vendor/lastfm.fpclient.beta2.win32/Microsoft.VC80.CRT.manifest +8 -0
- data/vendor/lastfm.fpclient.beta2.win32/lastfmfpclient.exe +0 -0
- data/vendor/lastfm.fpclient.beta2.win32/libcurl.dll +0 -0
- data/vendor/lastfm.fpclient.beta2.win32/libfftw3f-3.dll +0 -0
- data/vendor/lastfm.fpclient.beta2.win32/msvcm80.dll +0 -0
- data/vendor/lastfm.fpclient.beta2.win32/msvcp80.dll +0 -0
- data/vendor/lastfm.fpclient.beta2.win32/msvcr80.dll +0 -0
- data/vendor/lastfm.fpclient.beta2.win32/taglib.dll +0 -0
- data/vendor/lastfm.fpclient.beta2.win32/zlib1.dll +0 -0
- metadata +135 -0
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
Binary file
|
data/CHANGELOG
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
Academic Free License (AFL) v. 3.0
|
2
|
+
|
3
|
+
This Academic Free License (the "License") applies to any original work
|
4
|
+
of authorship (the "Original Work") whose owner (the "Licensor") has
|
5
|
+
placed the following licensing notice adjacent to the copyright notice
|
6
|
+
for the Original Work:
|
7
|
+
|
8
|
+
Licensed under the Academic Free License version 3.0
|
9
|
+
|
10
|
+
1) Grant of Copyright License. Licensor grants You a worldwide,
|
11
|
+
royalty-free, non-exclusive, sublicensable license, for the duration of
|
12
|
+
the copyright, to do the following:
|
13
|
+
|
14
|
+
a) to reproduce the Original Work in copies, either alone or as part of
|
15
|
+
a collective work;
|
16
|
+
|
17
|
+
b) to translate, adapt, alter, transform, modify, or arrange the
|
18
|
+
Original Work, thereby creating derivative works ("Derivative Works")
|
19
|
+
based upon the Original Work;
|
20
|
+
|
21
|
+
c) to distribute or communicate copies of the Original Work and
|
22
|
+
Derivative Works to the public, under any license of your choice that
|
23
|
+
does not contradict the terms and conditions, including Licensor's
|
24
|
+
reserved rights and remedies, in this Academic Free License;
|
25
|
+
|
26
|
+
d) to perform the Original Work publicly; and
|
27
|
+
|
28
|
+
e) to display the Original Work publicly.
|
29
|
+
|
30
|
+
2) Grant of Patent License. Licensor grants You a worldwide,
|
31
|
+
royalty-free, non-exclusive, sublicensable license, under patent claims
|
32
|
+
owned or controlled by the Licensor that are embodied in the Original
|
33
|
+
Work as furnished by the Licensor, for the duration of the patents, to
|
34
|
+
make, use, sell, offer for sale, have made, and import the Original Work
|
35
|
+
and Derivative Works.
|
36
|
+
|
37
|
+
3) Grant of Source Code License. The term "Source Code" means the
|
38
|
+
preferred form of the Original Work for making modifications to it and
|
39
|
+
all available documentation describing how to modify the Original Work.
|
40
|
+
Licensor agrees to provide a machine-readable copy of the Source Code of
|
41
|
+
the Original Work along with each copy of the Original Work that
|
42
|
+
Licensor distributes. Licensor reserves the right to satisfy this
|
43
|
+
obligation by placing a machine-readable copy of the Source Code in an
|
44
|
+
information repository reasonably calculated to permit inexpensive and
|
45
|
+
convenient access by You for as long as Licensor continues to distribute
|
46
|
+
the Original Work.
|
47
|
+
|
48
|
+
4) Exclusions From License Grant. Neither the names of Licensor, nor the
|
49
|
+
names of any contributors to the Original Work, nor any of their
|
50
|
+
trademarks or service marks, may be used to endorse or promote products
|
51
|
+
derived from this Original Work without express prior permission of the
|
52
|
+
Licensor. Except as expressly stated herein, nothing in this License
|
53
|
+
grants any license to Licensor's trademarks, copyrights, patents, trade
|
54
|
+
secrets or any other intellectual property. No patent license is granted
|
55
|
+
to make, use, sell, offer for sale, have made, or import embodiments of
|
56
|
+
any patent claims other than the licensed claims defined in Section 2.
|
57
|
+
No license is granted to the trademarks of Licensor even if such marks
|
58
|
+
are included in the Original Work. Nothing in this License shall be
|
59
|
+
interpreted to prohibit Licensor from licensing under terms different
|
60
|
+
from this License any Original Work that Licensor otherwise would have a
|
61
|
+
right to license.
|
62
|
+
|
63
|
+
5) External Deployment. The term "External Deployment" means the use,
|
64
|
+
distribution, or communication of the Original Work or Derivative Works
|
65
|
+
in any way such that the Original Work or Derivative Works may be used
|
66
|
+
by anyone other than You, whether those works are distributed or
|
67
|
+
communicated to those persons or made available as an application
|
68
|
+
intended for use over a network. As an express condition for the grants
|
69
|
+
of license hereunder, You must treat any External Deployment by You of
|
70
|
+
the Original Work or a Derivative Work as a distribution under section
|
71
|
+
1(c).
|
72
|
+
|
73
|
+
6) Attribution Rights. You must retain, in the Source Code of any
|
74
|
+
Derivative Works that You create, all copyright, patent, or trademark
|
75
|
+
notices from the Source Code of the Original Work, as well as any
|
76
|
+
notices of licensing and any descriptive text identified therein as an
|
77
|
+
"Attribution Notice." You must cause the Source Code for any Derivative
|
78
|
+
Works that You create to carry a prominent Attribution Notice reasonably
|
79
|
+
calculated to inform recipients that You have modified the Original
|
80
|
+
Work.
|
81
|
+
|
82
|
+
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants
|
83
|
+
that the copyright in and to the Original Work and the patent rights
|
84
|
+
granted herein by Licensor are owned by the Licensor or are sublicensed
|
85
|
+
to You under the terms of this License with the permission of the
|
86
|
+
contributor(s) of those copyrights and patent rights. Except as
|
87
|
+
expressly stated in the immediately preceding sentence, the Original
|
88
|
+
Work is provided under this License on an "AS IS" BASIS and WITHOUT
|
89
|
+
WARRANTY, either express or implied, including, without limitation, the
|
90
|
+
warranties of non-infringement, merchantability or fitness for a
|
91
|
+
particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL
|
92
|
+
WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential
|
93
|
+
part of this License. No license to the Original Work is granted by this
|
94
|
+
License except under this disclaimer.
|
95
|
+
|
96
|
+
8) Limitation of Liability. Under no circumstances and under no legal
|
97
|
+
theory, whether in tort (including negligence), contract, or otherwise,
|
98
|
+
shall the Licensor be liable to anyone for any indirect, special,
|
99
|
+
incidental, or consequential damages of any character arising as a
|
100
|
+
result of this License or the use of the Original Work including,
|
101
|
+
without limitation, damages for loss of goodwill, work stoppage,
|
102
|
+
computer failure or malfunction, or any and all other commercial damages
|
103
|
+
or losses. This limitation of liability shall not apply to the extent
|
104
|
+
applicable law prohibits such limitation.
|
105
|
+
|
106
|
+
9) Acceptance and Termination. If, at any time, You expressly assented
|
107
|
+
to this License, that assent indicates your clear and irrevocable
|
108
|
+
acceptance of this License and all of its terms and conditions. If You
|
109
|
+
distribute or communicate copies of the Original Work or a Derivative
|
110
|
+
Work, You must make a reasonable effort under the circumstances to
|
111
|
+
obtain the express assent of recipients to the terms of this License.
|
112
|
+
This License conditions your rights to undertake the activities listed
|
113
|
+
in Section 1, including your right to create Derivative Works based upon
|
114
|
+
the Original Work, and doing so without honoring these terms and
|
115
|
+
conditions is prohibited by copyright law and international treaty.
|
116
|
+
Nothing in this License is intended to affect copyright exceptions and
|
117
|
+
limitations (including "fair use" or "fair dealing"). This License shall
|
118
|
+
terminate immediately and You may no longer exercise any of the rights
|
119
|
+
granted to You by this License upon your failure to honor the conditions
|
120
|
+
in Section 1(c).
|
121
|
+
|
122
|
+
10) Termination for Patent Action. This License shall terminate
|
123
|
+
automatically and You may no longer exercise any of the rights granted
|
124
|
+
to You by this License as of the date You commence an action, including
|
125
|
+
a cross-claim or counterclaim, against Licensor or any licensee alleging
|
126
|
+
that the Original Work infringes a patent. This termination provision
|
127
|
+
shall not apply for an action alleging patent infringement by
|
128
|
+
combinations of the Original Work with other software or hardware.
|
129
|
+
|
130
|
+
11) Jurisdiction, Venue and Governing Law. Any action or suit relating
|
131
|
+
to this License may be brought only in the courts of a jurisdiction
|
132
|
+
wherein the Licensor resides or in which Licensor conducts its primary
|
133
|
+
business, and under the laws of that jurisdiction excluding its
|
134
|
+
conflict-of-law provisions. The application of the United Nations
|
135
|
+
Convention on Contracts for the International Sale of Goods is expressly
|
136
|
+
excluded. Any use of the Original Work outside the scope of this License
|
137
|
+
or after its termination shall be subject to the requirements and
|
138
|
+
penalties of copyright or patent law in the appropriate jurisdiction.
|
139
|
+
This section shall survive the termination of this License.
|
140
|
+
|
141
|
+
12) Attorneys' Fees. In any action to enforce the terms of this License
|
142
|
+
or seeking damages relating thereto, the prevailing party shall be
|
143
|
+
entitled to recover its costs and expenses, including, without
|
144
|
+
limitation, reasonable attorneys' fees and costs incurred in connection
|
145
|
+
with such action, including any appeal of such action. This section
|
146
|
+
shall survive the termination of this License.
|
147
|
+
|
148
|
+
13) Miscellaneous. If any provision of this License is held to be
|
149
|
+
unenforceable, such provision shall be reformed only to the extent
|
150
|
+
necessary to make it enforceable.
|
151
|
+
|
152
|
+
14) Definition of "You" in This License. "You" throughout this License,
|
153
|
+
whether in upper or lower case, means an individual or a legal entity
|
154
|
+
exercising rights under, and complying with all of the terms of, this
|
155
|
+
License. For legal entities, "You" includes any entity that controls, is
|
156
|
+
controlled by, or is under common control with you. For purposes of this
|
157
|
+
definition, "control" means (i) the power, direct or indirect, to cause
|
158
|
+
the direction or management of such entity, whether by contract or
|
159
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
160
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
161
|
+
|
162
|
+
15) Right to Use. You may use the Original Work in all ways not
|
163
|
+
otherwise restricted or conditioned by this License or by law, and
|
164
|
+
Licensor promises not to interfere with or be responsible for such uses
|
165
|
+
by You.
|
166
|
+
|
167
|
+
16) Modification of This License. This License is Copyright (c) 2005
|
168
|
+
Lawrence Rosen. Permission is granted to copy, distribute, or
|
169
|
+
communicate this License without modification. Nothing in this License
|
170
|
+
permits You to modify this License as applied to the Original Work or to
|
171
|
+
Derivative Works. However, You may modify the text of this License and
|
172
|
+
copy, distribute or communicate your modified version (the "Modified
|
173
|
+
License") and apply it to other original works of authorship subject to
|
174
|
+
the following conditions: (i) You may not indicate in any way that your
|
175
|
+
Modified License is the "Academic Free License" or "AFL" and you may not
|
176
|
+
use those names in the name of your Modified License; (ii) You must
|
177
|
+
replace the notice specified in the first paragraph above with the
|
178
|
+
notice "Licensed under <insert your license name here>" or with a notice
|
179
|
+
of your own that is not confusingly similar to the notice in this
|
180
|
+
License; and (iii) You may not claim that your original works are open
|
181
|
+
source software unless your Modified License has been approved by Open
|
182
|
+
Source Initiative (OSI) and You comply with its license review and
|
183
|
+
certification process.
|
184
|
+
|
data/Manifest
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
bin/sweeper
|
2
|
+
CHANGELOG
|
3
|
+
ext/extconf.rb
|
4
|
+
ext/Makefile
|
5
|
+
lib/sweeper.rb
|
6
|
+
LICENSE
|
7
|
+
Manifest
|
8
|
+
README
|
9
|
+
test/integration/sweeper_test.rb
|
10
|
+
vendor/lastfm.fpclient.beta2.linux-32/lastfmfpclient
|
11
|
+
vendor/lastfm.fpclient.beta2.linux-32/readme.txt
|
12
|
+
vendor/lastfm.fpclient.beta2.OSX-intel/lastfmfpclient
|
13
|
+
vendor/lastfm.fpclient.beta2.OSX-intel/libcurl.dylib
|
14
|
+
vendor/lastfm.fpclient.beta2.OSX-intel/libmad.dylib
|
15
|
+
vendor/lastfm.fpclient.beta2.OSX-intel/libsamplerate.dylib
|
16
|
+
vendor/lastfm.fpclient.beta2.OSX-intel/libtag.dylib
|
17
|
+
vendor/lastfm.fpclient.beta2.OSX-intel/readme.txt
|
18
|
+
vendor/lastfm.fpclient.beta2.win32/lastfmfpclient.exe
|
19
|
+
vendor/lastfm.fpclient.beta2.win32/libcurl.dll
|
20
|
+
vendor/lastfm.fpclient.beta2.win32/libfftw3f-3.dll
|
21
|
+
vendor/lastfm.fpclient.beta2.win32/Microsoft.VC80.CRT.manifest
|
22
|
+
vendor/lastfm.fpclient.beta2.win32/msvcm80.dll
|
23
|
+
vendor/lastfm.fpclient.beta2.win32/msvcp80.dll
|
24
|
+
vendor/lastfm.fpclient.beta2.win32/msvcr80.dll
|
25
|
+
vendor/lastfm.fpclient.beta2.win32/taglib.dll
|
26
|
+
vendor/lastfm.fpclient.beta2.win32/zlib1.dll
|
data/README
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
Automatically tag your music collection with metadata from Last.fm.
|
3
|
+
|
4
|
+
== License
|
5
|
+
|
6
|
+
Copyright 2008 Cloudburst, LLC. Licensed under the AFL 3. See the included LICENSE file. Unlinked portions copyright 2008 Last.fm Ltd., used by permission, and licensed under the GPL2.
|
7
|
+
|
8
|
+
The public certificate for the gem is here[http://rubyforge.org/frs/download.php/25331/evan_weaver-original-public_cert.pem].
|
9
|
+
|
10
|
+
If you use this software, please {make a donation}[http://blog.evanweaver.com/donate/], or {recommend Evan}[http://www.workingwithrails.com/person/7739-evan-weaver] at Working with Rails.
|
11
|
+
|
12
|
+
== Features
|
13
|
+
|
14
|
+
* options
|
15
|
+
* stuff
|
16
|
+
|
17
|
+
== Usage
|
18
|
+
|
19
|
+
First, install the gem:
|
20
|
+
sudo gem install sweeper
|
21
|
+
|
22
|
+
Now, change to the directory of mp3s you want to tag and run:
|
23
|
+
sweeper
|
24
|
+
|
25
|
+
That's all.
|
26
|
+
|
27
|
+
== Options
|
28
|
+
|
29
|
+
Sweeper takes a few command line options:
|
30
|
+
|
31
|
+
-d, --dir Directory to search (defaults to current).
|
32
|
+
-r, --recursive Recurse directories.
|
33
|
+
--dry-run Do a dry run (no files will be changed).
|
34
|
+
-f, --force Overwrite existing tags.
|
35
|
+
|
36
|
+
== Reporting problems
|
37
|
+
|
38
|
+
The support forum is here[http://rubyforge.org/forum/forum.php?forum_id=23599].
|
39
|
+
|
40
|
+
Patches and contributions are very welcome. Please note that contributors are required to assign copyright for their additions to Cloudburst, LLC.
|
data/bin/sweeper
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'choice'
|
5
|
+
require "#{File.dirname(__FILE__)}/../lib/sweeper"
|
6
|
+
|
7
|
+
PROGRAM_VERSION = 0.1
|
8
|
+
|
9
|
+
Choice.options do
|
10
|
+
option :dir do
|
11
|
+
short '-d'
|
12
|
+
long '--dir'
|
13
|
+
desc 'Directory to search (defaults to current).'
|
14
|
+
end
|
15
|
+
|
16
|
+
option :recursive do
|
17
|
+
short '-r'
|
18
|
+
long '--recursive'
|
19
|
+
desc 'Recurse directories.'
|
20
|
+
end
|
21
|
+
|
22
|
+
option :dry do
|
23
|
+
long '--dry-run'
|
24
|
+
desc 'Do a dry run (no files will be changed).'
|
25
|
+
end
|
26
|
+
|
27
|
+
option :force do
|
28
|
+
short '-f'
|
29
|
+
long '--force'
|
30
|
+
desc 'Overwrite existing tags.'
|
31
|
+
end
|
32
|
+
|
33
|
+
# option :genre do
|
34
|
+
# short '-g'
|
35
|
+
# long '--genre'
|
36
|
+
# desc 'Add genre tags from Last.fm.'
|
37
|
+
# end
|
38
|
+
end
|
39
|
+
|
40
|
+
Sweeper.new(Choice.choices).run
|
data/ext/Makefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
install: install
|
data/ext/extconf.rb
ADDED
data/lib/sweeper.rb
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
|
2
|
+
require 'rubygems'
|
3
|
+
require 'id3lib'
|
4
|
+
require 'xsd/mapping'
|
5
|
+
require 'activesupport'
|
6
|
+
|
7
|
+
class ID3Lib::Tag
|
8
|
+
alias :url :comment
|
9
|
+
alias :url= :comment=
|
10
|
+
end
|
11
|
+
|
12
|
+
class Sweeper
|
13
|
+
|
14
|
+
class Problem < RuntimeError; end
|
15
|
+
|
16
|
+
KEYS = ['artist', 'title', 'url']
|
17
|
+
|
18
|
+
attr_reader :options
|
19
|
+
|
20
|
+
def initialize(options = {})
|
21
|
+
@dir = File.expand_path(options['dir'] || Dir.pwd)
|
22
|
+
@options = options
|
23
|
+
end
|
24
|
+
|
25
|
+
def run
|
26
|
+
@processed = 0
|
27
|
+
recurse(@dir)
|
28
|
+
if @processed == 0
|
29
|
+
puts "No files found."
|
30
|
+
exec "#{$0} --help"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
#private
|
35
|
+
|
36
|
+
def recurse(dir)
|
37
|
+
Dir["#{dir}/*"].each do |filename|
|
38
|
+
if File.directory? filename and options['recursive']
|
39
|
+
recurse(filename)
|
40
|
+
elsif File.extname(filename) == ".mp3"
|
41
|
+
@processed += 1
|
42
|
+
tries = 0
|
43
|
+
begin
|
44
|
+
current = read(filename)
|
45
|
+
|
46
|
+
if options['force']
|
47
|
+
write(filename, lookup(filename))
|
48
|
+
elsif current.keys.size < KEYS.size
|
49
|
+
write(filename, lookup(filename).except(*current.keys))
|
50
|
+
end
|
51
|
+
rescue Problem => e
|
52
|
+
tries += 1 and retry if tries < 2
|
53
|
+
puts "Skipped #{filename}: #{e.message}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def read(filename)
|
60
|
+
tags = {}
|
61
|
+
song = ID3Lib::Tag.new(filename)
|
62
|
+
|
63
|
+
KEYS.each do |key|
|
64
|
+
tags[key] = song.send(key) if !song.send(key).blank?
|
65
|
+
end
|
66
|
+
tags
|
67
|
+
end
|
68
|
+
|
69
|
+
def lookup(filename)
|
70
|
+
Dir.chdir File.dirname(binary) do
|
71
|
+
response = silence { `./#{File.basename(binary)} #{filename}` }
|
72
|
+
object = begin
|
73
|
+
XSD::Mapping.xml2obj(response)
|
74
|
+
rescue REXML::ParseException
|
75
|
+
raise Problem, "Invalid response."
|
76
|
+
end
|
77
|
+
raise Problem, "Not found." unless object
|
78
|
+
|
79
|
+
tags = {}
|
80
|
+
song = Array(object.track).first
|
81
|
+
|
82
|
+
KEYS.each do |key|
|
83
|
+
tags[key] = song.send(key) if song.respond_to? key
|
84
|
+
end
|
85
|
+
tags
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def write(filename, tags)
|
90
|
+
return if tags.empty?
|
91
|
+
puts filename
|
92
|
+
|
93
|
+
file = ID3Lib::Tag.new(filename)
|
94
|
+
tags.each do |key, value|
|
95
|
+
file.send("#{key}=", value)
|
96
|
+
puts " #{value}"
|
97
|
+
end
|
98
|
+
file.update! unless options['dry']
|
99
|
+
end
|
100
|
+
|
101
|
+
def binary
|
102
|
+
@binary ||= "#{File.dirname(__FILE__)}/../vendor/" +
|
103
|
+
case RUBY_PLATFORM
|
104
|
+
when /darwin/
|
105
|
+
"lastfm.fpclient.beta2.OSX-intel/lastfmfpclient"
|
106
|
+
when /win32/
|
107
|
+
"lastfm.fpclient.beta2.win32/lastfmfpclient.exe"
|
108
|
+
else
|
109
|
+
"lastfm.fpclient.beta2.linux-32/lastfmfpclient"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def silence(outf = nil, errf = nil)
|
114
|
+
# This method is annoying.
|
115
|
+
outf, errf = Tempfile.new("stdout"), Tempfile.new("stderr")
|
116
|
+
out, err = $stdout.clone, $stderr.clone
|
117
|
+
$stdout.reopen(outf)
|
118
|
+
$stderr.reopen(errf)
|
119
|
+
begin
|
120
|
+
yield
|
121
|
+
ensure
|
122
|
+
$stdout.reopen(out)
|
123
|
+
$stderr.reopen(err)
|
124
|
+
outf.close; outf.unlink
|
125
|
+
errf.close; errf.unlink
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
data/sweeper.gemspec
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
# Gem::Specification for Sweeper-0.1
|
3
|
+
# Originally generated by Echoe
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = %q{sweeper}
|
7
|
+
s.version = "0.1"
|
8
|
+
|
9
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.authors = ["Evan Weaver"]
|
13
|
+
s.date = %q{2008-04-13}
|
14
|
+
s.default_executable = %q{sweeper}
|
15
|
+
s.description = %q{Automatically tag your music collection with metadata from Last.fm.}
|
16
|
+
s.email = %q{}
|
17
|
+
s.executables = ["sweeper"]
|
18
|
+
s.extensions = ["ext/extconf.rb"]
|
19
|
+
s.extra_rdoc_files = ["CHANGELOG", "lib/sweeper.rb", "LICENSE", "README"]
|
20
|
+
s.files = ["bin/sweeper", "CHANGELOG", "ext/extconf.rb", "ext/Makefile", "lib/sweeper.rb", "LICENSE", "Manifest", "README", "test/integration/sweeper_test.rb", "vendor/lastfm.fpclient.beta2.linux-32/lastfmfpclient", "vendor/lastfm.fpclient.beta2.linux-32/readme.txt", "vendor/lastfm.fpclient.beta2.OSX-intel/lastfmfpclient", "vendor/lastfm.fpclient.beta2.OSX-intel/libcurl.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/libmad.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/libsamplerate.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/libtag.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/readme.txt", "vendor/lastfm.fpclient.beta2.win32/lastfmfpclient.exe", "vendor/lastfm.fpclient.beta2.win32/libcurl.dll", "vendor/lastfm.fpclient.beta2.win32/libfftw3f-3.dll", "vendor/lastfm.fpclient.beta2.win32/Microsoft.VC80.CRT.manifest", "vendor/lastfm.fpclient.beta2.win32/msvcm80.dll", "vendor/lastfm.fpclient.beta2.win32/msvcp80.dll", "vendor/lastfm.fpclient.beta2.win32/msvcr80.dll", "vendor/lastfm.fpclient.beta2.win32/taglib.dll", "vendor/lastfm.fpclient.beta2.win32/zlib1.dll", "sweeper.gemspec"]
|
21
|
+
s.has_rdoc = true
|
22
|
+
s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/sweeper/}
|
23
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Sweeper", "--main", "README"]
|
24
|
+
s.require_paths = ["lib", "ext"]
|
25
|
+
s.rubyforge_project = %q{fauna}
|
26
|
+
s.rubygems_version = %q{1.0.1}
|
27
|
+
s.summary = %q{Automatically tag your music collection with metadata from Last.fm.}
|
28
|
+
s.test_files = ["test/integration/sweeper_test.rb"]
|
29
|
+
|
30
|
+
s.add_dependency(%q<id3lib-ruby>, [">= 0"])
|
31
|
+
s.add_dependency(%q<choice>, [">= 0"])
|
32
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# # Original Rakefile source (requires the Echoe gem):
|
37
|
+
#
|
38
|
+
# require 'echoe'
|
39
|
+
#
|
40
|
+
# Echoe.new("sweeper") do |p|
|
41
|
+
# p.author = "Evan Weaver"
|
42
|
+
# p.project = "fauna"
|
43
|
+
# p.summary = "Automatically tag your music collection with metadata from Last.fm."
|
44
|
+
# p.url = "http://blog.evanweaver.com/files/doc/fauna/sweeper/"
|
45
|
+
# p.docs_host = "blog.evanweaver.com:~/www/bax/public/files/doc/"
|
46
|
+
# p.dependencies = ['id3lib-ruby', 'choice', 'activesupport']
|
47
|
+
# p.clean_pattern = ['doc', 'pkg', 'test/integration/songs']
|
48
|
+
# p.rdoc_pattern = ['README', 'LICENSE', 'CHANGELOG', 'TODO', 'lib/*']
|
49
|
+
# end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require "#{File.dirname(__FILE__)}/../../lib/sweeper"
|
4
|
+
require 'ruby-debug'
|
5
|
+
|
6
|
+
class SweeperTest < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
@orig_dir = "#{File.dirname(__FILE__)}/songs"
|
9
|
+
system("rm -rf /tmp/songs; cp -r #{@orig_dir} /tmp")
|
10
|
+
@dir = "/tmp/songs"
|
11
|
+
@found_many = "#{@dir}/1_001.mp3"
|
12
|
+
@found_one = "#{@dir}/1_010.mp3"
|
13
|
+
@not_found = "#{@dir}/1_003.mp3"
|
14
|
+
@s = Sweeper.new('dir' => @dir)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_lookup
|
18
|
+
assert_equal(
|
19
|
+
{"artist"=>"Photon Band",
|
20
|
+
"title"=>"To Sing For You",
|
21
|
+
"url"=>"http://www.last.fm/music/Photon+Band/_/To+Sing+For+You"},
|
22
|
+
@s.lookup(@found_many))
|
23
|
+
assert_equal(
|
24
|
+
{"artist"=>"Various Artists - Vagabond Productions",
|
25
|
+
"title"=>"Sugar Man - Tom Heyman",
|
26
|
+
"url"=> "http://www.last.fm/music/Various+Artists+-+Vagabond+Productions/_/Sugar+Man+-+Tom+Heyman"},
|
27
|
+
@s.lookup(@found_one))
|
28
|
+
assert_raises(Sweeper::Problem) do
|
29
|
+
@s.lookup(@not_found)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_read
|
34
|
+
assert_equal({},
|
35
|
+
@s.read(@found_many))
|
36
|
+
assert_equal({},
|
37
|
+
@s.read(@not_found))
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_write
|
41
|
+
@s.silence do
|
42
|
+
@s.write(@found_many, @s.lookup(@found_many))
|
43
|
+
end
|
44
|
+
assert_equal(
|
45
|
+
@s.lookup(@found_many),
|
46
|
+
@s.read(@found_many))
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_run
|
50
|
+
@s.run
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
If it does not run, you might need to install the following libs:
|
2
|
+
|
3
|
+
libtag, libmad, libcurl
|
4
|
+
|
5
|
+
here's how to install them:
|
6
|
+
su
|
7
|
+
apt-get install libtag1c2a
|
8
|
+
apt-get install libcurl3
|
9
|
+
apt-get install libmad0
|
10
|
+
|
11
|
+
possibly also
|
12
|
+
apt-get install fftw3
|
13
|
+
apt-get install libsamplerate0
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
2
|
+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
3
|
+
<noInheritable></noInheritable>
|
4
|
+
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
|
5
|
+
<file name="msvcr80.dll" hash="10f4cb2831f1e9288a73387a8734a8b604e5beaa" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>n9On8FItNsK/DmT8UQxu6jYDtWQ=</dsig:DigestValue></asmv2:hash></file>
|
6
|
+
<file name="msvcp80.dll" hash="b2082dfd3009365c5b287448dcb3b4e2158a6d26" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>0KJ/VTwP4OUHx98HlIW2AdW1kuY=</dsig:DigestValue></asmv2:hash></file>
|
7
|
+
<file name="msvcm80.dll" hash="542490d0fcf8615c46d0ca487033ccaeb3941f0b" hashalg="SHA1"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>YJuB+9Os2oxW4mY+2oC/r8lICZE=</dsig:DigestValue></asmv2:hash></file>
|
8
|
+
</assembly>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sweeper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0.1"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Evan Weaver
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDLjCCAhagAwIBAgIBADANBgkqhkiG9w0BAQUFADA9MQ0wCwYDVQQDDARldmFu
|
14
|
+
MRgwFgYKCZImiZPyLGQBGRYIY2xvdWRidXIxEjAQBgoJkiaJk/IsZAEZFgJzdDAe
|
15
|
+
Fw0wNzA5MTYxMDMzMDBaFw0wODA5MTUxMDMzMDBaMD0xDTALBgNVBAMMBGV2YW4x
|
16
|
+
GDAWBgoJkiaJk/IsZAEZFghjbG91ZGJ1cjESMBAGCgmSJomT8ixkARkWAnN0MIIB
|
17
|
+
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5C0Io89nyApnr+PvbNFge9Vs
|
18
|
+
yRWAlGBUEMahpXp28VrrfXZT0rAW7JBo4PlCE3jl4nE4dzE6gAdItSycjTosrw7A
|
19
|
+
Ir5+xoyl4Vb35adv56TIQQXvNz+BzlqnkAY5JN0CSBRTQb6mxS3hFyD/h4qgDosj
|
20
|
+
R2RFVzHqSxCS8xq4Ny8uzOwOi+Xyu4w67fI5JvnPvMxqrlR1eaIQHmxnf76RzC46
|
21
|
+
QO5QhufjAYGGXd960XzbQsQyTDUYJzrvT7AdOfiyZzKQykKt8dEpDn+QPjFTnGnT
|
22
|
+
QmgJBX5WJN0lHF2l1sbv3gh4Kn1tZu+kTUqeXY6ShAoDTyvZRiFqQdwh8w2lTQID
|
23
|
+
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU+WqJz3xQ
|
24
|
+
XSea1hRvvHWcIMgeeC4wDQYJKoZIhvcNAQEFBQADggEBAGLZ75jfOEW8Nsl26CTt
|
25
|
+
JFrWxQTcQT/UljeefVE3xYr7lc9oQjbqO3FOyued3qW7TaNEtZfSHoYeUSMYbpw1
|
26
|
+
XAwocIPuSRFDGM4B+hgQGVDx8PMGiJKom4qLXjO40UZsR7QyN/u869Vj45LURm6h
|
27
|
+
MBcPeqCASI+WNprj9+uZa2kmHiitrFqqfMBNlm5IFbn9XeYSta9AHVvs5QQqV2m5
|
28
|
+
hIPfLqCyxsn/YgOGvo6iwyQTWyTswamaAC3HRWZxIS1sfn/Ssqa7E7oQMkv5FAXr
|
29
|
+
x5rKePfXINf8XTJczkl9OBEYdE9aNdJsJpXD0asLgGVwBICS5Bjohp6mizJcDC1+
|
30
|
+
yZ0=
|
31
|
+
-----END CERTIFICATE-----
|
32
|
+
|
33
|
+
date: 2008-04-13 00:00:00 -04:00
|
34
|
+
default_executable:
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: id3lib-ruby
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: choice
|
47
|
+
version_requirement:
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: activesupport
|
56
|
+
version_requirement:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
description: Automatically tag your music collection with metadata from Last.fm.
|
64
|
+
email: ""
|
65
|
+
executables:
|
66
|
+
- sweeper
|
67
|
+
extensions:
|
68
|
+
- ext/extconf.rb
|
69
|
+
extra_rdoc_files:
|
70
|
+
- CHANGELOG
|
71
|
+
- lib/sweeper.rb
|
72
|
+
- LICENSE
|
73
|
+
- README
|
74
|
+
files:
|
75
|
+
- bin/sweeper
|
76
|
+
- CHANGELOG
|
77
|
+
- ext/extconf.rb
|
78
|
+
- ext/Makefile
|
79
|
+
- lib/sweeper.rb
|
80
|
+
- LICENSE
|
81
|
+
- Manifest
|
82
|
+
- README
|
83
|
+
- test/integration/sweeper_test.rb
|
84
|
+
- vendor/lastfm.fpclient.beta2.linux-32/lastfmfpclient
|
85
|
+
- vendor/lastfm.fpclient.beta2.linux-32/readme.txt
|
86
|
+
- vendor/lastfm.fpclient.beta2.OSX-intel/lastfmfpclient
|
87
|
+
- vendor/lastfm.fpclient.beta2.OSX-intel/libcurl.dylib
|
88
|
+
- vendor/lastfm.fpclient.beta2.OSX-intel/libmad.dylib
|
89
|
+
- vendor/lastfm.fpclient.beta2.OSX-intel/libsamplerate.dylib
|
90
|
+
- vendor/lastfm.fpclient.beta2.OSX-intel/libtag.dylib
|
91
|
+
- vendor/lastfm.fpclient.beta2.OSX-intel/readme.txt
|
92
|
+
- vendor/lastfm.fpclient.beta2.win32/lastfmfpclient.exe
|
93
|
+
- vendor/lastfm.fpclient.beta2.win32/libcurl.dll
|
94
|
+
- vendor/lastfm.fpclient.beta2.win32/libfftw3f-3.dll
|
95
|
+
- vendor/lastfm.fpclient.beta2.win32/Microsoft.VC80.CRT.manifest
|
96
|
+
- vendor/lastfm.fpclient.beta2.win32/msvcm80.dll
|
97
|
+
- vendor/lastfm.fpclient.beta2.win32/msvcp80.dll
|
98
|
+
- vendor/lastfm.fpclient.beta2.win32/msvcr80.dll
|
99
|
+
- vendor/lastfm.fpclient.beta2.win32/taglib.dll
|
100
|
+
- vendor/lastfm.fpclient.beta2.win32/zlib1.dll
|
101
|
+
- sweeper.gemspec
|
102
|
+
has_rdoc: true
|
103
|
+
homepage: http://blog.evanweaver.com/files/doc/fauna/sweeper/
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options:
|
106
|
+
- --line-numbers
|
107
|
+
- --inline-source
|
108
|
+
- --title
|
109
|
+
- Sweeper
|
110
|
+
- --main
|
111
|
+
- README
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
- ext
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: "0"
|
120
|
+
version:
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: "0"
|
126
|
+
version:
|
127
|
+
requirements: []
|
128
|
+
|
129
|
+
rubyforge_project: fauna
|
130
|
+
rubygems_version: 1.0.1
|
131
|
+
signing_key:
|
132
|
+
specification_version: 2
|
133
|
+
summary: Automatically tag your music collection with metadata from Last.fm.
|
134
|
+
test_files:
|
135
|
+
- test/integration/sweeper_test.rb
|
metadata.gz.sig
ADDED
Binary file
|