imp3 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,10 +2,15 @@
2
2
 
3
3
  iMp3 is an application for batch processing and fixing common issues when dealing with a large iTunes library
4
4
 
5
+ == LIMITATIONS
6
+
7
+ Due an Snow Leopard bug, this application will fail to process more than 65536 (2^16) song at once.
8
+ In order to avoid this limitation, you can select the desired tracks to process in iTunes and then call iMp3 with _--selection_ switch
9
+
5
10
  == REQUIREMENTS
6
11
 
7
- * Mac OS X 10.6
8
- * iTunes 9
12
+ * Mac OS X
13
+ * iTunes
9
14
 
10
15
  == INSTALL
11
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
data/bin/imp3 CHANGED
@@ -16,6 +16,23 @@ default_command :help
16
16
 
17
17
  global_option('-s', '--selection', "Apply only to current iTunes selection") { IMP3::CLI.instance.source_origin = :selection }
18
18
 
19
+ command "albums compilations" do |c|
20
+ c.syntax = 'albums compilations [options]'
21
+ c.description = 'Finds compilations and tags tracks not tagged as it'
22
+ c.when_called do |args, options|
23
+ IMP3::CLI.instance.albums_compilations_command(options)
24
+ end
25
+ end
26
+
27
+ command "albums fetch-artwork" do |c|
28
+ c.syntax = 'albums fetch-artwork [options]'
29
+ c.description = 'Fetch last.fm album artwork'
30
+ c.option '--flush-cache', 'Re-create last.fm album artwork cache'
31
+ c.when_called do |args, options|
32
+ IMP3::CLI.instance.albums_fetch_artwork_command(options)
33
+ end
34
+ end
35
+
19
36
  command "genres list" do |c|
20
37
  c.syntax = 'genres list'
21
38
  c.description = 'Lists all genres tagged in iTunes'
@@ -1,5 +1,5 @@
1
1
  module IMP3
2
- VERSION = "0.1.4".freeze
2
+ VERSION = "0.1.5".freeze
3
3
  APP_DIR = File.expand_path(File.join("~", ".imp3"))
4
4
  require "imp3/cli"
5
5
  end
@@ -34,15 +34,28 @@ class IMP3::CLI
34
34
  end
35
35
 
36
36
  def tracks
37
+ return @tracks if @tracks
38
+
37
39
  case source_origin
38
40
  when :library
39
- @library ||= itunes.sources.find {|s| s.kind == OSA::ITunes::ESRC::LIBRARY }.playlists[0] rescue raise "Unable to contact iTunes, please make sure it is open."
40
- @library.tracks
41
+ @source = itunes.sources.find {|s| s.kind == OSA::ITunes::ESRC::LIBRARY }.playlists[0].tracks
41
42
  when :selection
42
- itunes.selection
43
+ @source = itunes.selection
43
44
  else
44
45
  raise "Invalid source origin: #{source_origin}"
45
46
  end
47
+
48
+ @tracks = []
49
+ begin
50
+ progress_bar @source do |track, bar|
51
+ bar.refresh :title => "Scanning track #{track.object_id}"
52
+ @tracks << track
53
+ bar.increment
54
+ end
55
+ rescue
56
+ raise "Unable to retrieve tracks, please make sure iTunes is open."
57
+ end
58
+ @tracks
46
59
  end
47
60
 
48
61
  def artists
@@ -1,8 +1,10 @@
1
1
  module IMP3::Commands
2
2
  require "imp3/commands/genres"
3
3
  require "imp3/commands/artists"
4
+ require "imp3/commands/albums"
4
5
 
5
6
  include IMP3::Commands::Artists
6
7
  include IMP3::Commands::Genres
8
+ include IMP3::Commands::Albums
7
9
  end
8
10
 
@@ -27,9 +27,14 @@ module IMP3::Commands::Artists
27
27
 
28
28
  unless track.artist.eql?(artist_names[normalized_artist_name])
29
29
  tagged += 1
30
- puts "Tagging track #{track.persistent_id} with artist name '#{artist_names[normalized_artist_name]}'"
31
- track.artist = ""
32
- track.artist = artist_names[normalized_artist_name]
30
+ puts "Tagging track #{track.object_id} with artist name '#{artist_names[normalized_artist_name]}'"
31
+ begin
32
+ track.artist = artist_names[normalized_artist_name]
33
+ rescue => e
34
+ errors += 1
35
+ puts "Error: #{e}"
36
+ end
37
+
33
38
  end
34
39
  end
35
40
 
@@ -28,12 +28,16 @@ module IMP3::Commands::Genres
28
28
  genre = (cache.artist_genres[normalized_artist_name] - config.ignore_genres).first
29
29
 
30
30
  if track.genre.eql?(genre)
31
- bar.refresh(:title => "Skipping track #{track.persistent_id}. Genre is already '#{genre}'")
31
+ bar.refresh(:title => "Skipping track #{track.object_id}. Genre is already '#{genre}'")
32
32
  else
33
- bar.refresh(:title => "Tagging track #{track.persistent_id} with genre '#{genre}'")
33
+ bar.refresh(:title => "Tagging track #{track.object_id} with genre '#{genre}'")
34
34
  tagged += 1
35
- track.genre = ""
36
- track.genre = genre
35
+ begin
36
+ track.genre = genre
37
+ rescue => e
38
+ errors += 1
39
+ bar.refresh(:title => "Error: #{e}")
40
+ end
37
41
  end
38
42
  end
39
43
 
@@ -18,7 +18,7 @@ class IMP3::Config
18
18
  end
19
19
 
20
20
  def ignore_genres
21
- @data[:ignore_genres] ||= {}
21
+ @data[:ignore_genres] ||= []
22
22
  @data[:ignore_genres]
23
23
  end
24
24
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imp3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 5
9
+ version: 0.1.5
5
10
  platform: ruby
6
11
  authors:
7
12
  - "V\xC3\xADctor Mart\xC3\xADnez"
@@ -9,59 +14,79 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-03-14 00:00:00 +01:00
17
+ date: 2010-03-21 00:00:00 +01:00
13
18
  default_executable: imp3
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: commander
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ~>
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 4
29
+ - 0
30
+ - 2
23
31
  version: 4.0.2
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: terminal-table
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ~>
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 4
44
+ - 2
33
45
  version: 1.4.2
34
- version:
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
49
  name: nokogiri
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - ~>
42
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 1
57
+ - 4
58
+ - 1
43
59
  version: 1.4.1
44
- version:
60
+ type: :runtime
61
+ version_requirements: *id003
45
62
  - !ruby/object:Gem::Dependency
46
63
  name: pbosetti-rubyosa
47
- type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
50
66
  requirements:
51
67
  - - ~>
52
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
71
+ - 5
72
+ - 3
53
73
  version: 0.5.3
54
- version:
74
+ type: :runtime
75
+ version_requirements: *id004
55
76
  - !ruby/object:Gem::Dependency
56
77
  name: friendly_id
57
- type: :runtime
58
- version_requirement:
59
- version_requirements: !ruby/object:Gem::Requirement
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
60
80
  requirements:
61
81
  - - ~>
62
82
  - !ruby/object:Gem::Version
83
+ segments:
84
+ - 2
85
+ - 3
86
+ - 3
63
87
  version: 2.3.3
64
- version:
88
+ type: :runtime
89
+ version_requirements: *id005
65
90
  description: An application for batch processing and fixing common issues when dealing with a large iTunes library
66
91
  email: knoopx@gmail.com
67
92
  executables:
@@ -101,18 +126,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
126
  requirements:
102
127
  - - ">="
103
128
  - !ruby/object:Gem::Version
129
+ segments:
130
+ - 0
104
131
  version: "0"
105
- version:
106
132
  required_rubygems_version: !ruby/object:Gem::Requirement
107
133
  requirements:
108
134
  - - ">="
109
135
  - !ruby/object:Gem::Version
136
+ segments:
137
+ - 0
110
138
  version: "0"
111
- version:
112
139
  requirements: []
113
140
 
114
141
  rubyforge_project:
115
- rubygems_version: 1.3.5
142
+ rubygems_version: 1.3.6
116
143
  signing_key:
117
144
  specification_version: 3
118
145
  summary: Application for batch processing and fixing common issues when dealing with a large iTunes library