mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-01-10 15:07:53 +00:00
generate keywords based on content extensions
This commit is contained in:
parent
07262f4486
commit
bd7fe4cf04
@ -249,6 +249,7 @@ class TorrentController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate keywords
|
// Generate keywords
|
||||||
|
/* @TODO deprecated, based on active search result
|
||||||
$keywords = [];
|
$keywords = [];
|
||||||
foreach ($torrent->getKeywords() as $keyword)
|
foreach ($torrent->getKeywords() as $keyword)
|
||||||
{
|
{
|
||||||
@ -257,7 +258,22 @@ class TorrentController extends AbstractController
|
|||||||
$keywords[] = $keyword;
|
$keywords[] = $keyword;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Generate keywords by extension
|
||||||
|
$keywords = [];
|
||||||
|
foreach ($file->getFileList() as $item)
|
||||||
|
{
|
||||||
|
if ($keyword = pathinfo($item['path'], PATHINFO_EXTENSION))
|
||||||
|
{
|
||||||
|
$keywords[] = mb_strtolower($keyword);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$keywords = array_unique($keywords);
|
||||||
|
|
||||||
|
sort($keywords);
|
||||||
|
|
||||||
|
// Push torrent
|
||||||
$torrents[] =
|
$torrents[] =
|
||||||
[
|
[
|
||||||
'id' => $torrent->getId(),
|
'id' => $torrent->getId(),
|
||||||
@ -383,17 +399,20 @@ class TorrentController extends AbstractController
|
|||||||
throw $this->createNotFoundException(); // @TODO exception
|
throw $this->createNotFoundException(); // @TODO exception
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate keywords
|
// Generate keywords by extension
|
||||||
$keywords = [];
|
$keywords = [];
|
||||||
$query = explode(' ', mb_strtolower(urldecode($request->query->get('query'))));
|
foreach ($file->getFileList() as $item)
|
||||||
foreach ($torrent->getKeywords() as $keyword)
|
|
||||||
{
|
{
|
||||||
if (in_array($keyword, $query))
|
if ($keyword = pathinfo($item['path'], PATHINFO_EXTENSION))
|
||||||
{
|
{
|
||||||
$keywords[] = urlencode($keyword);
|
$keywords[] = mb_strtolower($keyword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$keywords = array_unique($keywords);
|
||||||
|
|
||||||
|
sort($keywords);
|
||||||
|
|
||||||
|
// Push torrent
|
||||||
$torrents[] =
|
$torrents[] =
|
||||||
[
|
[
|
||||||
'id' => $torrent->getId(),
|
'id' => $torrent->getId(),
|
||||||
|
Loading…
Reference in New Issue
Block a user