Author Topic: ThumbGen  (Read 176203 times)

Offline god_man

  • Newbie
  • Posts: 9
  • Helpful Contribution Status: +0/-0
Re: ThumbGen
« Reply #330 on: September 22, 2013, 07:24:58 am »
wanted to have more Scrapper ThumbGen

where I can get.

Offline mike_carton

  • Experienced Member
  • **
  • Posts: 103
  • Helpful Contribution Status: +4/-1
Re: ThumbGen
« Reply #331 on: February 07, 2016, 02:53:46 pm »
Created a template to meet these requirements and posted in the following thread: http://www.mede8erforum.com/index.php/topic,15432.0.html

Background (fanart)
Embedded picture (Disc cover or some such)
Name of Movie
Tagline
Year of Release
Running Time
IMDB logo
IMDB Rating
Genre
Parental Rating
Parental Rating Details
Director
Starring
Plot Summary
Container (Disc) Format, with logo (DVD/BD/BD 3D)
Video Codec, with logo
Resolution, with logo
Aspect Ratio
Framerate
Audio Codec, with logo
Audio Languages, with logo
Audio Channels
Subtitle Languages, with logo
Studio Logo
Country of Origin, Flag

Offline mike_carton

  • Experienced Member
  • **
  • Posts: 103
  • Helpful Contribution Status: +4/-1
Re: ThumbGen
« Reply #332 on: January 07, 2018, 10:12:55 pm »
ThumbGen continues to be an excellent tool. However, it now requires use of the optional XSLT and some XSL coding since IMDB has made some changes. I hope there are others using ThumbGen that I can exchange notes with. Specifically, did anyone

- find an elegant way to identify Atmos, Auro-3D and DTS:X

- find an elegant way to identify 3D

- find an elegant way to identify and process VC-1 video codec

- find an elegant way to identify and process 4K

- find a way to use a more recent version of mediainfo.dll than the one that ships with ThumbGen

- find a way to get the built-in player play MKV files (Can be used for capturing screenshots for use as background/fanart)

- use ThumbGen to scrape Asian movies (with non-Latin script in about.jpg): what font families do you use?

« Last Edit: January 07, 2018, 10:18:43 pm by mike_carton »

Offline voidths

  • X3D Skin Designer
  • Newbie
  • ***
  • Posts: 17
  • Helpful Contribution Status: +1/-0
Re: ThumbGen
« Reply #333 on: January 07, 2018, 11:26:10 pm »
I haven't tried 3d or 4k movies yet, but I have noticed thumbgen doesn't grab the certification rating (PG, R, etc) anymore.

Offline mike_carton

  • Experienced Member
  • **
  • Posts: 103
  • Helpful Contribution Status: +4/-1
Re: ThumbGen
« Reply #334 on: January 08, 2018, 03:17:10 am »
I use the feature provided by ThumbGen where it processes its output with an XSLT written by end-user before rendering the resulting, final XML. I retrieve the Certification information in that XSLT. Will post code tomorrow, it's rather late now.
« Last Edit: January 08, 2018, 02:11:45 pm by mike_carton »

Offline voidths

  • X3D Skin Designer
  • Newbie
  • ***
  • Posts: 17
  • Helpful Contribution Status: +1/-0
Re: ThumbGen
« Reply #335 on: January 08, 2018, 03:57:44 am »
Cool thanks, much appreciated!

Offline mike_carton

  • Experienced Member
  • **
  • Posts: 103
  • Helpful Contribution Status: +4/-1
Re: ThumbGen
« Reply #336 on: January 08, 2018, 02:22:49 pm »
Here's the code for retrieving the movie certification. It is VB Script and can be incorporated as an extension function in the xslt. An XSLT variable can be assigned the value of IMDB_GetCountryCertification() and the variable can be substituted where required in the XML. IMDB_GetCountryCertification() takes 2-letter country codes - US, GB etc.

An XSLT that uses the code is attached. If there is no "template.xslt" file currently in the ThumbGen template folder, this file can just be saved into that folder (extract from zip); it will be used automatically. Currently, the template shows a message box with the US certification code for the movie. If there is a text element called Certification in the template, that will be updated with the US certification code. Two more things need to be done to make this production-ready:

1. Remove the message box line from the XSLT:             MsgBox ("The " & psCountryCode & " certification for " & psIMDBId & " is: " & Trim$(Mid(lsHTML, i, j - i)))

2. Find the correct text element name for the certification code in the template being used and update the template.xslt to modify its value.

Code: [Select]
        Public Function GetHTML(ByVal psURL As String, ByVal plYear As Integer) As String
            Dim objHTTP As Object
       
       
       
            GetHTML = ""
       
            Err.Clear
            On Error Resume Next
            objHTTP = CreateObject("MSXML2.ServerXMLHTTP") ' Previously Microsoft.XMLHTTP
            If (Err.Number <> 0) Then
                MsgBox ("An error occurred in 'CreateObject' in retrieving HTML for the URL '" & psURL & "'. The error is: " & Err.Description)
                Err.Clear
                On Error GoTo 0
                GetHTML = ""
                Exit Function
            End If
            On Error GoTo 0
       
            Err.Clear
            On Error Resume Next
            objHTTP.Open ("GET", psURL, False)
            If (Err.Number <> 0) Then
                MsgBox ("An error occurred in 'Open' in retrieving HTML for the URL '" & psURL & "'. The error is: " & Err.Description)
                objHTTP = Nothing
                Err.Clear
                On Error GoTo 0
                GetHTML = ""
                Exit Function
            End If
            On Error GoTo 0
           
            Err.Clear
            On Error Resume Next
            objHTTP.Send
            If (Err.Number <> 0) Then
                MsgBox ("An error occurred in 'Send' in retrieving HTML for the URL '" & psURL & "'. The error is: " & Err.Description)
                objHTTP = Nothing
                Err.Clear
                On Error GoTo 0
                GetHTML = ""
                Exit Function
            End If
            On Error GoTo 0
       
            If (Trim$(objHTTP.responseText) = "") Or (InStr(1, objHTTP.responseText, "Not Found", vbTextCompare) <> 0) Then
                If (plYear <> 0) Then
                    psURL = psURL & "_" & CStr(plYear)
       
                    Err.Clear
                    On Error Resume Next
                    objHTTP.Open ("GET", psURL, False)
                    If (Err.Number <> 0) Then
                        MsgBox ("An error occurred in 'Open' in retrieving HTML for the URL '" & psURL & "'. The error is: " & Err.Description)
                        objHTTP = Nothing
                        Err.Clear
                        On Error GoTo 0
                        GetHTML = ""
                        Exit Function
                    End If
                    On Error GoTo 0
                   
                    Err.Clear
                    On Error Resume Next
                    objHTTP.Send
                    If (Err.Number <> 0) Then
                        MsgBox ("An error occurred in 'Send' in retrieving HTML for the URL '" & psURL & "'. The error is: " & Err.Description)
                        objHTTP = Nothing
                        Err.Clear
                        On Error GoTo 0
                        GetHTML = ""
                        Exit Function
                    End If
                    On Error GoTo 0
       
                    If (Trim$(objHTTP.responseText) = "") Or (InStr(1, objHTTP.responseText, "Not Found", vbTextCompare) <> 0) Then
                        GetHTML = ""
                    Else
                        GetHTML = Trim$(objHTTP.responseText)
                    End If
                Else
                    GetHTML = ""
                End If
            Else
                GetHTML = Trim$(objHTTP.responseText)
            End If
       
            objHTTP = Nothing
        End Function
       
        ' List of country codes used by IMDB is at https://help.imdb.com/article/contribution/other-submission-guides/country-codes/G99K4LFRMSC37DCN?ref_=helpart_nav_13#
        Public Function IMDB_GetCountryCertification(ByVal psIMDBId As String, ByVal psCountryCode As String) As String
            Dim lsHTML As String
           
            Dim i As Long
            Dim j As Long
           
       
       
       
       
       
            IMDB_GetCountryCertification = " "
           
            lsHTML = GetHTML("http://www.imdb.com/title/" & psIMDBId & "/parentalguide", 0)
            i = InStr(1, lsHTML, "/search/title?certificates=" & psCountryCode & ":", vbTextCompare)
            If (i = 0) Then
                Exit Function
            End If
            i = i + Len("/search/title?certificates=" & psCountryCode & ":")
            j = InStr(i, lsHTML, """", vbBinaryCompare)
            If (j = 0) Then
                Exit Function
            End If
            IMDB_GetCountryCertification = Trim$(Mid(lsHTML, i, j - i))
        End Function
« Last Edit: January 08, 2018, 02:57:06 pm by mike_carton »

Offline voidths

  • X3D Skin Designer
  • Newbie
  • ***
  • Posts: 17
  • Helpful Contribution Status: +1/-0
Re: ThumbGen
« Reply #337 on: January 08, 2018, 11:52:35 pm »
Thank you! I'll give it a shot.

Offline voidths

  • X3D Skin Designer
  • Newbie
  • ***
  • Posts: 17
  • Helpful Contribution Status: +1/-0
Re: ThumbGen
« Reply #338 on: January 09, 2018, 12:12:49 am »
It works perfect! Thanks so much!

Offline mike_carton

  • Experienced Member
  • **
  • Posts: 103
  • Helpful Contribution Status: +4/-1
Re: ThumbGen
« Reply #339 on: January 09, 2018, 02:12:10 am »
You're welcome. I didn't really expect you'd be able to try it so soon, much less get it working in your setup right away.

Offline voidths

  • X3D Skin Designer
  • Newbie
  • ***
  • Posts: 17
  • Helpful Contribution Status: +1/-0
Re: ThumbGen
« Reply #340 on: January 09, 2018, 03:17:59 am »
I just followed you're steps and made sure to match up the text element name from my template and all was good.

Offline Lupissimo

  • Senior Member
  • ***
  • Posts: 379
  • Helpful Contribution Status: +4/-0
Re: ThumbGen
« Reply #341 on: January 09, 2018, 11:46:01 am »
Can you also get the correct IMDB rating value with this script? Thumgen 1.3.9.2 has not been able to get the correct value for some time.

Offline mike_carton

  • Experienced Member
  • **
  • Posts: 103
  • Helpful Contribution Status: +4/-1
Re: ThumbGen
« Reply #342 on: January 09, 2018, 05:55:13 pm »
A new routine is needed. I attached the updated template with it. As before:

1. MsgBox (a different one) needs to be removed

2. Correct IMDBScore element name needs to be substituted in the template.xslt

Code: [Select]
        Public Function IMDB_GetUserRating(ByVal psIMDBId As String) As String
            Dim lsHTML As String
            Dim lsIMDBUserRating As String
           
            Dim i As Long
            Dim j As Long
           
       
       
       
       
            IMDB_GetUserRating = " "
           
            lsHTML = GetHTML("http://www.imdb.com/title/" & psIMDBId, 0)
           
            ' Try Old Method as well as new method
            i = InStr(1, lsHTML, "class=""imdbRating""", vbTextCompare)
            If (i <> 0) Then
                i = InStr(i, lsHTML, "<span itemprop=""ratingValue"">", vbTextCompare) + Strings.Len("<span itemprop=""ratingValue"">")
                If (i <> 0) Then
                    j = InStr(i, lsHTML, "<", vbTextCompare)
                    If (j <> 0) Then
                        lsIMDBUserRating = Trim(Mid(lsHTML, i, j - i))
                     
                        i = InStr(j, lsHTML, "itemprop=""bestRating"">", vbTextCompare) + Strings.Len("itemprop=""bestRating"">")
                        If (i <> 0) Then
                            j = InStr(i, lsHTML, "<", vbTextCompare)
                            If (j <> 0) Then
                                lsIMDBUserRating = lsIMDBUserRating & "/" & Mid(lsHTML, i, j - i)
                            End If
                        End If
                    End If
                End If
            Else
                i = InStr(1, lsHTML, "<div class=""star-box giga-star"">", vbTextCompare)
                If (i <> 0) Then
                    i = InStr(i, lsHTML, "title=""Users rated this ", vbTextCompare) + Strings.Len("title=""Users rated this ")
                    If (i <> 0) Then
                        j = InStr(i, lsHTML, "(", vbTextCompare)
                        If (j <> 0) Then
                            lsIMDBUserRating = Trim(Mid(lsHTML, i, j - i))
                        End If
                    End If
                End If
            End If
           
            IMDB_GetUserRating = lsIMDBUserRating

            MsgBox ("The IMDB User Rating for " & psIMDBId & " is: " & lsIMDBUserRating)
        End Function

Offline Lupissimo

  • Senior Member
  • ***
  • Posts: 379
  • Helpful Contribution Status: +4/-0
Re: ThumbGen
« Reply #343 on: January 09, 2018, 06:29:29 pm »
Thank you for the quick response! This is what I changed besides deleting the Message Line :

 CODE: Dim i As Long
            Dim j As Long
           
       
       
       
       
            IMDB_GetUserRating = IMDB Rating
           
            lsHTML = GetHTML("http://www.imdb.com/title/" & psIMDBId, 0)
    END CODE

It works fine and gets the correct values, but ends with an error message:    End of-Anweisung(command?) exspected.
   

Offline mike_carton

  • Experienced Member
  • **
  • Posts: 103
  • Helpful Contribution Status: +4/-1
Re: ThumbGen
« Reply #344 on: January 09, 2018, 07:29:08 pm »
If you're getting the error message still, please post the template.xslt you have now.