Skip to content

Commit

Permalink
Merge pull request #453 from AnimeThemes/audios
Browse files Browse the repository at this point in the history
Audios Release
  • Loading branch information
paranarimasu authored Aug 27, 2022
2 parents 979773d + ff2de26 commit 99ec12c
Show file tree
Hide file tree
Showing 332 changed files with 18,051 additions and 5,125 deletions.
75 changes: 62 additions & 13 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ APP_URL=http://localhost
ASSET_URL=null
APP_KEY=

# audio
AUDIO_DISK_DEFAULT=audios_nyc
AUDIO_DISKS=audios_nyc
AUDIO_DISK_ROOT=
AUDIO_PATH=/audio
AUDIO_URL=
AUDIO_STREAMING_METHOD=
AUDIO_NGINX_REDIRECT=

# audit
AUDITING_ENABLED=true

Expand Down Expand Up @@ -65,18 +74,19 @@ REDIS_DB=0
REDIS_CACHE_DB=1

# elastic client
ELASTIC_HOST=localhost
ELASTIC_PORT=9200
ELASTIC_SCHEME=http
ELASTIC_USER=
ELASTIC_PASS=
ELASTIC_CONNECTION=default
ELASTIC_HOST=http://localhost:9200

# elastic driver
ELASTIC_SCOUT_DRIVER_REFRESH_DOCUMENTS=false

# elastic migrations
ELASTIC_MIGRATIONS_TABLE=elastic_migrations

# ffmpeg
FFMPEG_BINARIES=
FFPROBE_BINARIES=

# filesystems
FILESYSTEM_DISK=local

Expand All @@ -90,17 +100,45 @@ IMAGE_DISABLE_ASSERTS=
IMAGE_VISIBILITY=
IMAGE_URL=

VIDEO_ACCESS_KEY_ID=
VIDEO_SECRET_ACCESS_KEY=
VIDEO_DEFAULT_REGION=
VIDEO_ENDPOINT=
VIDEO_BUCKET=
VIDEO_STREAM_READS=
VIDEO_DISABLE_ASSERTS=
VIDEO_VISIBILITY=
VIDEO_NYC_ACCESS_KEY_ID=
VIDEO_NYC_SECRET_ACCESS_KEY=
VIDEO_NYC_DEFAULT_REGION=
VIDEO_NYC_ENDPOINT=
VIDEO_NYC_BUCKET=
VIDEO_NYC_STREAM_READS=
VIDEO_NYC_DISABLE_ASSERTS=
VIDEO_NYC_VISIBILITY=

VIDEO_FRA_ACCESS_KEY_ID=
VIDEO_FRA_SECRET_ACCESS_KEY=
VIDEO_FRA_DEFAULT_REGION=
VIDEO_FRA_ENDPOINT=
VIDEO_FRA_BUCKET=
VIDEO_FRA_STREAM_READS=
VIDEO_FRA_DISABLE_ASSERTS=
VIDEO_FRA_VISIBILITY=

AUDIO_NYC_ACCESS_KEY_ID=
AUDIO_NYC_SECRET_ACCESS_KEY=
AUDIO_NYC_DEFAULT_REGION=
AUDIO_NYC_ENDPOINT=
AUDIO_NYC_BUCKET=
AUDIO_NYC_STREAM_READS=
AUDIO_NYC_DISABLE_ASSERTS=
AUDIO_NYC_VISIBILITY=

AUDIO_FRA_ACCESS_KEY_ID=
AUDIO_FRA_SECRET_ACCESS_KEY=
AUDIO_FRA_DEFAULT_REGION=
AUDIO_FRA_ENDPOINT=
AUDIO_FRA_BUCKET=
AUDIO_FRA_STREAM_READS=
AUDIO_FRA_DISABLE_ASSERTS=
AUDIO_FRA_VISIBILITY=

# flags
ALLOW_VIDEO_STREAMS=false
ALLOW_AUDIO_STREAMS=false
ALLOW_DISCORD_NOTIFICATIONS=false
ALLOW_VIEW_RECORDING=false

Expand All @@ -115,6 +153,10 @@ BCRYPT_ROUNDS=10
HORIZON_DOMAIN=
HORIZON_PATH=horizon

# image
IMAGE_DISK=images
IMAGE_DISK_ROOT=

# jetstream
JETSTREAM_PATH=
JETSTREAM_URL=http://localhost
Expand Down Expand Up @@ -189,8 +231,15 @@ TELESCOPE_DRIVER=database
TELESCOPE_ENABLED=true

# video
VIDEO_DISK_DEFAULT=videos_nyc
VIDEO_DISKS=videos_nyc
VIDEO_DISK_ROOT=
VIDEO_PATH=/video
VIDEO_URL=
VIDEO_STREAMING_METHOD=
VIDEO_NGINX_REDIRECT=
VIDEO_ENCODER_VERSION=
VIDEO_UPLOAD_DISKS=

# web
WEB_URL=http://localhost
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
php-version: '8.1'
tools: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, phpunit
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
php-version: '8.1'
tools: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, phpunit
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<p align="center">
<a href="https://github.com/AnimeThemes/animethemes-server/actions/workflows/test.yml"><img src="https://github.com/AnimeThemes/animethemes-server/workflows/Tests/badge.svg?branch=wiki" alt="tests"></a>
<a href="https://github.com/AnimeThemes/animethemes-server/actions/workflows/static-analysis.yml"><img src="https://github.com/AnimeThemes/animethemes-server/workflows/Static%20Analysis/badge.svg?branch=wiki" alt="static-analysis"></a>
<a href="https://github.styleci.io/repos/111264405?branch=wiki"><img src="https://github.styleci.io/repos/111264405/shield?branch=wiki" alt="StyleCI"></a>
<a href="https://github.com/AnimeThemes/animethemes-server/actions/workflows/test.yml"><img src="https://github.com/AnimeThemes/animethemes-server/workflows/Tests/badge.svg?branch=main" alt="tests"></a>
<a href="https://github.com/AnimeThemes/animethemes-server/actions/workflows/static-analysis.yml"><img src="https://github.com/AnimeThemes/animethemes-server/workflows/Static%20Analysis/badge.svg?branch=main" alt="static-analysis"></a>
<a href="https://github.styleci.io/repos/111264405?branch=main"><img src="https://github.styleci.io/repos/111264405/shield?branch=main" alt="StyleCI"></a>
<a href="https://discordapp.com/invite/m9zbVyQ"><img src="https://img.shields.io/discord/354388306580078594.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2"></a>
<a href="https://github.com/AnimeThemes/animethemes-server/blob/wiki/LICENSE"><img src="https://img.shields.io/github/license/AnimeThemes/animethemes-server"></a>
<a href="https://github.com/AnimeThemes/animethemes-server/blob/main/LICENSE"><img src="https://img.shields.io/github/license/AnimeThemes/animethemes-server"></a>
<a href="https://reddit.com/r/AnimeThemes"><img src="https://img.shields.io/reddit/subreddit-subscribers/AnimeThemes?style=social"></a>
<a href="https://twitter.com/AnimeThemesMoe"><img src="https://img.shields.io/twitter/follow/AnimeThemesMoe?style=social"></a>
</p>
Expand Down
53 changes: 53 additions & 0 deletions app/Actions/ActionResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

declare(strict_types=1);

namespace App\Actions;

use App\Enums\Actions\ActionStatus;

/**
* Class ActionResult.
*/
class ActionResult
{
/**
* Create a new action result instance.
*
* @param ActionStatus $status
* @param string|null $message
*/
public function __construct(protected readonly ActionStatus $status, protected readonly ?string $message = null)
{
}

/**
* Get the action result status.
*
* @return ActionStatus
*/
public function getStatus(): ActionStatus
{
return $this->status;
}

/**
* Get the action result message.
*
* @return string|null
*/
public function getMessage(): ?string
{
return $this->message;
}

/**
* Has the action failed?
*
* @return bool
*/
public function hasFailed(): bool
{
return ActionStatus::FAILED()->is($this->status);
}
}
58 changes: 58 additions & 0 deletions app/Actions/Models/BaseAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

declare(strict_types=1);

namespace App\Actions\Models;

use App\Actions\ActionResult;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Str;

/**
* Class BaseAction.
*
* @template TModel of \App\Models\BaseModel
*/
abstract class BaseAction
{
/**
* Create a new action instance.
*
* @param TModel $model
*/
public function __construct(protected BaseModel $model)
{
}

/**
* Handle action.
*
* @return ActionResult
*/
abstract public function handle(): ActionResult;

/**
* Get the model the action is handling.
*
* @return TModel
*/
abstract protected function getModel(): BaseModel;

/**
* Get the relation to resources.
*
* @return Relation
*/
abstract protected function relation(): Relation;

/**
* Get the human-friendly label for the underlying model.
*
* @return string
*/
protected function label(): string
{
return Str::headline(class_basename($this->getModel()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@

declare(strict_types=1);

namespace App\Pipes\Wiki\Anime;
namespace App\Actions\Models\Wiki\Anime;

use App\Actions\Models\Wiki\BackfillImageAction;
use App\Models\Wiki\Anime;
use App\Models\Wiki\Image;
use App\Nova\Resources\BaseResource;
use App\Nova\Resources\Wiki\Anime as AnimeResource;
use App\Pipes\Wiki\BackfillImage;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Facades\Log;

/**
* Class BackfillAnimeImage.
* Class BackfillAnimeImageAction.
*
* @extends BackfillImage<Anime>
* @extends BackfillImageAction<Anime>
*/
abstract class BackfillAnimeImage extends BackfillImage
abstract class BackfillAnimeImageAction extends BackfillImageAction
{
/**
* Create a new pipe instance.
* Create a new action instance.
*
* @param Anime $anime
*/
Expand All @@ -30,11 +28,11 @@ public function __construct(Anime $anime)
}

/**
* Get the model passed into the pipeline.
* Get the model the action is handling.
*
* @return Anime
*/
public function getModel(): Anime
protected function getModel(): Anime
{
return $this->model;
}
Expand All @@ -49,16 +47,6 @@ protected function relation(): BelongsToMany
return $this->getModel()->images();
}

/**
* Get the nova resource.
*
* @return class-string<BaseResource>
*/
protected function resource(): string
{
return AnimeResource::class;
}

/**
* Attach Image to Anime.
*
Expand Down
Loading

0 comments on commit 99ec12c

Please sign in to comment.