Skip to content

Commit

Permalink
Refactor Video Blob Checks and Improve Redirect Logic in Movie and Se…
Browse files Browse the repository at this point in the history
…ason Views (#421)
  • Loading branch information
brand-it authored Aug 3, 2024
1 parent 6eaa80f commit 58e72e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/components/movie_title_table_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</td>
<td class="text-center">
<h1>
<% if disk_title.video_blob&.uploaded? %>
<% if movie.ripped_disk_titles.any? { _1.video_blob&.uploaded? } %>
<%= icon('square-check') %>
<% else %>
<%= icon('square') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/seasons/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</td>
<td class="text-center">
<h1>
<% if episode.video_blobs.any?(&:uploaded?) %>
<% if episode.ripped_disk_titles.any? { _1.video_blob.uploaded? } %>
<%= icon('square-check') %>
<% else %>
<%= icon('square') %>
Expand Down
16 changes: 12 additions & 4 deletions app/workers/rip_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,18 @@ def redirect_to_season_or_movie
end

def redirect_url
if disk.video.is_a?(Movie)
movie_url(disk.video)
elsif disk.video.is_a?(Tv)
tv_season_url(disk.episode.season.tv, disk.episode.season)
disk_title = DiskTitle.find_by(id: disk_title_ids.first)
return if disk_title.nil?

if disk_title.video.is_a?(Movie)
movie_url(disk_title.video)
elsif disk_title.video.is_a?(Tv)
tv_season_url(disk_title.episode.season.tv, disk_title.episode.season)
end
end

def reload_page!
cable_ready[BroadcastChannel.channel_name].reload
cable_ready.broadcast
end
end

0 comments on commit 58e72e7

Please sign in to comment.