Removed all legacy plex agents for tv shows as they do not provide unique episode id.
This commit is contained in:
3
FAQ.md
3
FAQ.md
@@ -196,7 +196,7 @@ Flags:
|
||||
|
||||
### Q: Can this tool work with alternative Plex agents?
|
||||
|
||||
#### Supported Agents GUIDs:
|
||||
These are the agents we support for plex media server.
|
||||
|
||||
* plex://(type)/(id) `New Plex Agent`
|
||||
* tvdb://(id) `New Plex Agent`
|
||||
@@ -205,5 +205,4 @@ Flags:
|
||||
* com.plexapp.agents.imdb://(id)?lang=en `(Old plex agents)`
|
||||
* com.plexapp.agents.tmdb://(id)?lang=en `(Old plex agents)`
|
||||
* com.plexapp.agents.themoviedb://(id)?lang=en `(Old plex agents)`
|
||||
* com.plexapp.agents.hama://(db)-(id) `(anime agent parser)`
|
||||
* com.plexapp.agents.xbmcnfo://(id)?lang=en `( xbmc nfo parser agent)`
|
||||
|
||||
@@ -53,12 +53,7 @@ return (function (): array {
|
||||
|
||||
PDO::class => [
|
||||
'class' => function (): PDO {
|
||||
$pdo = new PDO(dsn: Config::get('storage.dsn'), options: [
|
||||
PDO::ATTR_EMULATE_PREPARES => false,
|
||||
PDO::ATTR_STRINGIFY_FETCHES => false,
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
]);
|
||||
$pdo = new PDO(dsn: Config::get('storage.dsn'), options: Config::get('storage.options', []));
|
||||
|
||||
foreach (Config::get('storage.exec', []) as $cmd) {
|
||||
$pdo->exec($cmd);
|
||||
|
||||
@@ -45,13 +45,11 @@ class PlexServer implements ServerInterface
|
||||
'anidb' => Guid::GUID_ANIDB,
|
||||
];
|
||||
|
||||
protected const DISABLED_GUID_AGENTS = [
|
||||
'local',
|
||||
'com.plexapp.agents.none',
|
||||
'com.plexapp.agents.tvdb',
|
||||
'com.plexapp.agents.thetvdb',
|
||||
'com.plexapp.agents.tvmaze',
|
||||
'com.plexapp.agents.xbmcnfotv',
|
||||
protected const SUPPORTED_LEGACY_AGENTS = [
|
||||
'com.plexapp.agents.imdb',
|
||||
'com.plexapp.agents.tmdb',
|
||||
'com.plexapp.agents.themoviedb',
|
||||
'com.plexapp.agents.xbmcnfo',
|
||||
];
|
||||
|
||||
protected const WEBHOOK_ALLOWED_TYPES = [
|
||||
@@ -1502,36 +1500,19 @@ class PlexServer implements ServerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse old Plex Content Agents
|
||||
*
|
||||
* Parse old Plex Content Agents, Supported Agents:
|
||||
* @param string $agent
|
||||
*
|
||||
* @see SUPPORTED_LEGACY_AGENTS
|
||||
* @return string
|
||||
*/
|
||||
private function parseLegacyAgents(string $agent): string
|
||||
{
|
||||
/**
|
||||
* Example of old plex agents.
|
||||
*
|
||||
* com.plexapp.agents.imdb://(id)?lang=en
|
||||
* com.plexapp.agents.tmdb://(id)?lang=en
|
||||
* com.plexapp.agents.themoviedb://(id)?lang=en
|
||||
* com.plexapp.agents.hama://(db)-(id)
|
||||
* com.plexapp.agents.xbmcnfo://(id)?lang=xn > imdb
|
||||
* @Disabled For:
|
||||
* local://(id)
|
||||
* com.plexapp.agents.none://(gid)?lang=en
|
||||
* com.plexapp.agents.tvdb://(show-id)/(season)/(episode)?lang=en
|
||||
* com.plexapp.agents.thetvdb://(show-id)/(season)/(episode)?lang=en
|
||||
* com.plexapp.agents.tvmaze://(show-id)/(season)/(episode))?lang=en
|
||||
* com.plexapp.agents.xbmcnfotv://(show-id)/(season)/(episode)?lang=xn
|
||||
*/
|
||||
|
||||
if (true === in_array(before($agent, '://'), self::DISABLED_GUID_AGENTS)) {
|
||||
try {
|
||||
if (false === in_array(before($agent, '://'), self::SUPPORTED_LEGACY_AGENTS)) {
|
||||
return $agent;
|
||||
}
|
||||
|
||||
try {
|
||||
$replacer = [
|
||||
'com.plexapp.agents.themoviedb://' => 'com.plexapp.agents.tmdb://',
|
||||
'com.plexapp.agents.xbmcnfo://' => 'com.plexapp.agents.imdb://',
|
||||
@@ -1539,12 +1520,6 @@ class PlexServer implements ServerInterface
|
||||
|
||||
$agent = str_replace(array_keys($replacer), array_values($replacer), $agent);
|
||||
|
||||
if (true === str_contains($agent, 'hama://')) {
|
||||
if (1 === preg_match('/(.+)-(.+)/', afterLast($agent, 'hama://'), $matches)) {
|
||||
return $matches[1] . '://' . before($matches[2], '?');
|
||||
}
|
||||
}
|
||||
|
||||
$id = afterLast($agent, 'agents.');
|
||||
$agentGuid = explode('://', $id);
|
||||
$agent = $agentGuid[0];
|
||||
|
||||
Reference in New Issue
Block a user