ipod_db 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/bin/ipod +9 -3
- data/lib/ipod/track.rb +3 -3
- data/lib/ipod_db/version.rb +1 -1
- metadata +2 -8
data/README.md
CHANGED
data/bin/ipod
CHANGED
@@ -87,7 +87,8 @@ Main {
|
|
87
87
|
track numbers to delete from device (ranges like
|
88
88
|
2-5 are accepted too). As a special case, the word
|
89
89
|
'done' means all finished tracks, i.e. with play count
|
90
|
-
above zero or progress above
|
90
|
+
above zero or progress above
|
91
|
+
#{ (100*Ipod::Track::FinishedProgress).floor }%
|
91
92
|
__
|
92
93
|
}
|
93
94
|
option('pretend','n') {
|
@@ -115,7 +116,7 @@ Main {
|
|
115
116
|
|
116
117
|
def ls
|
117
118
|
@ipod_db.each_track_with_index do |track,i|
|
118
|
-
list_track i,
|
119
|
+
list_track i, wrapped_track(track)
|
119
120
|
end
|
120
121
|
end
|
121
122
|
|
@@ -223,13 +224,18 @@ Main {
|
|
223
224
|
end
|
224
225
|
when 'done'
|
225
226
|
@ipod_db.each_track_with_index do |track,n|
|
226
|
-
tracks[n] = track if finished?
|
227
|
+
tracks[n] = track if wrapped_track(track).finished?
|
227
228
|
end
|
228
229
|
end
|
229
230
|
end
|
230
231
|
tracks
|
231
232
|
end
|
232
233
|
|
234
|
+
def wrapped_track record
|
235
|
+
@wrapped_tracks ||= Map.new
|
236
|
+
@wrapped_tracks[record[:filename]] ||= Ipod::Track.new( record.merge(ipod_root: @ipod_root) )
|
237
|
+
end
|
238
|
+
|
233
239
|
def spread paths, group_lambda = lambda {|path| track_group(path)}
|
234
240
|
bins = paths.group_by &group_lambda
|
235
241
|
bins.each do |key, bin|
|
data/lib/ipod/track.rb
CHANGED
@@ -16,7 +16,7 @@ module Ipod
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def finished?
|
19
|
-
playcount > 0 or progress > FinishedProgress
|
19
|
+
(playcount and playcount > 0) or progress > FinishedProgress
|
20
20
|
end
|
21
21
|
|
22
22
|
def progress
|
@@ -28,7 +28,7 @@ module Ipod
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def length
|
31
|
-
|
31
|
+
return @length if @length
|
32
32
|
# if file is writable TagLib opens it read-write and appears to write something when the file
|
33
33
|
# gets closed, or in any case closing a file open read-write is slow on slow media.
|
34
34
|
#
|
@@ -37,7 +37,7 @@ module Ipod
|
|
37
37
|
old_stat = File::Stat.new(absolute_path)
|
38
38
|
begin
|
39
39
|
FileUtils.chmod('a-w', absolute_path)
|
40
|
-
TagLib::FileRef.open(absolute_path){|file| file.audio_properties.length}
|
40
|
+
return @length = TagLib::FileRef.open(absolute_path){|file| file.audio_properties.length}
|
41
41
|
ensure
|
42
42
|
FileUtils.chmod(old_stat.mode, absolute_path)
|
43
43
|
end
|
data/lib/ipod_db/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipod_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bindata
|
@@ -332,18 +332,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
332
332
|
- - ! '>='
|
333
333
|
- !ruby/object:Gem::Version
|
334
334
|
version: '0'
|
335
|
-
segments:
|
336
|
-
- 0
|
337
|
-
hash: 4257127508463692162
|
338
335
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
339
336
|
none: false
|
340
337
|
requirements:
|
341
338
|
- - ! '>='
|
342
339
|
- !ruby/object:Gem::Version
|
343
340
|
version: '0'
|
344
|
-
segments:
|
345
|
-
- 0
|
346
|
-
hash: 4257127508463692162
|
347
341
|
requirements: []
|
348
342
|
rubyforge_project:
|
349
343
|
rubygems_version: 1.8.23
|