diff options
Diffstat (limited to 'scripts/update.rb')
| -rw-r--r-- | scripts/update.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/scripts/update.rb b/scripts/update.rb index 8e4cdd5..9052341 100644 --- a/scripts/update.rb +++ b/scripts/update.rb @@ -44,11 +44,17 @@ def process_dir(dir) .select { |n| MEDIA_EXTS.include?(File.extname(n).downcase.delete_prefix('.')) } .sort - # Remove stale entries for deleted files + # Remove stale entries for deleted files and their cached thumbnails removed = data['files'].keys - current - if removed.any? - puts " Removing stale entries: #{removed.join(', ')}" - removed.each { |n| data['files'].delete(n) } + removed.each do |n| + data['files'].delete(n) + thumb = File.join(CACHE_ROOT, rel.empty? ? "#{n}.th.jpg" : "#{rel}/#{n}.th.jpg") + if File.exist?(thumb) + File.unlink(thumb) + puts " Removed: #{n} (+ thumb)" + else + puts " Removed: #{n}" + end end # Process each file |
