This project has moved. For the latest updates, please go here.

How to get a list of all backdrops

Jul 24, 2012 at 8:41 PM

very very new to this so bare with me. i need to to get all the backdrops in en that are associated with a title. i am using the following code

 searchResults = api.SearchMovie(SearchTextBox.Text, 1)

for the title shrek i get the following 9 results which is correct

Shrek

Shrek The Third

Shrek Forever after

shrek 2

shrek the halls

shrek 4d

scared shrekless

shrek in the swamp

doing this gets one backdrop and one poster for each of the 9 titles from above . i want all the posters and backdrop for a single title . so how do i get them ? shrek 2 should have 6 posters and 9 backdrops

for each element in search_results.results

      posterPathArray.add(element.element.poster_path)

next

 

 


              

Coordinator
Jul 24, 2012 at 11:01 PM
Hi Brasscs,

Yes the Search method only gives on Backdrop and Poster, the primary one I guess. The full list of Backdrops and Posters for a movie requires a subsequent call to the API...GetMovieImages, which takes the "id" of the movie and the language.

So in your example:
searchResults = api.SearchMovie (searchTextBox.Text, 1)
for each element in searchResults.results
images = api.GetMovieImages (element.id, "en")
' this result object contains a list of backdrops, and separate list of posters you can enumerate through.

If you still don't get all the backdrops etc you're expecting, try leaving out the language parameter, ie api.GetMovieImages (element.id)

Hope this helps,

Craig

On Wed, Jul 25, 2012 at 6:41 AM, brasscs <notifications@codeplex.com> wrote:

From: brasscs

very very new to this so bare with me. i need to to get all the backdrops in en that are associated with a title. i am using the following code

searchResults = api.SearchMovie(SearchTextBox.Text, 1)

for the title shrek i get the following 9 results which is correct

Shrek

Shrek The Third

Shrek Forever after

shrek 2

shrek the halls

shrek 4d

scared shrekless

shrek in the swamp

doing this gets one backdrop and one poster for each of the 9 titles from above . i want all the posters and backdrop for a single title . so how do i get them ? shrek 2 should have 6 posters and 9 backdrops

for each element in search_results.results

posterPathArray.add(element.element.poster_path)

next



Read the full discussion online.

To add a post to this discussion, reply to this email (wattmdb@discussions.codeplex.com)

To start a new discussion for this project, email wattmdb@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Jul 25, 2012 at 12:28 AM

well some progress. using the same example shrek 2 should have 6 posters and 9 backdrops

the 6 posters loaded ok but 0 backdrops. i note that search_results.results gives only one id 809 for shrek 2 should there be 2 or is there a problem with file_path and backdrops?

i used the following code

 Dim images = api.GetMovieImages(809, "en")

        'this works and gives 6 results
        For Each element In images.posters
            posterPathArray.Add(element.file_path)
        Next

       ' this gives 0 results s/b 9
        For Each element In images.backdrops
            backdropPathArray.Add(element.file_path)
        Next

Coordinator
Jul 25, 2012 at 12:44 AM
Edited Jul 25, 2012 at 12:45 AM

Looking at the Shrek 2 backdrops in The Movie DB site ( http://www.themoviedb.org/movie/809-shrek-2/backdrops) there are 9 backdrops as you're expecting, but the language value against each is "none". By using language "en" I'd say those backdrops are being filtered out giving you 0 results.

Take out the "en" from the call and you should get what you want, ie api.GetMovieImages (809, nil). Means that you will get results for all languages, but at least you'll have control over what get's filtered off, eg where language="en" or language=nil (stored in the iso_639_1 property of each backdrop/poster item)
I've found that the language parameter is a bit useless, for reasons such as this problem.

Craig
On Wed, Jul 25, 2012 at 10:28 AM, brasscs <notifications@codeplex.com> wrote:

From: brasscs

well some progress. using the same example shrek 2 should have 6 posters and 9 backdrops

the 6 posters loaded ok but 0 backdrops. i note that search_results.results gives only one id 809 for shrek 2 should there be 2 or is there a problem with file_path and backdrops?

i used the following code

Dim images = api.GetMovieImages(809, "en")

'this works and gives 6 results
For Each element In images.posters
posterPathArray.Add(element.file_path)
Next

' this gives 0 results s/b 9
For Each element In images.backdrops
backdropPathArray.Add(element.file_path)
Next

Read the full discussion online.

To add a post to this discussion, reply to this email (wattmdb@discussions.codeplex.com)

To start a new discussion for this project, email wattmdb@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jul 25, 2012 at 12:54 AM

i removed the "en" and the same results posters only

also tried with star wars episode V id 1891 got 22 posters 0 backdrops s/b 24

Jul 25, 2012 at 1:01 AM

woops i removed the 'en' and now get all the posters . so then no way to get just the english ones?

Coordinator
Jul 25, 2012 at 1:19 AM
Yes that's the unfortunate result of removing the language parameter, you will get them all. Just means that you will have to filter them the way you want once you get the results.

I'm not a VB.NET programmer so you'll have to bare with me. Running below I get all the backdrops and posters, and then using a bit of Linq it's a simple matter to then filter out just the English.

Dim api = New WatTmdb.V3.Tmdb(My.Settings.TMDB_APIkey)
Dim imageResult = api.GetMovieImages(809, Nothing)

Assert.IsTrue(imageResult.backdrops.Count > 0)
Assert.IsTrue(imageResult.posters.Count > 0)

' get Posters where Language is English or Nothing - 2 different linq methods for the same result
Dim posters = (From p In imageResult.posters
Where p.iso_639_1 = "en" Or p.iso_639_1 = Nothing).ToList()

Dim posters2 = imageResult.posters.Where(Function(p) p.iso_639_1 = "en" Or p.iso_639_1 = Nothing).ToList()

Assert.AreEqual(posters, posters2)
Assert.IsTrue(posters.Count = 8)

If you run this code do you still get 0 results for the backdrops? You might need to remove the Assert lines to get it to run.

Craig

On Wed, Jul 25, 2012 at 11:01 AM, brasscs <notifications@codeplex.com> wrote:

From: brasscs

woops i removed the 'en' and now get all the posters . so then no way to get just the english ones?

Read the full discussion online.

To add a post to this discussion, reply to this email (wattmdb@discussions.codeplex.com)

To start a new discussion for this project, email wattmdb@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Jul 25, 2012 at 2:06 AM

ok this apears to work correctly. did'nt know about the iso_639_1. thanks for your help

  For Each element In images.posters
            If (element.iso_639_1 = Nothing) Or (element.iso_639_1 = "en") Then posterPathArray.Add(element.file_path)
        Next

        For Each element In images.backdrops
            If (element.iso_639_1 = Nothing) Or (element.iso_639_1 = "en") Then backdropPathArray.Add(element.file_path)
        Next

Jan 6, 2015 at 4:08 PM
This topic started off with the problem of backdrops not showing.

I ahve the same problem and i don't see any solution for this. Could u please help me with that?
Feb 19, 2015 at 8:49 PM
Ive have that this issue for a long time now and cannot seem to over come it , ive tried no parameter , All, and nothing and the count is also 0
      'QUERY TMDB FOR MOVIE INFO
        Dim basicMovie = api.SearchMovie(movieName, 1)

        'GET DETAILED INFORMATION
        Dim backdropCollection As WatTmdb.V3.TmdbMovieImages = api.GetMovieImages(basicMovie.results(0).id, Nothing)

        'IF NO IMAGES ARE FOUND, EXIT FUNCTIONS AND DISPLAY LABEL
        If backdropCollection.backdrops.Count = 0 Then
            noBackdropsFoundLabel.Visible = True
            loadingPictureBox.Visible = False
            Return False
        End If
Coordinator
Feb 22, 2015 at 10:10 PM
Are you specifying a language at any point? It's been a while since I've looked at this but in the past, most problems I've seen related to language differences giving unexpected results.

Just checked the below with the latest code and backdrops where returned.
Dim api = New WatTmdb.V3.Tmdb(My.Settings.TMDB_APIkey)
Dim search = api.SearchMovie("Jupiter Ascending", 1)
Dim images As WatTmdb.V3.TmdbMovieImages = api.GetMovieImages(search.results(0).id)
What movie name are you testing?
Using latest version dll? or building using the latest code (which has moved along since the last dll)
Valid API key?
Are there any errors in your api object after calling GetMovieImages?
Try running with Fiddler to capture request and response packets for any clues.
Feb 23, 2015 at 10:46 PM
Your sample code works however I found the issue to my problem, I was using the same code with the exceptions of the dim api line
       Your Call
        ''Dim api = New WatTmdb.V3.Tmdb(My.Settings.Api_Key)
        ''Dim search = api.SearchMovie("Jupiter Ascending", 1)
        ''Dim images As WatTmdb.V3.TmdbMovieImages = api.GetMovieImages(search.results(0).id)



        'MyCall 
        Dim basicMovie = api.SearchMovie(movieName, 1)

        'GET DETAILED INFORMATION
        Dim backdropCollection As WatTmdb.V3.TmdbMovieImages = api.GetMovieImages(basicMovie.results(0).id)
There is no difference in how we call the method or which methods we call. The difference in the code is

''Dim api = New WatTmdb.V3.Tmdb(My.Settings.Api_Key)

I make this call onLoad of the form and store the result in a private variable, I then access this from various methods. This works great everywhere else however fails for backdrops

I ended up just adding this line to resolve the issue however I believe there is a defect here