Jump to content

batch convert fanart to thumb


Swynol

Recommended Posts

Happy2Play

@@chef

 

It launches now.  Ran search on movies and got Unhandled exception.

 

An item with the same key has already been added

 

 

System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at ThumbMaker.MediaLocator.VB$StateMachine_2_MovieNames.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__3(Object state)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Thumb Maker
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Doug/Desktop/Thumb%20Maker/Thumb%20Maker/Thumb%20Maker.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 10.0.0.0
    Win32 Version: 12.0.52242.36242 built by: FX452RTMLDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
MediaBrowser.Model
    Assembly Version: 3.0.5666.4
    Win32 Version: 3.0.5666.4
    CodeBase: file:///C:/Users/Doug/Desktop/Thumb%20Maker/Thumb%20Maker/MediaBrowser.Model.DLL
----------------------------------------
MediaBrowser.ApiInteraction
    Assembly Version: 3.0.5664.41652
    Win32 Version: 3.0.5664.41652
    CodeBase: file:///C:/Users/Doug/Desktop/Thumb%20Maker/Thumb%20Maker/MediaBrowser.ApiInteraction.DLL
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Newtonsoft.Json
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.8.18111
    CodeBase: file:///C:/Users/Doug/Desktop/Thumb%20Maker/Thumb%20Maker/Newtonsoft.Json.DLL
----------------------------------------
System.Numerics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
System.Runtime.Serialization
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
System.Xml.Linq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

 

 

 

Value cannot be null

 

 

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentNullException: Value cannot be null.
Parameter name: address
   at System.Net.WebClient.DownloadData(String address)
   at ThumbMaker.ShowThumb.ShowThumb_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Thumb Maker
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Doug/Desktop/Thumb%20Maker/Thumb%20Maker/Thumb%20Maker.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 10.0.0.0
    Win32 Version: 12.0.52242.36242 built by: FX452RTMLDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
MediaBrowser.Model
    Assembly Version: 3.0.5666.4
    Win32 Version: 3.0.5666.4
    CodeBase: file:///C:/Users/Doug/Desktop/Thumb%20Maker/Thumb%20Maker/MediaBrowser.Model.DLL
----------------------------------------
MediaBrowser.ApiInteraction
    Assembly Version: 3.0.5664.41652
    Win32 Version: 3.0.5664.41652
    CodeBase: file:///C:/Users/Doug/Desktop/Thumb%20Maker/Thumb%20Maker/MediaBrowser.ApiInteraction.DLL
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Newtonsoft.Json
    Assembly Version: 6.0.0.0
    Win32 Version: 6.0.8.18111
    CodeBase: file:///C:/Users/Doug/Desktop/Thumb%20Maker/Thumb%20Maker/Newtonsoft.Json.DLL
----------------------------------------
System.Numerics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
System.Runtime.Serialization
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
System.Xml.Linq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

 

 

Edited by Happy2Play
  • Like 1
Link to comment
Share on other sites

FrostByte

Image where logo didn't get placed correctly (have several like this)

 55ca7621d1f83_thumb1.jpg

 

This image causes the null address error every time.  Might be that the movie name starts with a special character?

55ca769ab0511_thumb2.jpg

  • Like 1
Link to comment
Share on other sites

Happy2Play

Looks like "Value cannot be null." is thrown for not having a "LOGO" image.

  • Like 2
Link to comment
Share on other sites

chef

Thanks guys! I have to fix a couple I found too, like when there is no logo present to overlay.

 

If there is no logo present, maybe just text for the name?

 

I have to work on the sizing of the logo. It seems there have to be serveral sizing conditions if the logo is to tall or to long for the thumb.

 

There maybe a very large Select condition to try and size the logo properly.

 

The same key error is because of the dictionary it uses to sort the titles. I will have to look further into that error.

 

The tv series scan not ending is an interesting one. There will have to be conditions to exit the query if all series have thumbs. Currently I am actually missing quite a few, so I'll try and finish this so I can see where the query needs to end in the code.

Edited by chef
  • Like 1
Link to comment
Share on other sites

chef

Almost there!

 

Wanna see if this fixes some errors? And if it places logos better?

 

1. Use text graphics to write the Media Item name on the thumb image, if a logo doesn't exist.

 

2. The placement of the logos as an overlay uses better conditions, but some of the math to re-size the logo properly (and keep aspect ratio of the image) is really hard,

I had to figure out percentages of reduced height and apply it to the width. The math might be wrong.

 

https://dl.dropboxusercontent.com/u/46151346/Thumb%20Maker.zip

  • Like 1
Link to comment
Share on other sites

FrostByte

Got this error on a few of my movies.  There is a backdrop and logo in folder

Log file: 

http://pastebin.com/QChvfrA2

55caa76576c52_Rope.jpg

 

Long titles run off the side when using text

55caa79d5a143_thumb.jpg

 

The odd sized logos still don't display correctly, but it looks like they are in a different location now

55caa7e084e27_thumb2.jpg

 

Fixed for me:

 

I'm no longer having the issue with the search not finishing for episodes when all have thumbs

 

Process no longer hangs in task manager with Close button (noticed I had several I had to kill in task manager)​

Edited by FrostByte
  • Like 1
Link to comment
Share on other sites

chef

@@FrostByte

 

The Index Pixel format error...

 

I am trying to figure out which graphic it is referring too (Is it a movie which is trying to overlay the logo, or is it a movie which is trying to add text graphics?).

 

Could you tell me if your movie "Rope" has a logo.png?

Link to comment
Share on other sites

FrostByte

Yes, the movie Rope has both.  I found at least 3 movies I get this same error on.  Oddly they are all older movies.

 

post-1276-0-75382100-1439346706_thumb.pngpost-1276-0-65668200-1439346704_thumb.jpg

 

 

Edit:  backdrop is 1280x720 (smaller than most) and logo is 800x310.  The backdrop1 and backdrop2 files are the normal size 1920x1200

Edited by FrostByte
Link to comment
Share on other sites

chef

I found a fix (http://stackoverflow.com/questions/17313285/graphics-on-indexed-image), but it is going to take a bit of coding.

 

It would seem that the entire image has to be built from an empty bitmap, instead of trying to overlay the logo directly on a re-sized version of a backdrop.

 

Not a huge deal, but it is going to take a bit to write.

  • Like 1
Link to comment
Share on other sites

FrostByte

Could also look for another backdrop that is the correct size if that's easier, in this case the backdrop2 and 3 were both 1920x1200.  Though your other code may still be needed in the event they are all incorrect I suppose.

Link to comment
Share on other sites

Chef - the math for resizing the logo preserving the aspect ratio should be:

 

Take current image height and divide it by the width - save that float number - then resize the image to whatever width it needs to be and the height should be the width multiplied by your saved float. i.e.

newWidth = [whatever]
newHeight = newWidth * (OriginalHeight/OriginalWidth)
  • Like 1
Link to comment
Share on other sites

chef

Thank you ebr. I could get the float, but wasn't sure what happened next. Much appreciated.

Link to comment
Share on other sites

FrostByte

The calculations appear to be off still.  Some of them are really off like this one.

 

55cbe1a916f9b_thumb3.jpg

 

None of the thumbs save, even the ones that look correct.  All my media is on local drives right now.  \\PCname.domainname\path it looks like.  Nothing shows up in the folders after saving

55cbe2b79e0c3_thumb4.jpg

Link to comment
Share on other sites

FrostByte

Others are just off a little.  I do have a lot like the one above though where the logo and backdrop look like two seperate images.    About 80 - 90 are correct though, but they don't save either

55cbe49ec317a_thumb5.jpg

Link to comment
Share on other sites

Happy2Play

Mixed results

 

55cbe640cd0d9_text1280720.jpg

 

 

 

55cbe652b92a7_19201080.jpg

 

 

55cbe77a19965_logo.jpg

55cbe79938ed4_good.jpg

 

Not saving same results locally and remote.

55cbe6ac3f731_save.jpg

  • Like 1
Link to comment
Share on other sites

chef

Interesting... the "Open Season" image is strange. Why would it be so small, the api requests images at a certain size, so it shouldn't be smaller then the picture box it is being displayed in.

 

I know why Barnyard isn't fitting properly though, I can fix that one.

 

And I see that the image save string isn't being calculated properly. I added a msgbox to test it properly before it tried to save to wrong folders. I should be able to get that working.

Edited by chef
Link to comment
Share on other sites

chef

This time I forced the Backdrop Image to become its own Bitmap Object before adding it to the main image.

 

This forces the Backdrop image to maintain it's size.

 

I also fixed the issue where logos were not re-sized before they were graphically drawn to the backdrop.

 

But, the saving still needs work.

 

https://dl.dropboxusercontent.com/u/46151346/Thumb%20Maker.zip

  • Like 1
Link to comment
Share on other sites

FrostByte

Ok, all mine with logos appear to be good now.  The only ones I'm still having issues with are long movies names where the text is still running off the side.

55cbfbf23b98f_thumb7.jpg

 

Has new test message on save, but still doesn't save anything as you mentioned.  Files are local

55cbfc499a823_thumb8.jpg

Link to comment
Share on other sites

Happy2Play

Looking good.

55cbfbcf496fc_openseason.jpg

 

Text size difference, only found this one so far.

 

1280x720 backdrop

55cbfe22aeb11_wings.jpg

 

1920x1080 backbrop

55cbfc0544e79_rescuedog.jpg

 

Save - additional non-existing path  (remote)

55cbfdf2674be_save1.jpg

Edited by Happy2Play
Link to comment
Share on other sites

FrostByte

Good catch.  The extra folder name in the path shows up locally too (see my post #46).  There is an extra \Mystic River before thumb.jpg

Link to comment
Share on other sites

chef

What are the odds that people will be using this remotely?

 

If the program runs on their server machine only then saving the thumb would be simple.

 

If it is run remotely then there has to be a function which try's to string together the remote path (which is obviously causing some format issues).

 

The text graphic is set in a Try and catch statement ( if the logo isn't present then catch the error and set the text graphic ), but text graphics look kind of crappy, and in order to set them properly as an overlay, they're going to have to be set in an empty bitmap first as well, and then resized and set.

Gotta find a decent font, Segoe isn't cutting it.

Edited by chef
Link to comment
Share on other sites

Happy2Play

@@chef

 

Locally I still get this.  From server desktop.
 
TV - should be Z:\ServerFolders\Videos\TV Series\Lucifer [Drama]  or \\WHS2011-HOME\Videos\TV Series\Lucifer [Drama]
55cc9ca2c7666_TVShow.jpg
 
 
Movies should be Z:\ServerFolders\Videos\Movies\Big Jake (1971) [Western] or \\WHS2011-HOME\Videos\Movies\Big[/url] Jake (1971) [Western]
55cc96d3d8d30_movie.jpg

 

Library

55cc99391fc27_Library.jpg

Edited by Happy2Play
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...