Aggiunge replay YouTube temporaneo, pull registrazioni dai CPX e snapshot ingest in admin.
Così overflow Hetzner e VOD YouTube restano in archivio dopo lo spegnimento del nodo, e la colonna ingest non si svuota. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,4 +20,37 @@ namespace :recordings do
|
||||
orphan = Mediamtx::CleanupOrphanPaths.new.call
|
||||
puts "Path MediaMTX orfani rimossi: #{orphan.removed} (saltati: #{orphan.skipped})"
|
||||
end
|
||||
|
||||
desc "Elimina copie temporanee YouTube scadute (solo storage, non soft-delete)"
|
||||
task purge_temporary: :environment do
|
||||
count = Recordings::PurgeTemporaryMediaJob.new.perform
|
||||
puts "Purge temporary replays: processed=#{count}"
|
||||
end
|
||||
|
||||
desc "Audit dry-run: recording YouTube con ancora MP4 in Garage (duplicati storici). " \
|
||||
"Cleanup solo se APPLY=1 (non implementato di default — solo report)."
|
||||
task audit_youtube_duplicates: :environment do
|
||||
apply = ENV["APPLY"].to_s == "1"
|
||||
scope = Recording.not_deleted
|
||||
.where.not(youtube_video_id: [nil, ""])
|
||||
.where.not(storage_key: [nil, ""])
|
||||
.where("youtube_video_id NOT LIKE 'mock_%'")
|
||||
|
||||
puts "Audit YouTube duplicates (dry-run=#{!apply}): count=#{scope.count}"
|
||||
scope.find_each do |rec|
|
||||
puts [
|
||||
"id=#{rec.id}",
|
||||
"policy=#{rec.storage_policy}",
|
||||
"key=#{rec.storage_key}",
|
||||
"yt=#{rec.youtube_video_id}",
|
||||
"purged_at=#{rec.local_media_purged_at.inspect}",
|
||||
"temp_expires=#{rec.temp_expires_at.inspect}"
|
||||
].join(" ")
|
||||
end
|
||||
|
||||
if apply
|
||||
puts "APPLY=1 richiesto ma cleanup storico automatico NON eseguito " \
|
||||
"(fuori scope; solo dry-run supportato)."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user