diff --git a/apps/bright/lib/bright/oban_workers/create_hls_playlist.ex b/apps/bright/lib/bright/oban_workers/create_hls_playlist.ex
index c815924..ae99b73 100644
--- a/apps/bright/lib/bright/oban_workers/create_hls_playlist.ex
+++ b/apps/bright/lib/bright/oban_workers/create_hls_playlist.ex
@@ -53,7 +53,7 @@ defmodule Bright.ObanWorkers.CreateHlsPlaylist do
{:complete, vod} ->
Streams.broadcast_processing_progressed!(stage, vod, 1)
- Streams.broadcast_processing_completed!(:upload, vod, vod.url)
+ Streams.broadcast_processing_completed!(:hls_playlist, vod)
{:ok, vod.url}
{:error, e, %Oban.Job{attempt: attempt, max_attempts: max_attempts}} ->
diff --git a/apps/bright/lib/bright/oban_workers/scrape_x.ex b/apps/bright/lib/bright/oban_workers/scrape_x.ex
new file mode 100644
index 0000000..91135ca
--- /dev/null
+++ b/apps/bright/lib/bright/oban_workers/scrape_x.ex
@@ -0,0 +1,64 @@
+# defmodule Bright.ObanWorkers.ScrapeX do
+# alias Bright.Vtubers.Vtuber
+# use Oban.Worker, queue: :default, max_attempts: 3
+
+# alias Bright.Streams.Vod
+
+# alias Bright.{
+# Repo,
+# Downloader,
+# B2,
+# Images
+# }
+
+# require Logger
+
+# @impl Oban.Worker
+# def perform(%Oban.Job{args: %{"vtuber_id" => vtuber_id}}) do
+# Logger.info(">>>> Scrape X is performing. with vtuber_id=#{vtuber_id}")
+
+# # @todo get vtuber from db
+# # @todo get vtuber's X account
+# # @todo get nitter URL
+# # @todo get X posts
+# # @todo queue posts we haven't yet processed
+# # @todo parse posts in the queue to find CB/Fansly/OF invite links
+# # @todo for each post with an invite, create a stream in the db
+
+# # case Repo.get(Vtuber, vtuber_id) do
+
+# # nil ->
+# # Logger.error("Vtuber id #{vtuber_id} not found.")
+# # {:error, "Vtuber not found"}
+
+# # %Vtuber{} = vtuber ->
+# # with {:ok, } <-
+
+# # end
+
+# case Repo.get(Vod, vod_id) do
+# nil ->
+# Logger.error("VOD ID #{vod_id} not found")
+# {:error, "VOD not found"}
+
+# %Vod{origin_temp_input_url: origin_temp_input_url} = vod ->
+# with {:ok, local_filename} <- Downloader.get(origin_temp_input_url),
+# {:ok, thumbnail_filename} <- Images.create_thumbnail(local_filename),
+# {:ok, s3Asset} <- B2.put(thumbnail_filename) do
+# update_vod_with_thumbnail_url(vod, s3Asset.cdn_url)
+# else
+# {:error, reason} ->
+# Logger.error("Failed to create thumbnail for VOD ID #{vod_id}: #{inspect(reason)}")
+# {:error, reason}
+# end
+# end
+# end
+
+# # defp generate_thumbnail_url(basename), do: "#{Application.get_env(:bright, :public_s3_endpoint)}/#{basename}"
+# defp update_vod_with_thumbnail_url(vod, thumbnail_url) do
+# case Repo.update(vod |> Ecto.Changeset.change(thumbnail_url: thumbnail_url)) do
+# {:ok, updated_vod} -> {:ok, updated_vod}
+# {:error, changeset} -> {:error, changeset}
+# end
+# end
+# end
diff --git a/apps/bright/lib/bright/platforms/x.ex b/apps/bright/lib/bright/platforms/x.ex
new file mode 100644
index 0000000..3cdf8d2
--- /dev/null
+++ b/apps/bright/lib/bright/platforms/x.ex
@@ -0,0 +1,22 @@
+defmodule Bright.Platforms.XPost do
+ use Ecto.Schema
+ import Ecto.Changeset
+
+ schema "x_posts" do
+ field :raw, :string
+ field :url, :string
+ field :date, :utc_datetime
+ field :is_invitation, :boolean
+
+ belongs_to :vtuber, Bright.Vtubers.Vtuber
+
+ timestamps(type: :utc_datetime)
+ end
+
+ @doc false
+ def changeset(platform, attrs) do
+ platform
+ |> cast(attrs, [:raw, :url, :date])
+ |> validate_required([:raw, :url, :date])
+ end
+end
diff --git a/apps/bright/lib/bright/streams.ex b/apps/bright/lib/bright/streams.ex
index f775a3b..181a5f9 100644
--- a/apps/bright/lib/bright/streams.ex
+++ b/apps/bright/lib/bright/streams.ex
@@ -539,8 +539,8 @@ defmodule Bright.Streams do
broadcast!("backend", %Events.ProcessingProgressed{vod: vod, stage: stage, pct: pct})
end
- def broadcast_processing_completed!(action, vod, url) do
- broadcast!("backend", %Events.ProcessingCompleted{action: action, vod: vod, url: url})
+ def broadcast_processing_completed!(action, vod) do
+ broadcast!("backend", %Events.ProcessingCompleted{action: action, vod: vod})
end
def broadcast_processing_failed!(vod, attempt, max_attempts) do
diff --git a/apps/bright/lib/bright_web/controllers/torrent_html/show.html.heex b/apps/bright/lib/bright_web/controllers/torrent_html/show.html.heex
index 2de9d50..1e5b85c 100644
--- a/apps/bright/lib/bright_web/controllers/torrent_html/show.html.heex
+++ b/apps/bright/lib/bright_web/controllers/torrent_html/show.html.heex
@@ -11,8 +11,17 @@
<.list>
<:item title="Info hash v1">{@torrent.info_hash_v1}
<:item title="Info hash v2">{@torrent.info_hash_v2}
- <:item title="Cdn url">{@torrent.cdn_url}
- <:item title="Magnet">{@torrent.magnet}
+ <:item title="Torrent (file)">
+
+ {@torrent.cdn_url}
+
+
+ <:item title="Torrent (magnet)">
+
+
+ {@torrent.magnet}
+
+
<.back navigate={~p"/torrents"}>Back to torrent
diff --git a/apps/bright/test/bright/oban_workers/create_hls_playlist_test.exs b/apps/bright/test/bright/oban_workers/create_hls_playlist_test.exs
index c43ae19..6487503 100644
--- a/apps/bright/test/bright/oban_workers/create_hls_playlist_test.exs
+++ b/apps/bright/test/bright/oban_workers/create_hls_playlist_test.exs
@@ -9,8 +9,6 @@ defmodule Bright.CreateHlsPlaylistTest do
alias Bright.Streams.Stream
describe "CreateHlsPlaylist" do
- import Bright.StreamsFixtures
-
@tag :integration
test "sheduling upon vod creation" do
example_video = "http://example.com/video.ts"