Create thumbnail

Post Reply
Spookyy
Posts: 9
Joined: Wed Jul 27, 2011 2:43 pm

Create thumbnail

Post by Spookyy »

I made a link under Youtube (http://www.youtube.com/watch?v=snnB8C5sDkY)
But if i right-click and choose create thumbnail, nothing happens.

Got any hints where i am failing?
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Create thumbnail

Post by Eugene »

Usually thumbnails are connected from RSS-feeds. But it can handled with a script

Settings - Processing - Add

Name: Youtube thumbnails
Language: PascalScript
Expression:

Code: Select all

procedure ProcessItem(aItem: TWmsScriptMediaItem; var aSuccessCount: Integer);
var
  sVideoID: string;
begin
  if WmsRegExMatch('\?v=([^&]*)', aItem.Properties[mpiFilePath], sVideoID) then begin
    aItem.Properties[mpiThumbnail] := 'http://i1.ytimg.com/vi/' + sVideoID + '/default.jpg';    
    Inc(aSuccessCount)    
  end
end;
 
var
  i, iSuccessCount: Integer;
  MediaItemList: TWmsScriptMediaItemList;
begin
  MediaItemList := WmsCurrentMediaListSelection;
  try
    iSuccessCount := 0;
    if MediaItemList.Count > 0 then begin
      WmsShowInformation('Set thumbnails...');
      try
        for i := 0 to MediaItemList.Count - 1 do
          ProcessItem(MediaItemList[i], iSuccessCount)
      finally
        WmsHideInformation
      end    
    end else if WmsCurrentMediaListItem <> nil then
      ProcessItem(WmsCurrentMediaListItem, iSuccessCount);
  finally
    MediaItemList.Free
  end;
  WmsDatabaseAutoSave;
  ProcessMediaResult := True      
end.
click "Button on the main form" - Ok - Ok - Ok

List [Movies] - select a links - click "Youtube thumbnails"
Spookyy
Posts: 9
Joined: Wed Jul 27, 2011 2:43 pm

Re: Create thumbnail

Post by Spookyy »

Awesome! I'll take a look at this when i get home from my night shift.
Post Reply