jellyfin / TMDbLib

C#.Net library for TheMovieDB
MIT License
344 stars 128 forks source link

Problems with Credits #364

Closed WolfgangRoggen closed 3 years ago

WolfgangRoggen commented 3 years ago

Hi,

if i have a look at the API I found that GetCredits will return a structure like: cast adult gender id known_for_department name original_name popularity profile_path cast_id character credit_id order crew adult gender id known_for_department name original_name popularity profile_path credit_id department job

But in your Lib i yound, GetMovieCredits(...) will return

    public class Credits
    {
        [JsonProperty("cast")]
        public List<Cast> Cast { get; set; }

        [JsonProperty("crew")]
        public List<Crew> Crew { get; set; }

        [JsonProperty("id")]
        public int Id { get; set; }
    }

where Cast is defined in namespace TMDbLib.Objects.Movies as

    public class Cast
    {
        [JsonProperty("cast_id")]
        public int CastId { get; set; }

        [JsonProperty("character")]
        public string Character { get; set; }

        [JsonProperty("credit_id")]
        public string CreditId { get; set; }

        [JsonProperty("id")]
        public int Id { get; set; }

        [JsonProperty("name")]
        public string Name { get; set; }

        [JsonProperty("order")]
        public int Order { get; set; }

        [JsonProperty("profile_path")]
        public string ProfilePath { get; set; }

        [JsonProperty("gender")]
        public PersonGender Gender { get; set; }
    }

As you can see, the Classes are different. (same for crew)

Please have a look.

Thx Wolfgang

LordMike commented 3 years ago

I can see that there are 4 new properties, and that they're also (luckily) available on other endpoints related to Credits.

adult, known_for_department, original_name, popularity

WolfgangRoggen commented 3 years ago

Yes, and furthermore:

    // to BaseClass
    [JsonProperty("name")]
    public string Name { get; set; }

    [JsonProperty("profile_path")]
    public string ProfilePath { get; set; }

    [JsonProperty("gender")]
    public PersonGender Gender { get; set; }

    // Added
    [JsonProperty("adult")]
    public bool Adult { get; set; }

    [JsonProperty("known_for_department")]
    public string KnownForDepartment { get; set; }

    [JsonProperty("original_name")]
    public string OriginalName { get; set; }

    [JsonProperty("popularity")]
    public double Popularity { get; set; }

the properties above can be put into a baseclass (and as far as I can see it is what you prefer)

LordMike commented 3 years ago

There are many objects in TMDb that are similar, but not quite - for these two, I think I'll stick without base classes.

I've been burned before by having base classes, where I had to reneg on having properties in bases at all, as they suddenly deviated. While testing for this, I also found a few other cases where more properties exist - so I may have to find a more generic way to rework the objects.. Maybe they can be generated from a spec.

WolfgangRoggen commented 3 years ago

I've checked your code. You changed TMDbLib.Objects.General.Crew but TMDbLib.Objects.Movies.Cast is stil wrong