jellyfin / TMDbLib

C#.Net library for TheMovieDB
MIT License
355 stars 132 forks source link

Movie images #66

Closed arvilsm closed 9 years ago

arvilsm commented 9 years ago

Hello, i have been using your API for a while know and i can't solve 1 problem. How can i get images from certain movie? TMDbLib.Objects.Movies.Movie oMDetails = client.GetMovie(mID); public System.Collections.Generic.List ImagesPosters { get; set; } magesPosters = oMDetails.Images.Posters;

I have tried ....General.Image data type and it still did not work. I am receiving this error: System.NullReferenceException: Object reference not set to an instance of an object.

Wonderful api but there is pretty much no documentation

arvilsm commented 9 years ago

Alright, i found a workaround by creating this TMDbLib.Objects.General.ImagesWithId pim = client.GetMovieImages(id); Thanks anyway by creating this great api

LordMike commented 9 years ago

I can concur on the documentation part. But iirc there should be an overload to GetMovie that allows you to specify extra types of data that you want.

It should get you the data you need.

-----Original Message----- From: "arvazzz" notifications@github.com Sent: ‎03-‎05-‎2015 18:41 To: "LordMike/TMDbLib" TMDbLib@noreply.github.com Subject: [TMDbLib] Movie images (#66)

Hello, i have been using your API for a while know and i can't solve 1 problem. How can i get images from certain movie? TMDbLib.Objects.Movies.Movie oMDetails = client.GetMovie(mID); public System.Collections.Generic.List ImagesPosters { get; set; } magesPosters = oMDetails.Images.Posters; I have tried ....General.Image data type and it still did not work. I am receiving this error: System.NullReferenceException: Object reference not set to an instance of an object. Wonderful api but there is pretty much no documentation — Reply to this email directly or view it on GitHub.

LordMike commented 9 years ago

The overload might be better suited for you though.

Regards, Mike

-----Original Message----- From: "arvazzz" notifications@github.com Sent: ‎03-‎05-‎2015 19:10 To: "LordMike/TMDbLib" TMDbLib@noreply.github.com Subject: Re: [TMDbLib] Movie images (#66)

Alright, i found a workaround by creating this TMDbLib.Objects.General.ImagesWithId pim = client.GetMovieImages(id); Thanks anyway by creating this great api — Reply to this email directly or view it on GitHub.

arvilsm commented 9 years ago

Could you give a short example how to get movie credits?

LordMike commented 9 years ago

There is an overload which accepts a MovieMethods enum which is also a flag type. So you can combine multiple requests in one. See below.

client.GetMovie(movieId, MovieMethods.Images | MovieMethods.Credits)

This will fill out the respective fields which used to be null.

joebob49 commented 9 years ago

Here's my snippet which does the job in VB.

Lookup/Update/Insert do as expected to two MYSQL database tables. One of the Actor details and the other to which connects actor(s) to movie(s).

    '' CAST
    Dim MovieCast As TMDbLib.Objects.Movies.Credits = URLResponse.GetMovieCredits(Movie.Id)
    If Not IsNothing(MovieCast) Then
      For Each CastMemeber In MovieCast.Cast
        WriteConsolus("CastId: " & Convert.ToString(CastMemeber.CastId).PadLeft(10) & _
            vbTab & "ID: " & Convert.ToString(CastMemeber.Id).PadLeft(10) & _
            vbTab & "Actor: " & CastMemeber.Name.Trim(" ").PadRight(40) & _
            vbTab & "Character: " & CastMemeber.Character.Trim(" ").PadRight(30))

          Dim Actor_ID As Integer = ActorData.lookupActor(CastMemeber.Id)
          If Actor_ID > 0 Then '> 0 if found
            Actor_ID = ActorData.updateActor(Actor_ID, CastMemeber.Id, CastMemeber.Name, CastMemeber.ProfilePath)
          Else
            Actor_ID = ActorData.insertActor(CastMemeber.Id, CastMemeber.Name, CastMemeber.ProfilePath)
          End If

          ' UPDATE ACTOR IMAGE
          If Not IsNothing(CastMemeber.ProfilePath) Then
            picPoster.Image = GetWebImage(URLImageBase & CastMemeber.ProfilePath)
            picPoster.Refresh()
            Me.Refresh()
            UpdateActorImage(CastMemeber.Id) ' Image stored as a blob in actors table
          End If

          Dim MovieActor_ID = lookupMovieActor(Movie.Id, CastMemeber.Id)
          If MovieActor_ID > 0 Then '> 0 if found
            updateMovieActor(MovieActor_ID, Movie.Id, CastMemeber.Id, CastMemeber.Character, CastMemeber.CastId)
          Else
            insertMovieActor(Movie.Id, CastMemeber.Id, CastMemeber.Character, CastMemeber.CastId)
          End If
          Application.DoEvents()
      Next
     ' Displays info in listbox of movie's actors 
      Dim Actors As DataTable = lookupAllMovieActors(Movie.Id)
      ltbActors.DataSource = Actors
      ltbActors.DisplayMember = Actors.Columns("Fullname").ColumnName

URLresponse and URLImagebase are prebuilt as per TMDB api requirements.

arvilsm commented 9 years ago

Thanks, got credits/images/keyword/trailers working but now i can't figure out how to work with TMdbLib.Objects.Movie.Country

LordMike commented 9 years ago

I'm unsure about the question. The Country object is a single country, identified by its ISO 3166-1 code..

From the Movie object, it is found through a Releases collection.

LordMike commented 9 years ago

Closing this.