summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorKen D'Ambrosio <ken@jots.org>2026-05-14 22:59:59 +0000
committerKen D'Ambrosio <ken@jots.org>2026-05-14 22:59:59 +0000
commitc76ea393777897e0c367e186d1a3b243193d8377 (patch)
treeb922795d65bcbea171ef6c2ddf6b3c80881123d2 /scripts
parent6acd47c1ca27d705afe88b292a55a5170c038d2e (diff)
Hide transcoded originals from non-admins; mark them visually for admins
update.rb records transcoded_to in album.json (even on re-runs where the MP4 already exists) so the marker survives across scans. app.rb filters files with transcoded_to from non-admin views. album.erb renders them greyed-out with an amber "⚠ original" badge in admin mode. admin/album.erb marks the edit-table row and shows the target filename under the original. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/update.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/update.rb b/scripts/update.rb
index a4969d3..9953505 100644
--- a/scripts/update.rb
+++ b/scripts/update.rb
@@ -64,16 +64,21 @@ def process_dir(dir)
.each do |name|
base = File.basename(name, '.*')
target = "#{base}.mp4"
- next if current.include?(target) # already transcoded on a previous run
+ if current.include?(target)
+ # MP4 already exists — just ensure the marker is recorded
+ data['files'][name] ||= {}
+ data['files'][name]['transcoded_to'] = target
+ next
+ end
full = File.join(dir, name)
dest = File.join(dir, target)
puts " Transcoding: #{name} → #{target}"
transcode_to_mp4(full, dest)
if File.exist?(dest)
data['files'][name] ||= {}
- data['files'][name]['visible'] ||= false # hide original; admin can override
- current << target # include in processing pass below
- puts " → done (original hidden)"
+ data['files'][name]['transcoded_to'] = target
+ current << target
+ puts " → done"
else
warn " Transcode failed: #{name}"
end