Page 1 of 1

How to sort movie collections?

Posted: Fri Mar 09, 2012 9:44 pm
by Rheingold
Hi,
under the folder Internet TV I create with a script a new Folder "TV Streams" an then in this folder a moviecollection "All" and also two folders "Country" and "Language". In these two folders ther are many movicollections with names like "Germany", "Austria", "Switzerland" or in the Language-Folder "English", "German", "French" these collections have the mediaitems with infos to streams matching the language or the country.
I didn't mange to sort the collections alphabethcally, neither in "All" nor in "Country" or "Language" the streams in the collections are sorted but not the collection names itself.

I wonder if there is a scripting function (command) for this sorting. Perhaps someone can help.

Code: Select all

Internet TV
  Folder: TV Streams
                MColl:  All
                          Streams: CNN
                                    BBC 
                                    RTL
                                    SF1
                                    ZDF
                                    etc.
                Folder Country
                           MColl Germany
                                        Streams: RTL
                                                 ZDF
                                                 etc.
                           MColl Austria
                                        Streams:  ORF 1
                                                  ORF 2
                                                  ect.
                Folder Language
                            MColl  German
                                        Streams:  ORF
                                                  RTL
                                                  etc. 

Re: How to sort movie collections?

Posted: Sat Mar 10, 2012 6:06 am
by Eugene
Hi,

You can use the method Sort

Code: Select all

   TVStreamsFolder.Sort('+mpTitle\+mpTitle\+mpTitle');

Re: How to sort movie collections?

Posted: Sat Mar 10, 2012 8:47 pm
by Rheingold
Hi Eugene,

thnx for your answer
TVStreamsFolder.Sort('+mpTitle\+mpTitle\+mpTitle');
but what's the meaning of the three parameters? I think +/- is ascending/decending sortorder, but why three mParameters and can I use other Parameters of a folders or of a mediacollection? What about more than three parameters?

Rheingold

Re: How to sort movie collections?

Posted: Sun Mar 11, 2012 6:16 am
by Eugene
Hi,
Rheingold wrote:
thnx for your answer
TVStreamsFolder.Sort('+mpTitle\+mpTitle\+mpTitle');
but what's the meaning of the three parameters? I think +/- is ascending/decending sortorder, but why three mParameters and can I use other Parameters of a folders or of a mediacollection? What about more than three parameters?
You can specify any number of sorting levels.
About mpTitle: Script window - "Functions, variables" - Variables - "Media resource parameters"

Re: How to sort movie collections?

Posted: Sun Mar 11, 2012 1:16 pm
by Rheingold
I tried it with this little script

Code: Select all

var
  TvFolder: TWmsScriptMediaItem;
  cc,i : integer;  
  names:string;  

begin
  tvfolder:=WmsCurrentMediaTreeItem;  
  cc:=tvFolder.ChildCount;
  showmessage(TVFolder.properties[mpiTitle]+' '+str(cc));
  i:=0;names:='';
  repeat    
    names:=names+TVFolder.childItems[i].properties[mpiTitle]+' ';  
    i:=i+1;  
  until i=cc;                                                       
  showmessage(names);
  TvFolder.Sort('+');  
  WmsDatabaseAutoSave;
  i:=0;names:='';
  repeat    
    names:=names+TVFolder.childItems[i].properties[mpiTitle]+' ';  
    i:=i+1;  
  until i=cc;                                                       
  showmessage(names);
end.
and I could see, that the childorder is changed in the database, but unfortunatly there was no change on the screen displaying the Moviefolders. Perhaps i missed something to refreh it?

Rheingold