jensenkd / plex-api

.NET Core SDK for Plex Media Server
MIT License
86 stars 27 forks source link

ExternalProviderInfo - Doesnt need setter #12

Closed bakes82 closed 3 years ago

bakes82 commented 4 years ago

Can this just be a getter or check for null ;) ?

There is an error when you try to make a class inherit the Metadata class

Newtonsoft.Json.JsonSerializationException: Error setting value to 'ExternalProviderInfo' on 'PlexApps.Dto.PlexShowDto'. System.ArgumentNullException: Value cannot be null. (Parameter 'input')

public string ExternalProviderInfo
    {
      get
      {
        return (string) null;
      }
      set
      {
        Match match = Regex.Match(value, "\\.(?<provider>[a-z]+)://(?<id>[^\\?]+)");
        this.Guid = value;
        this.ExternalProvider = match.Groups["provider"].Value;
        this.ExternalProviderId = match.Groups["id"].Value;
      }
    }

public class PlexShowDto : Metadata
    {
        public List<PlexSeasonDto> PlexSeasons { get; set; }
    }

public class PlexSeasonDto : Metadata
    {
        public List<Metadata> PlexEpisodes { get; set; }
    }
jensenkd commented 3 years ago

This is all revamped due to the changes Plex made to their api