Permalink
Browse files

Remove Discogs additions to artist name

  • Loading branch information...
Thoulah committed Aug 29, 2018
1 parent db17c21 commit 2189930b567f78bc4682f498f2c0102e1f70b17f
View
@@ -15,7 +15,7 @@
"yiisoft/yii2-swiftmailer": "*",
"yiisoft/yii2-httpclient": "^2.0",
"yiisoft/yii2-jui": "^2.0",
"twbs/bootstrap": "4.1.1 as 3.0.3",
"twbs/bootstrap": "4.1.2 as 3.0.3",
"bower-asset/fontawesome": "^5.0",
"bower-asset/jqueryui-timepicker-addon": "^1.6",
"bower-asset/to-markdown": "^3.0",
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -20,7 +20,7 @@
'css' => [],
],
'yii\bootstrap4\BootstrapPluginAsset' => [
'js' => [YII_DEBUG ? 'js/bootstrap.js' : 'js/bootstrap.min.js'],
'js' => [YII_DEBUG ? 'js/bootstrap.bundle.js' : 'js/bootstrap.bundle.min.js'],
],
'yii\jui\JuiAsset' => [
'css' => [YII_DEBUG ? 'themes/smoothness/jquery-ui.css' : 'themes/smoothness/jquery-ui.min.css'],
@@ -1,6 +1,7 @@
<?php
namespace app\controllers;
use Yii;
use app\models\Image;
use app\models\music\Collection;
class MusicController extends \yii\web\Controller {
@@ -12,6 +13,11 @@ public function actionCollection() {
public function actionCollectionCover(int $id) {
$album = Collection::find()->where(['id' => $id])->one();
if (!$album || !$album->image) :
$image = file_get_contents(Yii::getAlias('@assetsroot/images/nocdcover.png'));
return Yii::$app->response->sendContentAsFile($image, 'nocdcover.png', ['mimeType' => 'image/png', 'inline' => true]);
endif;
return Yii::$app->response->sendContentAsFile($album->image, "{$id}.jpg", ['mimeType' => 'image/jpeg', 'inline' => true]);
}
}
@@ -19,19 +19,21 @@ public function saveCollection(int $user, array $data): array {
$collectionItem->id = (int) ArrayHelper::getValue($item, 'basic_information.id');
$collectionItem->user_id = $user;
$collectionItem->artist = ArrayHelper::getValue($item, 'basic_information.artists.0.name');
$collectionItem->artist = trim(preg_replace('/\([0-9]+\)/', '', ArrayHelper::getValue($item, 'basic_information.artists.0.name')));
$collectionItem->year = (int) ArrayHelper::getValue($item, 'basic_information.year');
$collectionItem->title = ArrayHelper::getValue($item, 'basic_information.title');
if ($insert) :
$collectionItem->image = null;
if ($image = ArrayHelper::getValue($item, 'basic_information.cover_image')) :
$img = Webrequest::getUrl($image, '');
$collectionItem->image = Image::resize($img->content, 250);
if ($img = Image::resize($img->content, 250)) :
$collectionItem->image = $img;
endif;
endif;
endif;
$collectionItem->save();
endforeach;
return $id;
return $id ?? [];
}
}
Oops, something went wrong.

0 comments on commit 2189930

Please sign in to comment.