Skip to content

Commit

Permalink
Merge pull request #482 from midarrlabs/dependabot/hex/floki-0.36.2
Browse files Browse the repository at this point in the history
build(deps-dev): bump floki from 0.36.1 to 0.36.2
  • Loading branch information
trueChazza authored Jun 14, 2024
2 parents be91777 + 5813f15 commit 5dae0a9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/media_server/actions/add_people.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ 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"],
image: item["image"]
})
end)

Expand Down
2 changes: 1 addition & 1 deletion lib/media_server/movies.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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"], "image" => MediaServer.Helpers.get_headshot(x)} end)}
)|> Oban.insert()

{:ok, record}
Expand Down
8 changes: 5 additions & 3 deletions lib/media_server/people.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ 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])
|> validate_required([:tmdb_id])
|> 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: :nothing, 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}

Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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"},
Expand Down
2 changes: 2 additions & 0 deletions priv/repo/migrations/20240612052147_create_people_table.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ defmodule MediaServer.Repo.Migrations.CreatePeopleTable do
def change do
create table(:people) do
add :tmdb_id, :integer, null: false
add :name, :string
add :image, :string

timestamps()
end
Expand Down

0 comments on commit 5dae0a9

Please sign in to comment.