-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dependabot/hex/floki-0.36.2
- Loading branch information
Showing
68 changed files
with
524 additions
and
934 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,51 @@ | ||
#!/bin/bash | ||
|
||
sudo apt install gnupg ca-certificates | ||
# Install dependencies | ||
sudo apt update | ||
sudo apt install -y gnupg ca-certificates curl sqlite3 | ||
|
||
# Add Mono repository and key | ||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF | ||
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list | ||
sudo apt update | ||
sudo apt install mono-devel | ||
sudo apt install -y mono-devel | ||
|
||
# Setup Sonarr user and permissions | ||
sudo groupadd media | ||
sudo adduser --system --no-create-home --ingroup media sonarr | ||
sudo usermod -a -G media sonarr | ||
|
||
sudo chown -R sonarr:media /library/series | ||
sudo chmod 775 /library/series | ||
|
||
# Setup directories | ||
sudo mkdir -p /var/lib/sonarr | ||
sudo mv ${GITHUB_WORKSPACE}/dev/sonarr/config.xml /var/lib/sonarr | ||
sudo cp ${GITHUB_WORKSPACE}/dev/sonarr/config.xml /var/lib/sonarr | ||
sudo chown -R sonarr:media /var/lib/sonarr | ||
sudo chmod 775 /var/lib/sonarr | ||
|
||
sudo apt install curl sqlite3 | ||
# Install Sonarr | ||
wget --content-disposition "https://download.sonarr.tv/v4/main/4.0.0.748/Sonarr.main.4.0.0.748.linux-x64.tar.gz" | ||
tar -xvzf Sonarr*.linux*.tar.gz | ||
sudo mv Sonarr /opt | ||
sudo chown sonarr:media -R /opt/Sonarr | ||
sudo chown -R sonarr:media /opt/Sonarr | ||
|
||
# Create and enable Sonarr service | ||
cat << EOF | sudo tee /etc/systemd/system/sonarr.service > /dev/null | ||
[Unit] | ||
Description=Sonarr Daemon | ||
After=syslog.target network.target | ||
After=network.target | ||
[Service] | ||
User=sonarr | ||
Group=media | ||
UMask=002 | ||
Type=simple | ||
ExecStart=/usr/bin/mono --debug /opt/Sonarr/Sonarr.exe -nobrowser -data=/var/lib/sonarr | ||
ExecStart=/opt/Sonarr/Sonarr -nobrowser -data=/var/lib/sonarr | ||
TimeoutStopSec=20 | ||
KillMode=process | ||
Restart=on-failure | ||
[Install] | ||
WantedBy=multi-user.target | ||
EOF | ||
sudo systemctl -q daemon-reload | ||
sudo systemctl enable --now -q sonarr | ||
sudo journalctl --since today -u sonarr | ||
|
||
sudo systemctl daemon-reload | ||
sudo systemctl enable --now sonarr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
defmodule MediaServer.AddEpisode do | ||
use Oban.Worker, queue: :default, max_attempts: 3 | ||
|
||
@impl true | ||
@spec perform(%{:args => map(), optional(any()) => any()}) :: :ok | ||
def perform(%Oban.Job{args: %{"items" => items}}) do | ||
items | ||
|> Enum.each(fn item -> | ||
MediaServer.Episodes.insert(%{ | ||
series_id: item["series_id"], | ||
external_id: item["external_id"] | ||
}) | ||
end) | ||
|
||
:ok | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
defmodule MediaServer.AddMovies do | ||
use Oban.Worker, queue: :default, max_attempts: 3 | ||
|
||
@impl true | ||
@spec perform(%{:args => map(), optional(any()) => any()}) :: :ok | ||
def perform(%Oban.Job{args: %{"items" => items}}) do | ||
items | ||
|> Enum.each(fn item -> | ||
MediaServer.Movies.insert(%{ | ||
external_id: item["external_id"] | ||
}) | ||
end) | ||
|
||
:ok | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
defmodule MediaServer.AddPeople do | ||
use Oban.Worker, queue: :default, max_attempts: 3 | ||
|
||
@impl true | ||
@spec perform(%{:args => map(), optional(any()) => any()}) :: :ok | ||
def perform(%Oban.Job{args: %{"items" => items}}) do | ||
items | ||
|> Enum.each(fn item -> | ||
MediaServer.People.insert(%{ | ||
tmdb_id: item["tmdb_id"], | ||
name: item["name"], | ||
image: item["image"] | ||
}) | ||
end) | ||
|
||
:ok | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
defmodule MediaServer.AddSeries do | ||
use Oban.Worker, queue: :default, max_attempts: 3 | ||
|
||
@impl true | ||
@spec perform(%{:args => map(), optional(any()) => any()}) :: :ok | ||
def perform(%Oban.Job{args: %{"items" => items}}) do | ||
items | ||
|> Enum.each(fn item -> | ||
MediaServer.Series.insert(%{ | ||
external_id: item["external_id"] | ||
}) | ||
end) | ||
|
||
:ok | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
defmodule MediaServer.EpisodeContinues do | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
alias MediaServer.Repo | ||
|
||
schema "episode_continues" do | ||
belongs_to :episode, MediaServer.Episodes, foreign_key: :episodes_id | ||
belongs_to :user, MediaServer.Accounts.User | ||
|
||
field :current_time, :integer | ||
field :duration, :integer | ||
|
||
timestamps() | ||
end | ||
|
||
def changeset(continue, attrs) do | ||
continue | ||
|> cast(attrs, [:episodes_id, :current_time, :duration, :user_id]) | ||
|> validate_required([:episodes_id, :current_time, :duration, :user_id]) | ||
end | ||
|
||
def insert_or_update(attrs) do | ||
case Repo.get_by(__MODULE__, episodes_id: attrs.episodes_id, user_id: attrs.user_id) do | ||
nil -> | ||
%__MODULE__{ | ||
episodes_id: attrs.episodes_id, | ||
user_id: attrs.user_id | ||
} | ||
|
||
item -> | ||
item | ||
end | ||
|> changeset( | ||
Enum.into(attrs, %{ | ||
updated_at: DateTime.utc_now() | ||
}) | ||
) | ||
|> Repo.insert_or_update() | ||
end | ||
|
||
def where(attrs) do | ||
Repo.get_by(__MODULE__, attrs) | ||
end | ||
end |
Oops, something went wrong.