Change Channel to Source (#12)

* Ensure channel detail lookup doesn't download the video - oops

* Ran the needful migrations for replacing channels with sources

* got media source test back working

* channel tasks test

* Media indexing worker test

* media tests

* Got all tests working except controller tests

* got all tests working

* Renamed Channel struct to Source

* renamed ChannelTasks

* More renaming; renamed channel details module

* Removed Channel yt-dlp module, instead throwing things in the VideoCollection module

* Renamed what looks like the last of the outstanding data
This commit is contained in:
Kieran
2024-02-02 17:45:21 -08:00
committed by GitHub
parent 977b69b7c3
commit 366fd80213
46 changed files with 805 additions and 762 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ defmodule Pinchflat.MediaFixtures do
media_id: Faker.String.base64(12),
title: Faker.Commerce.product_name(),
media_filepath: "/video/#{Faker.File.file_name(:video)}",
channel_id: MediaSourceFixtures.channel_fixture().id
source_id: MediaSourceFixtures.source_fixture().id
})
|> Pinchflat.Media.create_media_item()
+10 -9
View File
@@ -6,18 +6,19 @@ defmodule Pinchflat.MediaSourceFixtures do
alias Pinchflat.Repo
alias Pinchflat.ProfilesFixtures
alias Pinchflat.MediaSource.Channel
alias Pinchflat.MediaSource.Source
@doc """
Generate a channel.
Generate a source.
"""
def channel_fixture(attrs \\ %{}) do
{:ok, channel} =
%Channel{}
|> Channel.changeset(
def source_fixture(attrs \\ %{}) do
{:ok, source} =
%Source{}
|> Source.changeset(
Enum.into(attrs, %{
name: "Channel ##{:rand.uniform(1_000_000)}",
channel_id: Base.encode16(:crypto.hash(:md5, "#{:rand.uniform(1_000_000)}")),
name: "Source ##{:rand.uniform(1_000_000)}",
collection_id: Base.encode16(:crypto.hash(:md5, "#{:rand.uniform(1_000_000)}")),
collection_type: "channel",
original_url: "https://www.youtube.com/channel/#{Faker.String.base64(12)}",
media_profile_id: ProfilesFixtures.media_profile_fixture().id,
index_frequency_minutes: 60
@@ -25,6 +26,6 @@ defmodule Pinchflat.MediaSourceFixtures do
)
|> Repo.insert()
channel
source
end
end
+1 -1
View File
@@ -14,7 +14,7 @@ defmodule Pinchflat.TasksFixtures do
{:ok, task} =
attrs
|> Enum.into(%{
channel_id: MediaSourceFixtures.channel_fixture().id,
source_id: MediaSourceFixtures.source_fixture().id,
job_id: JobFixtures.job_fixture().id
})
|> Pinchflat.Tasks.create_task()