347 lines
13 KiB
PHP
347 lines
13 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace App\Console\Commands;
|
||
|
|
||
|
use Illuminate\Console\Command;
|
||
|
use App\Models\Artwork;
|
||
|
use App\Models\Episode;
|
||
|
use App\Models\Artist;
|
||
|
use App\Models\Podcast;
|
||
|
use Illuminate\Support\Facades\DB;
|
||
|
use Illuminate\Support\Str;
|
||
|
use Illuminate\Support\Facades\Storage;
|
||
|
use Intervention\Image\Facades\Image;
|
||
|
use Carbon\Carbon;
|
||
|
use ImageOptimizer;
|
||
|
|
||
|
class AddMissingV3ArtworksCommand extends Command
|
||
|
{
|
||
|
/**
|
||
|
* The name and signature of the console command.
|
||
|
*
|
||
|
* @var string
|
||
|
*/
|
||
|
protected $signature = 'app:add-missing-v3-artworks-command';
|
||
|
|
||
|
/**
|
||
|
* The console command description.
|
||
|
*
|
||
|
* @var string
|
||
|
*/
|
||
|
protected $description = 'Command description';
|
||
|
|
||
|
/**
|
||
|
* Execute the console command.
|
||
|
*/
|
||
|
public function handle()
|
||
|
{
|
||
|
$missing_artworks = [
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/7e5e1ca05eb622e2.png',
|
||
|
'title' => 'Show Art 1613',
|
||
|
'artist' => 'dirty-jersey-whore',
|
||
|
'artist_id' => 1318,
|
||
|
'episode' => 1613,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/6ac5a1220e954d10.jpg',
|
||
|
'title' => 'No Stinkin\' Title Provided',
|
||
|
'artist' => 'dirty-jersey-whore',
|
||
|
'artist_id' => 1318,
|
||
|
'episode' => 1613,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/eb9c5a07a25db93b.jpg',
|
||
|
'title' => 'McMystery',
|
||
|
'artist' => 'Nessworks',
|
||
|
'artist_id' => 1159,
|
||
|
'episode' => 1614,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/16dce3f9249b42e8.png',
|
||
|
'title' => 'Blinking Red Lights!',
|
||
|
'artist' => 'mountainjay',
|
||
|
'artist_id' => 891,
|
||
|
'episode' => 1614,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/8a6153d61715434b.jpg',
|
||
|
'title' => 'Day One Dictator!',
|
||
|
'artist' => 'matthewdropco1972',
|
||
|
'artist_id' => 1173,
|
||
|
'episode' => 1614,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/bf6322f359b0727f.png',
|
||
|
'title' => 'Vivek\'s Notebook',
|
||
|
'artist' => 'sir-paul-couture',
|
||
|
'artist_id' => 4,
|
||
|
'episode' => 1614,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/81e71a8e2b24874b.jpg',
|
||
|
'title' => 'Plastic Shoes',
|
||
|
'artist' => 'Nessworks',
|
||
|
'artist_id' => 1159,
|
||
|
'episode' => 1614,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/51f16e95c0e86cc9.jpg',
|
||
|
'title' => 'My Transhausen Blewupen',
|
||
|
'artist' => 'francisco-scaramanga',
|
||
|
'artist_id' => 1377,
|
||
|
'episode' => 1614,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/b3b6c7988b5fd7f0.jpeg',
|
||
|
'title' => 'McPartner',
|
||
|
'artist' => 'dame-kenny-ben',
|
||
|
'artist_id' => 1121,
|
||
|
'episode' => 1614,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/c9c52179e5eedc6f.png',
|
||
|
'title' => 'Red Flashing Lights',
|
||
|
'artist' => 'jack-evans',
|
||
|
'artist_id' => 1224,
|
||
|
'episode' => 1614,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/2a29bb2974959b8a.jpg',
|
||
|
'title' => 'Threat Level Swift',
|
||
|
'artist' => 'darren-oneill',
|
||
|
'artist_id' => 756,
|
||
|
'episode' => 1614,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/0ed3c698ba336ea9.jpg',
|
||
|
'title' => 'Blinking Lights',
|
||
|
'artist' => 'matthewdropco1972',
|
||
|
'artist_id' => 1173,
|
||
|
'episode' => 1614,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/04658d1ccb786d26.png',
|
||
|
'title' => 'Deep State University, In The Morning',
|
||
|
'artist' => 'mountainjay',
|
||
|
'artist_id' => 891,
|
||
|
'episode' => 1614,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/61273125525b7861.jpg',
|
||
|
'title' => 'Chad GPT',
|
||
|
'artist' => 'Nessworks',
|
||
|
'artist_id' => 1159,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/479090be93d46fad.jpg',
|
||
|
'title' => 'Chet GPT',
|
||
|
'artist' => 'Nessworks',
|
||
|
'artist_id' => 1159,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/a533697498ad7f75.png',
|
||
|
'title' => 'Word Salad, Roundy Variant',
|
||
|
'artist' => 'comic-strip-blogger',
|
||
|
'artist_id' => 680,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/bcd81059b0440049.png',
|
||
|
'title' => 'word salad (that AI allegedly produces)',
|
||
|
'artist' => 'comic-strip-blogger',
|
||
|
'artist_id' => 680,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/ddfbcc471e4f265f.png',
|
||
|
'title' => 'microphone hand (without show number)',
|
||
|
'artist' => 'comic-strip-blogger',
|
||
|
'artist_id' => 680,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/c11e2b8a88774fca.png',
|
||
|
'title' => 'microphone hand',
|
||
|
'artist' => 'comic-strip-blogger',
|
||
|
'artist_id' => 680,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/f0c08370c93980b8.jpg',
|
||
|
'title' => 'Bye Joe',
|
||
|
'artist' => 'darren-oneill',
|
||
|
'artist_id' => 756,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/9fc5c17fc0ec547e.jpg',
|
||
|
'title' => 'Coof Train',
|
||
|
'artist' => 'darren-oneill',
|
||
|
'artist_id' => 756,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/99e317f0dd6dd10c.jpg',
|
||
|
'title' => 'Comb Your Hair!',
|
||
|
'artist' => 'Nessworks',
|
||
|
'artist_id' => 1159,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/c579a7ef6ab53869.jpg',
|
||
|
'title' => 'Milgram',
|
||
|
'artist' => 'clip-custodian',
|
||
|
'artist_id' => 1431,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/ba791114371437bc.jpeg',
|
||
|
'title' => '67% are Killers',
|
||
|
'artist' => 'dame-kenny-ben',
|
||
|
'artist_id' => 1121,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/05b40baf17249ea5.jpg',
|
||
|
'title' => 'Garage Sale Find',
|
||
|
'artist' => 'francisco-scaramanga',
|
||
|
'artist_id' => 1377,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/fc626cd5542c71d8.jpg',
|
||
|
'title' => 'NA Show Art',
|
||
|
'artist' => 'monsieur-pierrey',
|
||
|
'artist_id' => 58,
|
||
|
'episode' => 1615,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/2dc17c67400465ad.jpg',
|
||
|
'title' => 'Merry Christmas Ukraine',
|
||
|
'artist' => 'clip-custodian',
|
||
|
'artist_id' => 1431,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/18724b09fd552fc0.jpg',
|
||
|
'title' => 'THE END IS HERE',
|
||
|
'artist' => 'francisco-scaramanga',
|
||
|
'artist_id' => 1377,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/cefbe40e1afdf45c.jpg',
|
||
|
'title' => 'AI Winter is Coming',
|
||
|
'artist' => 'Nessworks',
|
||
|
'artist_id' => 1159,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/045db414cd60cf2a.jpg',
|
||
|
'title' => 'Space Race Force',
|
||
|
'artist' => 'Nessworks',
|
||
|
'artist_id' => 1159,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/f817a154c260076f.png',
|
||
|
'title' => 'No Agenda Verse',
|
||
|
'artist' => 'comic-strip-blogger',
|
||
|
'artist_id' => 680,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/618ddba291dbe349.png',
|
||
|
'title' => 'NA Show Art',
|
||
|
'artist' => 'comic-strip-blogger',
|
||
|
'artist_id' => 680,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/322eda9c9e44933c.jpg',
|
||
|
'title' => 'Chinese Satellite',
|
||
|
'artist' => 'darren-oneill',
|
||
|
'artist_id' => 756,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/2c9ecc0646cc49dc.jpeg',
|
||
|
'title' => 'Naked No Agenda',
|
||
|
'artist' => 'KorrectDaRekard',
|
||
|
'artist_id' => 1021,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/96ba274872584092.jpg',
|
||
|
'title' => 'NA Show Art',
|
||
|
'artist' => 'matthewdropco1972',
|
||
|
'artist_id' => 1173,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/af8ab3953ba21524.jpg',
|
||
|
'title' => 'False Idols',
|
||
|
'artist' => 'matt-boisvert',
|
||
|
'artist_id' => 1368,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/ec5e76093063d663.jpg',
|
||
|
'title' => 'Collect Them All!',
|
||
|
'artist' => 'matt-boisvert',
|
||
|
'artist_id' => 1368,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/c28ec70cfd544c9b.jpg',
|
||
|
'title' => 'Santa\'s New List',
|
||
|
'artist' => 'matt-boisvert',
|
||
|
'artist_id' => 1368,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
[
|
||
|
'url' => 'https://noagenda.dev/old/img/6d228246fb744cb7.jpg',
|
||
|
'title' => 'Christmas is Coming',
|
||
|
'artist' => 'matt-boisvert',
|
||
|
'artist_id' => 1368,
|
||
|
'episode' => 1616,
|
||
|
],
|
||
|
];
|
||
|
foreach ($missing_artworks as $art) {
|
||
|
$artist = Artist::find($art['artist_id']);
|
||
|
$episode = Episode::where('episode_number', $art['episode'])->first();
|
||
|
$this->line('Artist: ' . $artist->slug);
|
||
|
$this->line('Episode: ' . $episode->episode_date->format('Y-m-d'));
|
||
|
$artwork = new Artwork;
|
||
|
$artwork->title = $art['title'];
|
||
|
$artwork->artist_id = $artist->id;
|
||
|
$artwork->created_at = $episode->episode_date->format('Y-m-d ' . now()->format('H:i:s'));
|
||
|
$artwork->updated_at = $episode->episode_date->format('Y-m-d ' . now()->format('H:i:s'));
|
||
|
$artwork->episode_id = $episode->id;
|
||
|
$artwork->podcast_id = 1;
|
||
|
$artwork->approved_by = 4;
|
||
|
$basename = $episode->episode_date->format('Y/m/')
|
||
|
. Str::slug($artist->name)
|
||
|
. '_'
|
||
|
. Str::slug($art['title'])
|
||
|
. '_'
|
||
|
. Str::random(8)
|
||
|
. '.jpg';
|
||
|
$artwork->filename = $basename;
|
||
|
$artwork->save();
|
||
|
$filename = 'artworks/' . $basename;
|
||
|
$thumbnailName = 'thumbnails/' . $basename;
|
||
|
$this->line($basename);
|
||
|
$img = Image::make(file_get_contents($art['url']))->resize(3000, 3000)->encode('jpg', 100);
|
||
|
$thumbImg = Image::make(file_get_contents($art['url']))->resize(512, 512)->encode('jpg', 100);
|
||
|
$imgLocation = Storage::disk('static')->put($filename, $img);
|
||
|
$thumbLocation = Storage::disk('static')->put($thumbnailName, $thumbImg);
|
||
|
ImageOptimizer::optimize(Storage::disk('static')->path($filename));
|
||
|
ImageOptimizer::optimize(Storage::disk('static')->path($thumbnailName));
|
||
|
}
|
||
|
}
|
||
|
}
|