Tuesday 26 July 2016

imdb.dll (.NET version)

1- Register : the dll (only once is needed)

2- Login    : each time you will use the dll, you had to login with your account

3- SearchExact : Search for movie by its exact title

                 SearchExact("The Matrix") will return you many movies
                 SearchExact("The Matrix (1999)") will return 1 movie

                 Search also accept another parameter of how many movies to get                    back from search MAX is 10

4- depends on search, if one movie  : DownloadMovie then GetMovieInfo
                      If many movie : DownloadMovie(Title or Index) Then                                               GetMovieInfo

5- This is free DLL, you can use it in any personal software or commercial          software without prior notice.
        
6- There will be another version of imdb.dll (not free), where you can automate      the download without message interferance plus many other feature will be        avaliable only in the registered version.

7- There is imdb.xml file which must be in the same directory of imdb.dll
   in case of imdb changed its html layout, i don't had to create a imdb.dll to      match the new layout, neither the user/developer had to install new version      each time imdb.com changed the layout
    
   imdb.xml is the extract mechanism parameters I used to extract data from          imdb.com,so make sure to get the newest version of it.


8- Enjoy      

9- send email to samir.r.ibrahim@gmail(.)com for registered version and ask you      question in this blog so I can answer it.


Imports IMDb.IMDbEN
 
Public Class Form1
    Dim oIMDB As New IMDb.IMDb    
    Private Sub btn_Login_Click( sender As System.Object,  e As System.EventArgsHandles btn_Login.Click
        ' Login("Demo","Demo") is valid until 15/08/2016
        ' Please register it with yuor own "email" and "password". its free ;)
        Dim login_result = oIMDB.Login("Demo","Demo")
        If login_result = True
            btn_Search.Enabled = True
        Else
            btn_Search.Enabled = False
        End If
 
    End Sub
 
    Private Sub btn_Search_Click( sender As System.Object,  e As System.EventArgsHandles btn_Search.Click
        lst_1.Items.Clear
        lst_2.Items.Clear
        txt_FullInfo.Clear
        lvw.Items.Clear
        
        Dim search_result As IMDb_Search = oIMDB.SearchExact(txt_Search.Text,10)
        
        Select Case search_result
            'Check the result of the search. the search_result could be
            'IMDb_Search.Error      : IMDb_Search.ManyMovies  : IMDb_Search.NoInternet
            'IMDb_Search.NoResult   : IMDb_Search.NotLoggenIn : IMDb_Search.OneMovie
            Case IMDb_Search.OneMovie
                ' in case of one movie found, you should download the movie
                oIMDB.DownloadMovie()
                ' get the movie information such as (acter, director, writer, etc...)
                oIMDB.GetMovieInfo()
                ' get the full movie info in one place FullMovieInfo
                txt_FullInfo.Text = oIMDB.FullMovieInfo()
                ' get movie individual property by using [oIMDB.Movie]
                Call Me.sb_FillMovieProperty()
 
            Case IMDb_Search.ManyMovies
                ' in case of search result is ManyMovies, then you had to display the movies found
                ' so you can select which one you want to download
                Dim movies_found = oIMDB.GetFoundMovies()
                'the GetFoundMovie is a List of found movies as class
                'Public Class IMDBGetMovies_RETURN
                    'Property Title    As String
                    'Property TitleURL As String
                'End Class
                For i = 0 to movies_found.Count -1
                    lst_1.Items.add(movies_found(i).Title)
                    lst_2.Items.Add(movies_found(i).TitleURL)
                Next
 
            Case Else
                ' You can check for other error as mentions above and display a proper message.
                MsgBox(search_result.ToString)
        End Select                        
    End Sub
    
    Private Sub btn_DownloadByTitle_Click( sender As Object,  e As EventArgsHandles btn_DownloadByTitle.Click
        ' Download the movie from a list by its Title
        txt_FullInfo.Clear
        lvw.Items.Clear
        Dim dowbload_result = oIMDB.DownloadMovie(lst_1.SelectedItem.ToString)
        'the download result could be
        'IMDb_Download.Error        : IMDb_Download.Failed        : IMDb_Download.NoInternet
        'IMDb_Download.NotLogedIn   : IMDb_Download.SearchNotUsed : IMDb_Download.Success
        If dowbload_result = IMDb_Download.Success
            'If the download is success, get movie info
            oIMDB.GetMovieInfo()
            txt_FullInfo.Text = oIMDB.FullMovieInfo()
            Call Me.sb_FillMovieProperty()
        Else
            MsgBox(dowbload_result.ToString)
        End If
    End Sub
 
    Private Sub btn_DownloadByIndex_Click( sender As Object,  e As EventArgsHandles btn_DownloadByIndex.Click
        ' Download the movie from a list by index 
        txt_FullInfo.Clear
        lvw.Items.Clear
        Dim download_result = oIMDB.DownloadMovie(lst_2.SelectedIndex)        
        If download_result = IMDb_Download.Success
            oIMDB.GetMovieInfo()
            txt_FullInfo.Text = oIMDB.FullMovieInfo
            Call sb_FillMovieProperty()
        Else
            MsgBox(download_result.ToString)
        End If        
    End Sub
 
    Private Sub btn_RegisterIMDB_Click( sender As Object,  e As EventArgsHandles btn_RegisterIMDB.Click
        'Change below to register first, then you can use the dll
        'You can bypass register by using oIMDB.Login("demo","demo") until 15/08/2016
        oIMDB.Register("Your_User_Name","Your_Email_Address")
    End Sub
 
    Sub sb_FillMovieProperty()
 
        Dim Info As String() = <info>AspectRatio,Awards,Budget,Casting,CastingAs,
                                     Category,Color,Country,Director,Goofs,Gross,Language,
                                     Location,MPAA,Plot,PlotKeywords,ReleaseDate,Runtime,Score,
                                     SoundMix,StoryLine,Title,TitleOnly,Votes,Writers,Year</info>.Value.Split(",")
                         
 
        For i = 0 to Info.Length -1
            lvw.Items.Add(Info(i).TrimStart)
        Next
        For ix = 0 to lvw.Columns.Count -1
            lvw.Columns(ix).Width = -2
        Next
 
        lvw.Items(00).SubItems.Add(oIMDB.Movie.AspectRatio)
        lvw.Items(01).SubItems.Add(oIMDB.Movie.Awards)
        lvw.Items(02).SubItems.Add(oIMDB.Movie.Budget)
        lvw.Items(03).SubItems.Add(oIMDB.Movie.Casting)
        lvw.Items(04).SubItems.Add(oIMDB.Movie.CastingAs)
        lvw.Items(05).SubItems.Add(oIMDB.Movie.Category)
        lvw.Items(06).SubItems.Add(oIMDB.Movie.Color)
        lvw.Items(07).SubItems.Add(oIMDB.Movie.Country)
        lvw.Items(08).SubItems.Add(oIMDB.Movie.Director)
        lvw.Items(09).SubItems.Add(oIMDB.Movie.Goofs)
        lvw.Items(10).SubItems.Add(oIMDB.Movie.Gross)
        lvw.Items(11).SubItems.Add(oIMDB.Movie.Language)
        lvw.Items(12).SubItems.Add(oIMDB.Movie.Location)
        lvw.Items(13).SubItems.Add(oIMDB.Movie.MPAA)
        lvw.Items(14).SubItems.Add(oIMDB.Movie.Plot)
        lvw.Items(15).SubItems.Add(oIMDB.Movie.PlotKeywords)
        lvw.Items(16).SubItems.Add(oIMDB.Movie.ReleaseDate)
        lvw.Items(17).SubItems.Add(oIMDB.Movie.Runtime)
        lvw.Items(18).SubItems.Add(oIMDB.Movie.Score)
        lvw.Items(19).SubItems.Add(oIMDB.Movie.SoundMix)
        lvw.Items(20).SubItems.Add(oIMDB.Movie.StoryLine)
        lvw.Items(21).SubItems.Add(oIMDB.Movie.Title)
        lvw.Items(22).SubItems.Add(oIMDB.Movie.TitleOnly)    
        lvw.Items(23).SubItems.Add(oIMDB.Movie.Votes)
        lvw.Items(24).SubItems.Add(oIMDB.Movie.Writers)
        lvw.Items(25).SubItems.Add(oIMDB.Movie.Year)
 
    End Sub
 
    Private Sub Form1_Load( sender As System.Object,  e As System.EventArgsHandles MyBase.Load
        '1- Register : the dll (only once is needed)
 
        '2- Login    : each time you will use the dll, you had to login with your account
 
        '3- SearchExact : Search for movie by its exact title
                'SearchExact("The Matrix") will return you many movies
                'SearchExact("The Matrix (1999)") will return 1 movie
 
            'Search also accept another parameter of how many movies to get back from search MAX is 10
 
        '4- depends on search, if one movie  : DownloadMovie then GetMovieInfo
        '                      If many movie : DownloadMovie(Title or Index) : Then GetMovieInfo
 
        '5- This is free DLL, you can use it in any personal software or commercial software without prior notice.
        
        '6- There will be another version of imdb.dll (not free), where you can automate the download 
        ' without message interferance plus many other feature will be avaliable only in the registered version.
 
        '7- There is imdb.xml file which must be in the same directory of imdb.dll
        '   in case of imdb changed its html layout, i dont had to create a imdb.dll to match the new layout, neither the
        '   user/developer had to install new version each time imdb.com changed the layout
    
        '   imdb.xml is the extract mechanism parameters i used to extract data from imdb.com, so make sure to get the newst
        '   version or it
    
            
        '7- Enjoy
    End Sub
 
Private Sub Button1_Click( sender As System.Object,  e As System.EventArgsHandles btn_about.Click
        oIMDB.About
End Sub
End Class


No comments:

Post a Comment