/*########## Dirty ThumbnailCreator Script by MonsterMagnet ############################################################################################################################################################### Best viewed >= 1024x768### Requires Avisynth 2.5 (http://sourceforge.net/projects/avisynth2/)(tested with 2.56 and 2.57)### and mplayer2 (included in WinXP C:\Programme\Windows Media Player\mplayer2.exe).### This script creates thumbnail and preview images from your movies, for use with Mediaportal.### Only missing thumbs or previews are created.(so you can run this script every time you add new movies !)### 100 movie thumbs and 100 previews are created in 3:10 min (Athlon64 3500).### TIP 1: Try this script with a test movie directory.### TIP 2: You can use this script inside Mediaportal with the MyPrograms plugin.### TIP 3: In directory: C:\Programme\Team MediaPortal\MediaPortal\Skin\BlueTwo\myvideo.xml change ### <import>common.facade.video.xml</import> to <import>common.facade.pictures.xml</import> ### TIP 4: Eventghost.org (open-source automation tool for MS Windows, supports infrared or wireless remotes)######################################################################################################################### SETTINGS (Edit carefully !!!) ################################################################*//*----------- Path to AviSynth "DirectShowSource.dll" (double backslashes !) -------------------------------------------------------------------------------------------------------------------------------------------*/var AviSynth = "C:\\Program Files\\AviSynth 2.5\\plugins"/*----------- VideoFrame to use as thumbnail (use lower value for small and higher for large files !) ------------------------------------------------------------------------------------------------------------------*/var imageframe = 1500/*----------- MediaPortal video title thumbnail directory (double backslashes !) ---------------------------------------------------------------------------------------------------------------------------------------*/var MPdir = "C:\\Program Files\\Team MediaPortal\\MediaPortal\\Thumbs\\videos\\Title"/*----------- Directories to scan (double backslashes !, remove leading double slashes for more directories!)-----------------------------------------------------------------------------------------------------------*/dirs = new Array();dirs[5] = "E:\\"/*---------- Mplayer exe path (Only edit if mplayer2 was not found or you want to use another player -------------------- (no blanks !, double backslashes !) -----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/var mplayer ="mplayer2.exe"/*############# END SETTINGS ###########################################################################################################################################################################################*/var counterS = 0;var counterL = 0;var fso = new ActiveXObject("Scripting.FileSystemObject");var wshshell = new ActiveXObject("Wscript.shell");function scan (){ for (i=0; i < dirs.length; i++) { scandir (dirs[i]) } wshshell.Popup(counterS + " Thumbnails and " + counterL + " Preview images created", 1, "ThumbnailCreator", 0+64)}function scandir( dir ){ if (fso.FolderExists( dir ) == true) { var srcFolder = fso.GetFolder( dir ); var files = new Enumerator( srcFolder.files ); do { var ext = fso.GetExtensionName (files.item()); ext = ext.toLowerCase(); if (ext == "avi" || ext == "mpg" || ext == "wmv" || ext == "rmvb" || ext == "mov") { var search = files.item().name.lastIndexOf("."); var part = files.item().name.substring(0,search); var thumbS = part + ".jpg"; var thumbL = part + "L.jpg"; if (fso.FileExists(dir + '\\' + thumbS) == false && fso.FileExists(MPdir + '\\' + thumbS) == false) { var tf = fso.CreateTextFile(AviSynth + "\\Tempscript.avs",true) tf.WriteLine('LoadPlugin ("' +AviSynth+ '\\DirectShowSource.dll")') tf.WriteLine('input=(DirectShowSource("'+files.item().path+ '", fps=25, seek=true, audio=false))') tf.WriteLine("converttorgb24(input)") tf.WriteLine("Crop(16, 16, -16, -16)") tf.WriteLine("BilinearResize(128,96)") tf.WriteLine('Trim(' + imageframe + ',' + imageframe + ')') tf.WriteLine('ImageWriter("' +AviSynth+ '\\" ,0,0,"jpg")') tf.Close() wshshell.run (mplayer + " /play /close " +AviSynth+ "\\Tempscript.avs",7, true) fso.CopyFile (AviSynth + '\\000000.jpg',dir + '\\' + thumbS) counterS++; } if (fso.FileExists(dir + '\\' + thumbL) == false && fso.FileExists(MPdir + '\\' + thumbL) == false) { var tf = fso.CreateTextFile(AviSynth + "\\Tempscript.avs",true) tf.WriteLine('LoadPlugin ("' +AviSynth+ '\\DirectShowSource.dll")') tf.WriteLine('input=(DirectShowSource("'+files.item().path+ '", fps=25, seek=true, audio=false))') tf.WriteLine("converttorgb24(input)") tf.WriteLine("Crop(16, 16, -16, -16)") tf.WriteLine("BilinearResize(512,384)") tf.WriteLine('Trim(' + imageframe + ',' + imageframe + ')') tf.WriteLine('ImageWriter("' +AviSynth+ '\\" ,0,0,"jpg")') tf.Close() wshshell.run (mplayer + " /play /close " +AviSynth+ "\\Tempscript.avs",7, true) fso.CopyFile (AviSynth + '\\000000.jpg',dir + '\\' + thumbL) counterL++; } } files.moveNext(); } while (!files.atEnd() ); }}scan()