mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Got mostly everything working for #254 Ready for testing
This commit is contained in:
parent
131a99b1bb
commit
0699d777d6
7 changed files with 84 additions and 40 deletions
|
@ -26,17 +26,20 @@
|
|||
#endregion
|
||||
|
||||
using System;
|
||||
using NLog;
|
||||
|
||||
namespace PlexRequests.Helpers
|
||||
{
|
||||
public class PlexHelper
|
||||
{
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
public static string GetProviderIdFromPlexGuid(string guid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(guid))
|
||||
return guid;
|
||||
|
||||
var guidSplit = guid.Split(new[] {'/', '?'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
var guidSplit = guid.Split(new[] { '/', '?' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (guidSplit.Length > 1)
|
||||
{
|
||||
return guidSplit[1];
|
||||
|
@ -50,15 +53,23 @@ namespace PlexRequests.Helpers
|
|||
//guid="com.plexapp.agents.thetvdb://269586/2/8?lang=en"
|
||||
if (string.IsNullOrEmpty(guid))
|
||||
return null;
|
||||
|
||||
var guidSplit = guid.Split(new[] { '/', '?' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (guidSplit.Length > 2)
|
||||
try
|
||||
{
|
||||
ep.ProviderId = guidSplit[1];
|
||||
ep.SeasonNumber = int.Parse(guidSplit[2]);
|
||||
ep.EpisodeNumber = int.Parse(guidSplit[3]);
|
||||
var guidSplit = guid.Split(new[] { '/', '?' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (guidSplit.Length > 2)
|
||||
{
|
||||
ep.ProviderId = guidSplit[1];
|
||||
ep.SeasonNumber = int.Parse(guidSplit[2]);
|
||||
ep.EpisodeNumber = int.Parse(guidSplit[3]);
|
||||
}
|
||||
return ep;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
return ep;
|
||||
}
|
||||
return ep;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue