summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrename-pix-by-time-and-cam16
1 files changed, 10 insertions, 6 deletions
diff --git a/rename-pix-by-time-and-cam b/rename-pix-by-time-and-cam
index e2c7958..3a6224f 100755
--- a/rename-pix-by-time-and-cam
+++ b/rename-pix-by-time-and-cam
@@ -45,8 +45,9 @@ ids.each do |i|
begin
if timestamp
t = timestamp.split(':',2)[1].strip.gsub(/(:|\ )/, '-')
- elsif timestamp_bak
- t = timestamp_bak.split(':',2)[1].strip.gsub(/(:|\ )/, '-')
+ end
+ if timestamp_bak
+ t_bak = timestamp_bak.split(':',2)[1].strip.gsub(/(:|\ )/, '-')
end
if cam
c = cams[cam.split(':',2)[1].strip]
@@ -55,16 +56,19 @@ ids.each do |i|
else
c = "unknown-device"
end
+ if t.split('-').first.to_i < 2000
+ t = t_bak
+ if not t or t.split('-').first.to_i < 2000
+ puts "metadata unreasonable for #{i}, skipping!"
+ skip = true
+ end
+ end
new_prefix = "#{t}-#{c}"
add = 1
rescue
puts "Can't find metadata for #{i}, skipping!"
skip = true
end
- if t.split('-').first.to_i < 2000
- puts "metadata unreasonable for #{i}, skipping!"
- skip = true
- end
next if skip
while used_prefixes.has_key? new_prefix
new_prefix = "#{t}-#{add}-#{c}"