From 5c501b8cdc3f2366325a95768695846acaadc2fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:49:53 +0000 Subject: [PATCH 1/3] build(deps-dev): bump floki from 0.36.1 to 0.36.2 Bumps [floki](https://github.com/philss/floki) from 0.36.1 to 0.36.2. - [Release notes](https://github.com/philss/floki/releases) - [Changelog](https://github.com/philss/floki/blob/main/CHANGELOG.md) - [Commits](https://github.com/philss/floki/compare/v0.36.1...v0.36.2) --- updated-dependencies: - dependency-name: floki dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- mix.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.lock b/mix.lock index 5501054d..60cf7ed5 100644 --- a/mix.lock +++ b/mix.lock @@ -24,7 +24,7 @@ "extaima": {:hex, :extaima, "0.3.0", "388e17aa8f67e27bb7bca2182a8942eadcd414e6e6f59b43e2e0024b86361d06", [:mix], [], "hexpm", "b77c20980ed6cd3ae360bbbe787559bae0b1cf62e76b9509c3bca0f835a02668"}, "extitles": {:hex, :extitles, "0.1.0", "bc3566f7feae87d0b8a2dddb872968884e924e1b1fbc83386f041162e6f8782a", [:mix], [], "hexpm", "2c5c1376ffc0625cd3fa8f961e857465acecc390b4239ddcc718dacde5c5accc"}, "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, - "floki": {:hex, :floki, "0.36.1", "712b7f2ba19a4d5a47dfe3e74d81876c95bbcbee44fe551f0af3d2a388abb3da", [:mix], [], "hexpm", "21ba57abb8204bcc70c439b423fc0dd9f0286de67dc82773a14b0200ada0995f"}, + "floki": {:hex, :floki, "0.36.2", "a7da0193538c93f937714a6704369711998a51a6164a222d710ebd54020aa7a3", [:mix], [], "hexpm", "a8766c0bc92f074e5cb36c4f9961982eda84c5d2b8e979ca67f5c268ec8ed580"}, "gettext": {:hex, :gettext, "0.24.0", "6f4d90ac5f3111673cbefc4ebee96fe5f37a114861ab8c7b7d5b30a1108ce6d8", [:mix], [{:expo, "~> 0.5.1", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "bdf75cdfcbe9e4622dd18e034b227d77dd17f0f133853a1c73b97b3d6c770e8b"}, "hackney": {:hex, :hackney, "1.20.1", "8d97aec62ddddd757d128bfd1df6c5861093419f8f7a4223823537bad5d064e2", [:rebar3], [{:certifi, "~>2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fe9094e5f1a2a2c0a7d10918fee36bfec0ec2a979994cff8cfe8058cd9af38e3"}, "hls_playlist": {:hex, :hls_playlist, "0.3.0", "000fc1d9b659b83a4129a42755443cab25617f5ff550109285e18d900b4e082d", [:mix], [{:exile, "~> 0.9.1", [hex: :exile, repo: "hexpm", optional: false]}], "hexpm", "0237ec414cc8150123923927eaf6c3fe436df933388bc25c0d4e2ba2327a704b"}, From 1e7c4ef3f9fe458b131fddd523367a2a54965cc6 Mon Sep 17 00:00:00 2001 From: trueChazza Date: Wed, 12 Jun 2024 23:52:56 +0000 Subject: [PATCH 2/3] feat: add people name --- lib/media_server/actions/add_people.ex | 3 ++- lib/media_server/movies.ex | 2 +- lib/media_server/people.ex | 7 ++++--- .../repo/migrations/20240612052147_create_people_table.exs | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/media_server/actions/add_people.ex b/lib/media_server/actions/add_people.ex index 21594cae..370c6e4b 100644 --- a/lib/media_server/actions/add_people.ex +++ b/lib/media_server/actions/add_people.ex @@ -7,7 +7,8 @@ defmodule MediaServer.AddPeople do items |> Enum.each(fn item -> MediaServer.People.insert(%{ - tmdb_id: item["tmdb_id"] + tmdb_id: item["tmdb_id"], + name: item["name"], }) end) diff --git a/lib/media_server/movies.ex b/lib/media_server/movies.ex index e485f4ef..12d653e4 100644 --- a/lib/media_server/movies.ex +++ b/lib/media_server/movies.ex @@ -23,7 +23,7 @@ defmodule MediaServer.Movies do {:ok, record} -> MediaServer.AddPeople.new(%{"items" => MediaServerWeb.Repositories.Movies.get_cast(record.external_id) - |> Enum.map(fn x -> %{"tmdb_id" => x["personTmdbId"]} end)} + |> Enum.map(fn x -> %{"tmdb_id" => x["personTmdbId"], "name" => x["personName"]} end)} )|> Oban.insert() {:ok, record} diff --git a/lib/media_server/people.ex b/lib/media_server/people.ex index 6a98d75d..ebf1b64e 100644 --- a/lib/media_server/people.ex +++ b/lib/media_server/people.ex @@ -4,20 +4,21 @@ defmodule MediaServer.People do schema "people" do field :tmdb_id, :integer + field :name, :string timestamps() end def changeset(people, attrs) do people - |> cast(attrs, [:tmdb_id]) - |> validate_required([:tmdb_id]) + |> cast(attrs, [:tmdb_id, :name]) + |> validate_required([:tmdb_id, :name]) end def insert(attrs) do changeset = changeset(%__MODULE__{}, attrs) - case MediaServer.Repo.insert(changeset, on_conflict: :nothing, conflict_target: [:tmdb_id]) do + case MediaServer.Repo.insert(changeset, on_conflict: [set: [name: Ecto.Changeset.get_field(changeset, :name)]], conflict_target: [:tmdb_id]) do {:ok, record} -> {:ok, record} diff --git a/priv/repo/migrations/20240612052147_create_people_table.exs b/priv/repo/migrations/20240612052147_create_people_table.exs index bfc0211d..157a62da 100644 --- a/priv/repo/migrations/20240612052147_create_people_table.exs +++ b/priv/repo/migrations/20240612052147_create_people_table.exs @@ -4,6 +4,7 @@ defmodule MediaServer.Repo.Migrations.CreatePeopleTable do def change do create table(:people) do add :tmdb_id, :integer, null: false + add :name, :string timestamps() end From 932df8dc63fb972c6372b2d50597dc8157db7477 Mon Sep 17 00:00:00 2001 From: trueChazza Date: Thu, 13 Jun 2024 00:12:26 +0000 Subject: [PATCH 3/3] feat: add people image --- lib/media_server/actions/add_people.ex | 1 + lib/media_server/movies.ex | 2 +- lib/media_server/people.ex | 7 ++++--- .../repo/migrations/20240612052147_create_people_table.exs | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/media_server/actions/add_people.ex b/lib/media_server/actions/add_people.ex index 370c6e4b..56e773cc 100644 --- a/lib/media_server/actions/add_people.ex +++ b/lib/media_server/actions/add_people.ex @@ -9,6 +9,7 @@ defmodule MediaServer.AddPeople do MediaServer.People.insert(%{ tmdb_id: item["tmdb_id"], name: item["name"], + image: item["image"] }) end) diff --git a/lib/media_server/movies.ex b/lib/media_server/movies.ex index 12d653e4..a5900676 100644 --- a/lib/media_server/movies.ex +++ b/lib/media_server/movies.ex @@ -23,7 +23,7 @@ defmodule MediaServer.Movies do {:ok, record} -> MediaServer.AddPeople.new(%{"items" => MediaServerWeb.Repositories.Movies.get_cast(record.external_id) - |> Enum.map(fn x -> %{"tmdb_id" => x["personTmdbId"], "name" => x["personName"]} end)} + |> Enum.map(fn x -> %{"tmdb_id" => x["personTmdbId"], "name" => x["personName"], "image" => MediaServer.Helpers.get_headshot(x)} end)} )|> Oban.insert() {:ok, record} diff --git a/lib/media_server/people.ex b/lib/media_server/people.ex index ebf1b64e..641ca4ec 100644 --- a/lib/media_server/people.ex +++ b/lib/media_server/people.ex @@ -5,20 +5,21 @@ defmodule MediaServer.People do schema "people" do field :tmdb_id, :integer field :name, :string + field :image, :string timestamps() end def changeset(people, attrs) do people - |> cast(attrs, [:tmdb_id, :name]) - |> validate_required([:tmdb_id, :name]) + |> cast(attrs, [:tmdb_id, :name, :image]) + |> validate_required([:tmdb_id, :name, :image]) end def insert(attrs) do changeset = changeset(%__MODULE__{}, attrs) - case MediaServer.Repo.insert(changeset, on_conflict: [set: [name: Ecto.Changeset.get_field(changeset, :name)]], conflict_target: [:tmdb_id]) do + case MediaServer.Repo.insert(changeset, on_conflict: [set: [name: Ecto.Changeset.get_field(changeset, :name), image: Ecto.Changeset.get_field(changeset, :image)]], conflict_target: [:tmdb_id]) do {:ok, record} -> {:ok, record} diff --git a/priv/repo/migrations/20240612052147_create_people_table.exs b/priv/repo/migrations/20240612052147_create_people_table.exs index 157a62da..b2946b78 100644 --- a/priv/repo/migrations/20240612052147_create_people_table.exs +++ b/priv/repo/migrations/20240612052147_create_people_table.exs @@ -5,6 +5,7 @@ defmodule MediaServer.Repo.Migrations.CreatePeopleTable do create table(:people) do add :tmdb_id, :integer, null: false add :name, :string + add :image, :string timestamps() end