mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 02:01:33 +00:00
Use marcreichel/igdb-laravel for igdb lookups
This commit is contained in:
+19
-23
@@ -10,10 +10,11 @@ use App\Models\GamesInfo;
|
||||
use Illuminate\Support\Carbon;
|
||||
use DBorsatto\GiantBomb\Client;
|
||||
use DBorsatto\GiantBomb\Config;
|
||||
use Messerli90\IGDB\Facades\IGDB;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use MarcReichel\IGDBLaravel\Models\Company;
|
||||
use MarcReichel\IGDBLaravel\Models\Game;
|
||||
|
||||
/**
|
||||
* Class Games.
|
||||
@@ -569,15 +570,13 @@ class Games
|
||||
}
|
||||
}
|
||||
|
||||
if (now() > $this->igdbSleep) {
|
||||
$this->igdbSleep = null;
|
||||
}
|
||||
if ($this->igdbSleep === null && config('services.igdb.key') !== '') {
|
||||
|
||||
if (config('services.igdb.key') !== '') {
|
||||
try {
|
||||
if ($steamGameID === false || $this->_gameResults === false) {
|
||||
$bestMatch = false;
|
||||
$this->_classUsed = 'IGDB';
|
||||
$result = IGDB::searchGames($gameInfo['title']);
|
||||
$result = Game::search($gameInfo['title']);
|
||||
if (! empty($result)) {
|
||||
foreach ($result as $res) {
|
||||
similar_text(strtolower($gameInfo['title']), strtolower($res->name), $percent);
|
||||
@@ -586,23 +585,20 @@ class Games
|
||||
}
|
||||
}
|
||||
if ($bestMatch !== false) {
|
||||
$this->_gameResults = IGDB::getGame($bestMatch, [
|
||||
'id',
|
||||
'name',
|
||||
'first_release_date',
|
||||
'aggregated_rating',
|
||||
'summary',
|
||||
'cover',
|
||||
'url',
|
||||
'screenshots',
|
||||
'publishers',
|
||||
$this->_gameResults = Game::with([
|
||||
'cover' => ['url'],
|
||||
'screenshots' => ['url'],
|
||||
'involved_companies' => ['company', 'publisher'],
|
||||
'themes',
|
||||
]);
|
||||
])->where('id', $bestMatch)->first();
|
||||
|
||||
$publishers = [];
|
||||
if (! empty($this->_gameResults->publishers)) {
|
||||
foreach ($this->_gameResults->publishers as $publisher) {
|
||||
$publishers[] = IGDB::getCompany($publisher)->name;
|
||||
if (! empty($this->_gameResults->involved_companies)) {
|
||||
foreach ($this->_gameResults->involved_companies as $publisher) {
|
||||
if ($publisher->publisher === true) {
|
||||
$company = Company::find($publisher);
|
||||
$publishers[] = $company->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -610,7 +606,7 @@ class Games
|
||||
|
||||
if (! empty($this->_gameResults->themes)) {
|
||||
foreach ($this->_gameResults->themes as $theme) {
|
||||
$genres[] = IGDB::getTheme($theme)->name;
|
||||
$genres[] = $theme->name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,7 +614,7 @@ class Games
|
||||
|
||||
$releaseDate = now()->format('Y-m-d');
|
||||
if (isset($this->_gameResults->first_release_date) && ! preg_match('/(TBA|TBD)/i', $this->_gameResults->first_release_date)) {
|
||||
$releaseDate = Carbon::createFromTimestamp(substr($this->_gameResults->first_release_date, 0, -3))->format('Y-m-d');
|
||||
$releaseDate = $this->_gameResults->first_release_date->format('Y-m-d');
|
||||
}
|
||||
|
||||
$game = [
|
||||
@@ -629,7 +625,7 @@ class Games
|
||||
'releasedate' => $releaseDate,
|
||||
'esrb' => isset($this->_gameResults->aggregated_rating) ? round($this->_gameResults->aggregated_rating).'%' : 'Not Rated',
|
||||
'url' => $this->_gameResults->url ?? '',
|
||||
'backdropurl' => isset($this->_gameResults->screenshots) ? 'https:'.$this->_gameResults->screenshots[0]->url : '',
|
||||
'backdropurl' => isset($this->_gameResults->screenshots) ? 'https:'. str_replace('t_thumb', 't_cover_big', $this->_gameResults->screenshots[0]->url) : '',
|
||||
'publisher' => ! empty($publishers) ? implode(',', $publishers) : 'Unknown',
|
||||
];
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
2019-09-09 DariusIII
|
||||
* Chg: Use marcreichel/igdb-laravel for igdb lookups
|
||||
2019-09-08 DariusIII
|
||||
* Chg: Update used libraries to their latest versions
|
||||
2019-09-05 DariusIII
|
||||
|
||||
+2
-3
@@ -127,8 +127,8 @@
|
||||
"laravel/tinker": "~1.0",
|
||||
"laravelcollective/html": "^5.7",
|
||||
"league/climate": "^3.4",
|
||||
"marcreichel/igdb-laravel": "^0.9.0",
|
||||
"mayconbordin/l5-fixtures": "dev-master",
|
||||
"messerli90/igdb": "^1.0",
|
||||
"mhor/php-mediainfo": "^4.1",
|
||||
"monolog/monolog": "^1.22",
|
||||
"nesbot/carbon": "^2.14",
|
||||
@@ -187,8 +187,7 @@
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"Blacklight\\build\\ComposerScripts::postUpdate",
|
||||
"@php artisan ide-helper:generate --ansi",
|
||||
"@php artisan ide-helper:meta --ansi"
|
||||
"@php artisan ide-helper:generate --ansi"
|
||||
],
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
|
||||
Generated
+55
-49
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6afdd21805d8c789bd748873c8d3207c",
|
||||
"content-hash": "175c8c2c81a56b9682b9529de6e1b2e7",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aharen/omdbapi",
|
||||
@@ -3399,6 +3399,60 @@
|
||||
],
|
||||
"time": "2019-05-10T02:16:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "marcreichel/igdb-laravel",
|
||||
"version": "v0.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/marcreichel/igdb-laravel.git",
|
||||
"reference": "8b69c544305bb0cc3725f52ecbbc1ffd1e6f7b52"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/marcreichel/igdb-laravel/zipball/8b69c544305bb0cc3725f52ecbbc1ffd1e6f7b52",
|
||||
"reference": "8b69c544305bb0cc3725f52ecbbc1ffd1e6f7b52",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"guzzlehttp/guzzle": "~6.0",
|
||||
"laravel/framework": "5.8.*",
|
||||
"php": "^7.1.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"MarcReichel\\IGDBLaravel\\IGDBLaravelServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"MarcReichel\\IGDBLaravel\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marc Reichel",
|
||||
"email": "mail@marcreichel.de"
|
||||
}
|
||||
],
|
||||
"description": "A Laravel Wrapper for the IGDB API v3",
|
||||
"keywords": [
|
||||
"api-wrapper",
|
||||
"apicalypse",
|
||||
"igdb",
|
||||
"igdb-api",
|
||||
"laravel",
|
||||
"wrapper"
|
||||
],
|
||||
"time": "2019-07-10T11:15:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "maxmind-db/reader",
|
||||
"version": "v1.4.1",
|
||||
@@ -3566,54 +3620,6 @@
|
||||
],
|
||||
"time": "2018-09-18T11:11:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "messerli90/igdb",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/messerli90/igdb.git",
|
||||
"reference": "e93008753261e0c824589243916415eb5947baec"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/messerli90/igdb/zipball/e93008753261e0c824589243916415eb5947baec",
|
||||
"reference": "e93008753261e0c824589243916415eb5947baec",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"php": ">=5.6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"illuminate/support": ">= 5.0",
|
||||
"phpunit/phpunit": "~5.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Messerli90\\IGDB\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Messerli",
|
||||
"email": "michaelamesserli@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Laravel PHP Facade/Wrapper for the IGDB API",
|
||||
"keywords": [
|
||||
"api",
|
||||
"gaming",
|
||||
"igdb",
|
||||
"laravel",
|
||||
"messerli90"
|
||||
],
|
||||
"time": "2017-08-06T17:14:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mhor/php-mediainfo",
|
||||
"version": "4.1.2",
|
||||
|
||||
@@ -164,7 +164,6 @@ return [
|
||||
App\Providers\TelescopeServiceProvider::class,
|
||||
Jrean\UserVerification\UserVerificationServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
Messerli90\IGDB\IGDBServiceProvider::class,
|
||||
App\Providers\UserServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
* This is the API Token you got from https://api.igdb.com
|
||||
*/
|
||||
'api_token' => env('IGDB_KEY', ''),
|
||||
|
||||
/*
|
||||
* This package caches queries automatically.
|
||||
* Here you can set how long (in seconds) each query should be cached (by
|
||||
* default).
|
||||
*
|
||||
* To turn cache off set this value to 0
|
||||
*/
|
||||
'cache_lifetime' => env('IGDB_CACHE_LIFETIME', 3600),
|
||||
|
||||
/*
|
||||
* This is the per-page limit for your tier ("Free" by default)
|
||||
* Adjust this to 500 if you are on the "Pro" tier or in the Partner Program
|
||||
* or to 5000 if you are in the "Enterprise" tier.
|
||||
*/
|
||||
'per_page_limit' => 50,
|
||||
|
||||
/*
|
||||
* This is the offset limit for your tier ("Free" by default)
|
||||
* Adjust this to 5000 if you are on the "Pro" tier or in the Partner Program
|
||||
* or to 0 (to turn it off) if you are in the "Enterprise" tier.
|
||||
*/
|
||||
'offset_limit' => 150,
|
||||
];
|
||||
Reference in New Issue
Block a user