Dropped support for plex youtube agent in favor of our own ytinforeader agent. it does not need so many workarounds to get to work.

This commit is contained in:
abdulmohsen
2023-12-18 19:43:04 +03:00
parent 159d5011bc
commit 01aa440417
3 changed files with 11 additions and 50 deletions

15
FAQ.md
View File

@@ -236,10 +236,11 @@ $ mv /config/db/watchstate_v01-repaired.db /config/db/watchstate_v01.db
* com.plexapp.agents.xbmcnfo://(id)?lang=en `(XBMC NFO Movies agent)` * com.plexapp.agents.xbmcnfo://(id)?lang=en `(XBMC NFO Movies agent)`
* com.plexapp.agents.xbmcnfotv://(id)?lang=en `(XBMC NFO TV agent)` * com.plexapp.agents.xbmcnfotv://(id)?lang=en `(XBMC NFO TV agent)`
* com.plexapp.agents.hama://(db)\d?-(id)?lang=en `(HAMA multi source db agent mainly for anime)` * com.plexapp.agents.hama://(db)\d?-(id)?lang=en `(HAMA multi source db agent mainly for anime)`
* com.plexapp.agents.youtube://youtube|(seriesId)|(?<folder>\w)?/(?<season> * com.plexapp.agents.ytinforeader://(id)
\d)?(.+) [YouTube-Agent.bundle](https://github.com/ZeroQI/YouTube-Agent.bundle) ?lang=en [ytinforeader.bundle](https://github.com/arabcoders/plex-ytdlp-info-reader-agent)
With [jp_scanner.py](https://gist.github.com/arabcoders/ecb2755aa1d76dc89301ec44b8d367d5) as scanner. With [jp_scanner.py](https://gist.github.com/arabcoders/ecb2755aa1d76dc89301ec44b8d367d5) as scanner.
* com.plexapp.agents.cmdb://(id)?(.+) `(Custom metadata db agent)` Will release more information about it at later time. * com.plexapp.agents.cmdb://(id)?lang=en [Custom metadata db agent](https://github.com/arabcoders/cmdb.bundle) User
created metadata database.
--- ---
@@ -544,11 +545,9 @@ make `.info.json` optional However at the moment the file is required for emby/j
#### Plex Setup #### Plex Setup
* Download this agent [YouTube-Agent.bundle](https://github.com/ZeroQI/YouTube-Agent.bundle) please follow the * Download this agent [ytinforeader.bundle](https://github.com/arabcoders/plex-ytdlp-info-reader-agent) please follow
instructions on how to install it from the link itself. the instructions on how to install it from the link itself. It's important to use the specified scanner otherwise the
* Download my custom scanner [jp_scanner.py](https://gist.github.com/arabcoders/ecb2755aa1d76dc89301ec44b8d367d5) and syncing will not work.
save it into `[...]/Plex Media Server/Scanners/Series/jp_scanner.py` if you don't know there are more detailed guide
at this link [How to install a Scanner](https://github.com/ZeroQI/Absolute-Series-Scanner#install--update).
#### Jellyfin Setup #### Jellyfin Setup

View File

@@ -82,7 +82,7 @@ class PlexClient implements iClient
'com.plexapp.agents.xbmcnfotv', 'com.plexapp.agents.xbmcnfotv',
'com.plexapp.agents.thetvdb', 'com.plexapp.agents.thetvdb',
'com.plexapp.agents.hama', 'com.plexapp.agents.hama',
'com.plexapp.agents.youtube', 'com.plexapp.agents.ytinforeader',
'com.plexapp.agents.cmdb', 'com.plexapp.agents.cmdb',
'tv.plex.agents.movie', 'tv.plex.agents.movie',
'tv.plex.agents.series', 'tv.plex.agents.series',

View File

@@ -22,7 +22,7 @@ final class PlexGuid implements iGuid
'tvmaze' => Guid::GUID_TVMAZE, 'tvmaze' => Guid::GUID_TVMAZE,
'tvrage' => Guid::GUID_TVRAGE, 'tvrage' => Guid::GUID_TVRAGE,
'anidb' => Guid::GUID_ANIDB, 'anidb' => Guid::GUID_ANIDB,
'youtube' => Guid::GUID_YOUTUBE, 'ytinforeader' => Guid::GUID_YOUTUBE,
'cmdb' => Guid::GUID_CMDB, 'cmdb' => Guid::GUID_CMDB,
]; ];
@@ -37,7 +37,7 @@ final class PlexGuid implements iGuid
'com.plexapp.agents.xbmcnfotv', 'com.plexapp.agents.xbmcnfotv',
'com.plexapp.agents.thetvdb', 'com.plexapp.agents.thetvdb',
'com.plexapp.agents.hama', 'com.plexapp.agents.hama',
'com.plexapp.agents.youtube', 'com.plexapp.agents.ytinforeader',
'com.plexapp.agents.cmdb', 'com.plexapp.agents.cmdb',
]; ];
@@ -149,8 +149,7 @@ final class PlexGuid implements iGuid
if (true === str_starts_with($val, 'com.plexapp.agents.')) { if (true === str_starts_with($val, 'com.plexapp.agents.')) {
// -- DO NOT accept plex relative unique ids, we generate our own. // -- DO NOT accept plex relative unique ids, we generate our own.
// -- exception for youtube agent, as it is a mess. if (substr_count($val, '/') >= 3) {
if (false === str_contains($val, '.youtube') && substr_count($val, '/') >= 3) {
continue; continue;
} }
@@ -271,43 +270,6 @@ final class PlexGuid implements iGuid
} }
try { try {
/**
* YouTube agent IDs are a mess, and hard to parse, so we have to use fallback system,
* series id usually looks like
* com.plexapp.agents.youtube://youtube|UCIfuY0NRq1szr_6tzFy23NF|Season 2022?lang=xn
* and season looks like
* com.plexapp.agents.youtube://youtube|UCIfuY0NRq1szr_6tzFy23NF|Season 2023/2015?lang=xn
* and episodes looks like
* com.plexapp.agents.youtube://youtube|UCIfuY0NRq1szr_6tzFy23NF|Season 2022/2018/1102421482?lang=xn
*
* So the order of parsing is from episode to channel.
*/
if (true === str_starts_with($guid, 'com.plexapp.agents.youtube')) {
$af = after($guid, '://');
// -- Check for episode id.
$iRegex = '/^youtube\|(?<channel>PL[^\[\]]{16}|PL[^\[\]]{32}|(UC|HC|UU|FL|LP|RD)[^\[\]]{22})(?<folder>\|?.+)\/(?<season>\d+)\/(?<episode>\d+)\?.+$/is';
if (1 === preg_match($iRegex, $af, $matches)) {
return r('{agent}://{channel}/{season}/{episode}', [
'agent' => 'youtube',
'channel' => ag($matches, 'channel'),
'season' => ag($matches, 'season'),
'episode' => ag($matches, 'episode'),
]);
}
// -- fallback to channel if episode match fails.
$pRegex = '/^youtube\|(?<channel>PL[^\[\]]{32}|PL[^\[\]]{16}|(UC|HC|UU|FL|LP|RD)[^\[\]]{22})(?<folder>\|?.+)?/is';
if (1 === preg_match($pRegex, $af, $matches)) {
return r('{agent}://{channel}', [
'agent' => 'youtube',
'channel' => ag($matches, 'channel'),
]);
}
return $guid;
}
// -- Handle hama plex agent. This is multi source agent. // -- Handle hama plex agent. This is multi source agent.
if (true === str_starts_with($guid, 'com.plexapp.agents.hama')) { if (true === str_starts_with($guid, 'com.plexapp.agents.hama')) {
$hamaRegex = '/(?P<source>(anidb|tvdb|tmdb|tsdb|imdb))\d?-(?P<id>[^\[\]]*)/'; $hamaRegex = '/(?P<source>(anidb|tvdb|tmdb|tsdb|imdb))\d?-(?P<id>[^\[\]]*)/';