mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Add IGDB for PC games lookup
This commit is contained in:
@@ -110,3 +110,5 @@ SMARTY_FORCE_COMPILE=false
|
||||
SMARTY_CACHE_DRIVER=file
|
||||
|
||||
FIREWALL_ENABLED=true
|
||||
|
||||
IGDB_KEY=
|
||||
|
||||
+58
-3
@@ -12,6 +12,7 @@ use DBorsatto\GiantBomb\Client;
|
||||
use DBorsatto\GiantBomb\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Messerli90\IGDB\Facades\IGDB;
|
||||
|
||||
class Games
|
||||
{
|
||||
@@ -544,9 +545,7 @@ class Games
|
||||
if ($this->_gameResults->original_release_date !== '') {
|
||||
$dateReleased = $this->_gameResults->original_release_date;
|
||||
$date = $dateReleased !== null ? Carbon::createFromFormat('Y-m-d H:i:s', $dateReleased) : now();
|
||||
if ($date instanceof \DateTime) {
|
||||
$game['releasedate'] = (string) $date->format('Y-m-d');
|
||||
}
|
||||
$game['releasedate'] = (string) $date->format('Y-m-d');
|
||||
}
|
||||
|
||||
if ($this->_gameResults->deck !== '') {
|
||||
@@ -565,6 +564,62 @@ class Games
|
||||
}
|
||||
}
|
||||
|
||||
if (env('IGDB_KEY') !== '') {
|
||||
if ($steamGameID === false || $this->_gameResults === false) {
|
||||
$bestMatch = false;
|
||||
$this->_classUsed = 'IGDB';
|
||||
$result = IGDB::searchGames($gameInfo['title']);
|
||||
if (! empty($result)) {
|
||||
foreach ($result as $res) {
|
||||
similar_text(strtolower($gameInfo['title']), strtolower($res->name), $percent);
|
||||
if ($percent >= self::GAME_MATCH_PERCENTAGE) {
|
||||
$bestMatch = $res->id;
|
||||
}
|
||||
}
|
||||
if ($bestMatch !== false) {
|
||||
$this->_gameResults = IGDB::getGame($bestMatch, [
|
||||
'id',
|
||||
'name',
|
||||
'first_release_date',
|
||||
'aggregated_rating',
|
||||
'summary',
|
||||
'cover',
|
||||
'url',
|
||||
'screenshots',
|
||||
'publishers',
|
||||
]);
|
||||
|
||||
$publishers = [];
|
||||
foreach ($this->_gameResults->publishers as $publisher) {
|
||||
|
||||
$publishers[] = IGDB::getCompany($publisher)->name;
|
||||
}
|
||||
|
||||
$game = [
|
||||
'title' => $this->_gameResults->name,
|
||||
'asin' => $this->_gameResults->id,
|
||||
'review' => $this->_gameResults->summary ?? '',
|
||||
'coverurl' => 'https:'.$this->_gameResults->cover->url ?? '',
|
||||
'releasedate' => Carbon::createFromTimestamp(substr($this->_gameResults->first_release_date, 0, -3))->format('Y-m-d') ?? now()->format('Y-m-d'),
|
||||
'esrb' => round($this->_gameResults->aggregated_rating).'%' ?? 'Not Rated',
|
||||
'url' => $this->_gameResults->url ?? '',
|
||||
'backdropurl' => 'https:'.$this->_gameResults->screenshots[0]->url ?? '',
|
||||
'publisher' => ! empty($publishers) ? implode(',', $publishers) : 'Unknown',
|
||||
];
|
||||
} else {
|
||||
ColorCLI::doEcho(ColorCLI::notice('IGDB found no valid results'), true);
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ColorCLI::doEcho(ColorCLI::notice('IGDB found no valid results'), true);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Load genres.
|
||||
$defaultGenres = $gen->loadGenres(Genres::GAME_TYPE);
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
2018-09-14 DariusIII
|
||||
* Chg: Add IGDB for PC games lookup
|
||||
2018-09-13 DariusIII
|
||||
* Chg: Update tiny-mce to latest version
|
||||
* Chg: Update jrean/laravel-user-verification to version 7.0.0
|
||||
|
||||
@@ -151,6 +151,7 @@
|
||||
"laravel/tinker": "~1.0",
|
||||
"laravelcollective/html": "^5.6",
|
||||
"mayconbordin/l5-fixtures": "dev-master",
|
||||
"messerli90/igdb": "^1.0",
|
||||
"monolog/monolog": "^1.22",
|
||||
"nzedb/Git.php": "dev-master",
|
||||
"php-http/guzzle6-adapter": "^1.1",
|
||||
|
||||
Generated
+97
-25
@@ -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": "9b5fcf01653d5163e9d17ea57e79cc2c",
|
||||
"content-hash": "d7e790cca583e2d57488c9bf24bb12ee",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aharen/omdbapi",
|
||||
@@ -257,7 +257,8 @@
|
||||
"Gemfile.lock",
|
||||
"*.md"
|
||||
]
|
||||
}
|
||||
},
|
||||
"time": "2016-06-06T17:37:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/autosize",
|
||||
@@ -286,7 +287,8 @@
|
||||
"form",
|
||||
"textarea",
|
||||
"ui"
|
||||
]
|
||||
],
|
||||
"time": "2017-05-19T15:36:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/bootstrap",
|
||||
@@ -335,7 +337,8 @@
|
||||
"mobile-first",
|
||||
"responsive",
|
||||
"web"
|
||||
]
|
||||
],
|
||||
"time": "2016-07-25T15:51:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/bootstrap-3.x",
|
||||
@@ -384,7 +387,8 @@
|
||||
"mobile-first",
|
||||
"responsive",
|
||||
"web"
|
||||
]
|
||||
],
|
||||
"time": "2016-07-25T15:51:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/bootstrap-datepicker",
|
||||
@@ -413,7 +417,8 @@
|
||||
},
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
]
|
||||
],
|
||||
"time": "2016-08-05T09:50:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/bootstrap-hover-dropdown",
|
||||
@@ -443,7 +448,8 @@
|
||||
"dropdowns",
|
||||
"hover",
|
||||
"twitter"
|
||||
]
|
||||
],
|
||||
"time": "2015-12-01T23:35:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/bootstrap-progressbar",
|
||||
@@ -477,7 +483,8 @@
|
||||
},
|
||||
"license": [
|
||||
"MIT"
|
||||
]
|
||||
],
|
||||
"time": "2015-05-15T18:56:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/bootswatch",
|
||||
@@ -608,7 +615,8 @@
|
||||
"modal",
|
||||
"popup",
|
||||
"ui"
|
||||
]
|
||||
],
|
||||
"time": "2016-05-10T22:21:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/datatables",
|
||||
@@ -723,7 +731,8 @@
|
||||
"tests",
|
||||
"examples"
|
||||
]
|
||||
}
|
||||
},
|
||||
"time": "2015-01-26T21:19:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/flexboxgrid",
|
||||
@@ -759,7 +768,8 @@
|
||||
"css",
|
||||
"flexbox",
|
||||
"grid"
|
||||
]
|
||||
],
|
||||
"time": "2016-08-14T16:43:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/font-awesome",
|
||||
@@ -804,7 +814,8 @@
|
||||
"src",
|
||||
"build.xml"
|
||||
]
|
||||
}
|
||||
},
|
||||
"time": "2015-07-20T20:04:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/icheck",
|
||||
@@ -854,7 +865,8 @@
|
||||
"replacement",
|
||||
"skins",
|
||||
"ui"
|
||||
]
|
||||
],
|
||||
"time": "2014-03-03T17:36:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/jquery",
|
||||
@@ -917,7 +929,8 @@
|
||||
"javascript",
|
||||
"jquery",
|
||||
"library"
|
||||
]
|
||||
],
|
||||
"time": "2016-05-20T17:24:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/jquery-3.2.x",
|
||||
@@ -984,7 +997,8 @@
|
||||
"scroll",
|
||||
"scrolltop",
|
||||
"scrolltotop"
|
||||
]
|
||||
],
|
||||
"time": "2017-08-31T15:51:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/jquery-migrate-1.4.x",
|
||||
@@ -1003,7 +1017,8 @@
|
||||
"type": "bower-asset-library",
|
||||
"extra": {
|
||||
"bower-asset-main": "jquery-migrate.js"
|
||||
}
|
||||
},
|
||||
"time": "2016-04-15T06:38:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/jquery-migrate-3.0.x",
|
||||
@@ -1022,7 +1037,8 @@
|
||||
"type": "bower-asset-library",
|
||||
"extra": {
|
||||
"bower-asset-main": "jquery-migrate.js"
|
||||
}
|
||||
},
|
||||
"time": "2016-06-10T14:28:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/jquery.nicescroll",
|
||||
@@ -1052,7 +1068,8 @@
|
||||
"demo",
|
||||
"package.json"
|
||||
]
|
||||
}
|
||||
},
|
||||
"time": "2016-03-01T20:38:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/material-design-iconic-font",
|
||||
@@ -1091,7 +1108,8 @@
|
||||
"font",
|
||||
"icons",
|
||||
"material"
|
||||
]
|
||||
],
|
||||
"time": "2015-11-08T04:50:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/materialize",
|
||||
@@ -1150,7 +1168,8 @@
|
||||
"responsive",
|
||||
"sass",
|
||||
"ux"
|
||||
]
|
||||
],
|
||||
"time": "2017-04-15T01:39:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/pace",
|
||||
@@ -1196,7 +1215,8 @@
|
||||
"progress",
|
||||
"progress",
|
||||
"spinner"
|
||||
]
|
||||
],
|
||||
"time": "2014-11-06T16:31:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/pnotify",
|
||||
@@ -1248,7 +1268,8 @@
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
"description": "JavaScript notification plugin."
|
||||
"description": "JavaScript notification plugin.",
|
||||
"time": "2017-07-31T21:50:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/respond",
|
||||
@@ -1272,7 +1293,8 @@
|
||||
"test"
|
||||
]
|
||||
},
|
||||
"description": "Fast and lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)"
|
||||
"description": "Fast and lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)",
|
||||
"time": "2013-12-19T04:44:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/responsive-tables-js",
|
||||
@@ -1302,7 +1324,8 @@
|
||||
"jquery",
|
||||
"responsive",
|
||||
"table"
|
||||
]
|
||||
],
|
||||
"time": "2015-10-08T14:18:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/select2",
|
||||
@@ -1370,7 +1393,8 @@
|
||||
"scrolling",
|
||||
"slimscroll",
|
||||
"ui"
|
||||
]
|
||||
],
|
||||
"time": "2016-06-11T09:19:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bower-asset/tinymce-dist",
|
||||
@@ -4311,6 +4335,54 @@
|
||||
],
|
||||
"time": "2018-01-18T09:07:50+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": "monolog/monolog",
|
||||
"version": "1.23.0",
|
||||
|
||||
@@ -164,6 +164,7 @@ return [
|
||||
Way\Generators\GeneratorsServiceProvider::class,
|
||||
Xethron\MigrationsGenerator\MigrationsGeneratorServiceProvider::class,
|
||||
Orangehill\Iseed\IseedServiceProvider::class,
|
||||
Messerli90\IGDB\IGDBServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
@@ -214,6 +215,7 @@ return [
|
||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
'UserVerification' => Jrean\UserVerification\Facades\UserVerification::class,
|
||||
'IGDB' => \Messerli90\IGDB\Facades\IGDB::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -34,5 +34,9 @@ return [
|
||||
'key' => env('STRIPE_KEY'),
|
||||
'secret' => env('STRIPE_SECRET'),
|
||||
],
|
||||
'igdb' => [
|
||||
'key' => env('IGDB_KEY', ''),
|
||||
'url' => 'https://api-endpoint.igdb.com'
|
||||
]
|
||||
|
||||
];
|
||||
|
||||
@@ -95,6 +95,13 @@
|
||||
name="steam{$result->gamesinfo_id}"
|
||||
title="View Steam page">
|
||||
Steam</a>{/if}
|
||||
{if $result->classused == "IGDB"}<a
|
||||
class="label label-default"
|
||||
target="_blank"
|
||||
href="{$site->dereferrer_link}{$result->url}"
|
||||
name="igdb{$result->gamesinfo_id}"
|
||||
title="View IGDB page">
|
||||
IGDB</a>{/if}
|
||||
{if $result->nfoid > 0}<a
|
||||
href="{$smarty.const.WWW_TOP}/nfo/{$result->guid}"
|
||||
title="View NFO" class="modal_nfo label label-default"
|
||||
|
||||
Reference in New Issue
Block a user