Collections

Post Reply
Merlin
Posts: 2
Joined: Mon Feb 15, 2010 1:14 pm

Collections

Post by Merlin »

Hello,
Is there the possibility to include an option for the collections that you can specify witch files automatically included into the collection by there name?

I try to give an example:
I have an collection named "xyz abc" and I specify the file name pattern "xyz abc - S01*" at this collection.
And now, all Files (new scanned an already included) witch begins with "xyz abc - S01" are automatically included in this Collection.

You know what I mean?


Best regards,
Martin
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Collections

Post by Eugene »

Hello,
Merlin wrote: Is there the possibility to include an option for the collections that you can specify witch files automatically included into the collection by there name?

I try to give an example:
I have an collection named "xyz abc" and I specify the file name pattern "xyz abc - S01*" at this collection.
And now, all Files (new scanned an already included) witch begins with "xyz abc - S01" are automatically included in this Collection.

You know what I mean?


Best regards,
Martin
This can be done through the processing of media resources (Settings-Processing-Add)
Name: Create Serials Index
Click "Button on the main form"
Expression:

Code: Select all

function GetProperty(aItem: TWmsScriptMediaItem; aPropertyID: Integer): string;
begin
  Result := VarToStr(aItem.Properties[aPropertyID]);  
  if Result = '' then  
    Result := 'Unknown'
end;

procedure ProcessItem(aItem: TWmsScriptMediaItem);
var
  i: Integer;
  sCollectionPath, sSerialsFolder, sFileName: string; 
begin
  sFileName := ExtractFileName(GetProperty(aItem, mpiFilePath));  
  sSerialsFolder := Copy(sFileName, 1, 7);
  if MatchText(sSerialsFolder, ['aaa 111', 'bbb 111']) then begin
    sCollectionPath := 'Serials Index\' + sSerialsFolder + '\';                  
    WmsDatabaseAddLink(mfVideoCollectionsItemID, sCollectionPath, aItem);    
  end
end;

var
  i: Integer;
  AllMoviesFolder, SerialsIndexFolder: TWmsScriptMediaItem;
begin
  AllMoviesFolder := WmsFindMediaFolder(mfVideoAllMoviesItemID);
  if (AllMoviesFolder <> nil) and (AllMoviesFolder.ChildCount > 0) then begin 
    WmsShowProgress('Create Serials Index...');
    try
      SerialsIndexFolder := WmsFindMediaFolder(mfVideoCollectionsItemID, 'Serials Index');
      if SerialsIndexFolder <> nil then
        SerialsIndexFolder.DeleteChildItems;
      for i := 0 to AllMoviesFolder.ChildCount - 1 do begin
        if WmsCancelPressed then
          Break
        else begin  
          ProcessItem(AllMoviesFolder.ChildItems[i]); 
          WmsSetProgress(Round(((i + 1) / AllMoviesFolder.ChildCount) * 100))
        end  
      end  
    finally
      WmsHideProgress
    end;
    if WmsCancelPressed then
      MessageDlg('Creating Serials Index interrupted by the user.', mtError, mbOK, 0)
    else begin
      WmsDatabaseAutoSave;
      MessageDlg('Creating Serials Index is succesful.', mtInformation, mbOK, 0)
    end  
  end else
    MessageDlg('No files to process.', mtError, mbOK, 0);
  ProcessMediaResult := True      
end.
Must change the line

Code: Select all

if MatchText(sSerialsFolder, ['aaa 111', 'bbb 111']) then begin
ogre111
Posts: 3
Joined: Fri Feb 19, 2010 8:44 pm

Re: Collections

Post by ogre111 »

Eugene wrote: Must change the line

Code: Select all

if MatchText(sSerialsFolder, ['aaa 111', 'bbb 111']) then begin
I made a collection House and i want a file named House.S06E13.HDTV.XviD-XII to be added to the collection, then I have to change it to

Code: Select all

if MatchText(sSerialsFolder, ['House', 'House']) then begin
?

I did it, and it doesn't work.
Post Reply