Wild media server (UPnP, DLNA, HTTP)
http://wildmediaserver.com/forum/

Dynamic folders with copying script
http://wildmediaserver.com/forum/viewtopic.php?f=19&t=1440
Page 1 of 1

Author:  Eugene [ Sun Mar 04, 2012 8:38 pm ]
Post subject:  Dynamic folders with copying script

This example demonstrates the ability to create dynamic folders and copying script to properties of child folders for creating further levels of navigation.

The folder Collections - right click - Add folder
Title: Realtime folders
Type: Dynamic (script)
click Script

Expression
Code:
const
  mpiFolderType         = 200; 
  mpiDynamicScript      = 500;
  mpiDynamicSyntaxType  = 501; 

function ItemLevel(aItem: TWmsScriptMediaItem): Integer;
begin
  Result := -1;
  while aItem <> nil do begin
    aItem := aItem.ItemParent;
    Inc(Result)
  end   
end;

var
  ChildFolder: TWmsScriptMediaItem; 
  i: Integer;
begin
//  WmsLogMessage(mtiInfo, FolderItem.Properties[mpiTitle]);
  if ItemLevel(FolderItem) < 10 then begin
    for i := 1 to 5 do begin
      ChildFolder := FolderItem.AddFolder(FolderItem.Properties[mpiTitle] + '_' + IntToStr(i));
      if ChildFolder <> nil then begin   
        ChildFolder.Properties[mpiFolderType] := FolderItem.Properties[mpiFolderType];       
        ChildFolder.Properties[mpiDynamicScript] := FolderItem.Properties[mpiDynamicScript];
        ChildFolder.Properties[mpiDynamicSyntaxType] := FolderItem.Properties[mpiDynamicSyntaxType];       
      end
    end   
  end else 
    for i := 1 to 5 do         
      WmsCreateMediaItem(FolderItem.Properties[mpiTitle] + '_Item_' + IntToStr(i), FolderItem.ItemID);
end.

Ok - Ok

Attachment:
realtime_folders.jpg
realtime_folders.jpg [ 134.71 KiB | Viewed 16738 times ]

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/