mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 03:28:28 -07:00
feat: ✨ Added the ability to provide your own custom plex url
This commit is contained in:
parent
d24c390fe4
commit
6c6b7bb498
7 changed files with 95 additions and 3 deletions
|
@ -107,10 +107,40 @@ namespace Ombi.Helpers
|
|||
public static string GetPlexMediaUrl(string machineId, int mediaId)
|
||||
{
|
||||
var url =
|
||||
$"https://app.plex.tv/web/app#!/server/{machineId}/details?key=%2flibrary%2Fmetadata%2F{mediaId}";
|
||||
$"web/app#!/server/{machineId}/details?key=%2flibrary%2Fmetadata%2F{mediaId}";
|
||||
return url;
|
||||
}
|
||||
|
||||
public static string BuildPlexMediaUrl(string savedUrl, string plexHost)
|
||||
{
|
||||
if (savedUrl.Contains("app.plex.tv"))
|
||||
{
|
||||
var split = savedUrl.Split("https://app.plex.tv/", StringSplitOptions.RemoveEmptyEntries);
|
||||
if (split.Length == 1)
|
||||
{
|
||||
savedUrl = split[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException($"Attempt to parse url {savedUrl} and could not");
|
||||
}
|
||||
}
|
||||
if (!plexHost.HasValue())
|
||||
{
|
||||
plexHost = "https://app.plex.tv/";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (plexHost[plexHost.Length - 1] != '/')
|
||||
{
|
||||
plexHost += '/';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $"{plexHost}{savedUrl}";
|
||||
}
|
||||
|
||||
public static ProviderId GetProviderIdsFromMetadata(params string[] guids)
|
||||
{
|
||||
var providerIds = new ProviderId();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue