Much base work started
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled

This commit is contained in:
Dan Milne
2025-10-31 14:36:14 +11:00
parent 4a35bf6758
commit 88a906064f
97 changed files with 5333 additions and 2774 deletions

View File

@@ -0,0 +1,4 @@
<div>
<h1 class="font-bold text-4xl">StorageLocations#create</h1>
<p>Find me in app/views/storage_locations/create.html.erb</p>
</div>

View File

@@ -0,0 +1,4 @@
<div>
<h1 class="font-bold text-4xl">StorageLocations#destroy</h1>
<p>Find me in app/views/storage_locations/destroy.html.erb</p>
</div>

View File

@@ -0,0 +1,81 @@
<div class="container mx-auto px-4 py-8">
<div class="flex justify-between items-center mb-8">
<h1 class="text-3xl font-bold text-gray-900">Video Library</h1>
<% if @storage_locations.any? %>
<%= link_to "New Storage Location", new_storage_location_path,
class: "bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition-colors" %>
<% end %>
</div>
<% if @storage_locations.empty? %>
<div class="text-center py-12 bg-white rounded-lg shadow">
<div class="text-gray-500 text-lg mb-4">No storage locations found</div>
<p class="text-gray-600 mb-6">
Storage locations are automatically discovered from directories mounted under <code class="bg-gray-100 px-2 py-1 rounded">/videos</code>
</p>
<div class="text-sm text-gray-500">
<p class="mb-2">Example Docker volume mounts:</p>
<code class="block bg-gray-100 p-3 rounded text-left">
/path/to/movies:/videos/movies:ro<br>
/path/to/tv_shows:/videos/tv:ro<br>
/path/to/documentaries:/videos/docs:ro
</code>
</div>
</div>
<% else %>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<% @storage_locations.each do |storage_location| %>
<div class="bg-white rounded-lg shadow-md hover:shadow-lg transition-shadow">
<div class="p-6">
<h2 class="text-xl font-semibold text-gray-900 mb-2">
<%= link_to storage_location.name, storage_location,
class: "hover:text-blue-600 transition-colors" %>
</h2>
<div class="text-gray-600 text-sm mb-4">
<p class="mb-1">
<span class="font-medium">Path:</span>
<code class="bg-gray-100 px-1 py-0.5 rounded text-xs"><%= storage_location.path %></code>
</p>
<p class="mb-1">
<span class="font-medium">Type:</span>
<%= storage_location.storage_type.titleize %>
</p>
<p>
<span class="font-medium">Videos:</span>
<%= storage_location.video_count %>
</p>
</div>
<% if storage_location.accessible? %>
<div class="flex items-center text-green-600 text-sm mb-4">
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
</svg>
Accessible
</div>
<% else %>
<div class="flex items-center text-red-600 text-sm mb-4">
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
</svg>
Not Accessible
</div>
<% end %>
<div class="flex space-x-2">
<%= link_to "View Videos", storage_location,
class: "bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-3 rounded text-sm transition-colors" %>
<%= form_with(url: scan_storage_location_path(storage_location), method: :post,
class: "inline-flex") do |form| %>
<%= form.submit "Scan",
class: "bg-gray-600 hover:bg-gray-700 text-white font-medium py-2 px-3 rounded text-sm cursor-pointer transition-colors" %>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
<% end %>
</div>

View File

@@ -0,0 +1,118 @@
<div class="container mx-auto px-4 py-8">
<div class="flex items-center justify-between mb-8">
<div>
<h1 class="text-3xl font-bold text-gray-900"><%= @storage_location.name %></h1>
<p class="text-gray-600 mt-2">
<span class="font-medium">Path:</span>
<code class="bg-gray-100 px-2 py-1 rounded"><%= @storage_location.path %></code>
</p>
</div>
<div class="flex space-x-3">
<%= link_to "← Back to Library", storage_locations_path,
class: "bg-gray-600 hover:bg-gray-700 text-white font-medium py-2 px-4 rounded-lg transition-colors" %>
<%= form_with(url: scan_storage_location_path(@storage_location), method: :post,
class: "inline-flex") do |form| %>
<%= form.submit "Scan for Videos",
class: "bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg cursor-pointer transition-colors" %>
<% end %>
</div>
</div>
<% if @videos.empty? %>
<div class="text-center py-12 bg-white rounded-lg shadow">
<div class="text-gray-500 text-lg mb-4">No videos found</div>
<p class="text-gray-600">
This storage location doesn't contain any video files yet. Try scanning for videos to add them to your library.
</p>
</div>
<% else %>
<div class="bg-white rounded-lg shadow">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-xl font-semibold text-gray-900">
Videos (<%= @videos.count %>)
</h2>
</div>
<div class="divide-y divide-gray-200">
<% @videos.each do |video| %>
<div class="p-6 hover:bg-gray-50 transition-colors">
<div class="flex items-start space-x-4">
<!-- Thumbnail placeholder -->
<div class="flex-shrink-0">
<% if video.video_assets.where(asset_type: 'thumbnail').any? %>
<%= image_tag video.video_assets.where(asset_type: 'thumbnail').first.file,
class: "w-24 h-16 object-cover rounded", alt: video.display_title %>
<% else %>
<div class="w-24 h-16 bg-gray-200 rounded flex items-center justify-center">
<svg class="w-8 h-8 text-gray-400" fill="currentColor" viewBox="0 0 20 20">
<path d="M2 6a2 2 0 012-2h6a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V6zM14.553 7.106A1 1 0 0014 8v4a1 1 0 00.553.894l2 1A1 1 0 0018 13V7a1 1 0 00-1.447-.894l-2 1z"/>
</svg>
</div>
<% end %>
</div>
<!-- Video info -->
<div class="flex-1 min-w-0">
<h3 class="text-lg font-medium text-gray-900 mb-1">
<%= link_to video.display_title, video,
class: "hover:text-blue-600 transition-colors" %>
</h3>
<div class="flex flex-wrap gap-4 text-sm text-gray-600 mb-2">
<span>
<span class="font-medium">Duration:</span>
<%= video.format_duration %>
</span>
<span>
<span class="font-medium">Resolution:</span>
<%= video.resolution_label %>
</span>
<span>
<span class="font-medium">Size:</span>
<%= number_to_human_size(video.video_metadata['file_size']) rescue "Unknown" %>
</span>
</div>
<div class="flex items-center space-x-3 text-sm">
<% if video.web_compatible? %>
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800">
Web Compatible
</span>
<% else %>
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
Needs Transcoding
</span>
<% end %>
<% if video.processed? %>
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
Processed
</span>
<% else %>
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
Processing
</span>
<% end %>
<% if video.work&.title && video.work.title != video.display_title %>
<span class="text-gray-500">
Part of: <%= link_to video.work.title, video.work,
class: "hover:text-blue-600 transition-colors" %>
</span>
<% end %>
</div>
</div>
<!-- Actions -->
<div class="flex-shrink-0">
<%= link_to "Watch", video,
class: "bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded transition-colors" %>
</div>
</div>
</div>
<% end %>
</div>
</div>
<% end %>
</div>