[Enhancement] Add media count to sources page (#251)

* [WIP] Got query kinda working, now to refactor other queries

* Refactored all query methods to use dynamic snippets

* Refactored tab layout to grab tabs by name

* Removed standalone show buttons from in-app tables

* Removed unneeded comment
This commit is contained in:
Kieran
2024-05-21 08:53:22 -07:00
committed by GitHub
parent 94c0cf9970
commit a2a0f48065
28 changed files with 219 additions and 242 deletions
@@ -114,7 +114,7 @@ defmodule Pinchflat.Downloading.DownloadingHelpersTest do
describe "kickoff_redownload_for_existing_media/1" do
test "enqueues a download job for each downloaded media item" do
source = source_fixture()
media_item = media_item_fixture(source_id: source.id, media_downloaded_at: now())
media_item = media_item_fixture(source_id: source.id, media_filepath: "some/filepath.mp4")
assert [{:ok, _}] = DownloadingHelpers.kickoff_redownload_for_existing_media(source)
@@ -124,14 +124,14 @@ defmodule Pinchflat.Downloading.DownloadingHelpersTest do
test "doesn't enqueue jobs for media that should be ignored" do
source = source_fixture()
other_source = source_fixture()
_not_downloaded = media_item_fixture(source_id: source.id, media_downloaded_at: nil)
_other_source = media_item_fixture(source_id: other_source.id, media_downloaded_at: now())
_not_downloaded = media_item_fixture(source_id: source.id, media_filepath: nil)
_other_source = media_item_fixture(source_id: other_source.id, media_filepath: "some/filepath.mp4")
_download_prevented =
media_item_fixture(source_id: source.id, media_downloaded_at: now(), prevent_download: true)
media_item_fixture(source_id: source.id, media_filepath: "some/filepath.mp4", prevent_download: true)
_culled =
media_item_fixture(source_id: source.id, media_downloaded_at: now(), culled_at: now())
media_item_fixture(source_id: source.id, media_filepath: "some/filepath.mp4", culled_at: now())
assert [] = DownloadingHelpers.kickoff_redownload_for_existing_media(source)
+2
View File
@@ -405,7 +405,9 @@ defmodule Pinchflat.MediaTest do
describe "list_pending_media_items_for/1" do
test "it returns pending without a filepath for a given source" do
source = source_fixture()
other_source = source_fixture()
media_item = media_item_fixture(%{source_id: source.id, media_filepath: nil})
_other_media_item = media_item_fixture(%{source_id: other_source.id, media_filepath: nil})
assert Media.list_pending_media_items_for(source) == [media_item]
end
+1 -1
View File
@@ -17,7 +17,7 @@ defmodule Pinchflat.MediaFixtures do
attrs
|> Enum.into(%{
media_id: media_id,
title: Faker.Commerce.product_name(),
title: Faker.Commerce.product_name() <> " #{media_id}",
original_url: "https://www.youtube.com/watch?v=#{media_id}",
livestream: false,
short_form_content: false,