Create automated playlists

Post Reply
mic
Posts: 4
Joined: Sun Dec 05, 2010 5:44 pm

Create automated playlists

Post by mic »

Hi there,

i'm new to WMS and quite bad at scripting. ;-(

so..
Is it possible to create a collection named like "Movies added in the last 30 days", where all Movies, added within the the last month, ordered by their file-creation date are listed?

Thanks!
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Create automated playlists

Post by Eugene »

Hi,
mic wrote:
i'm new to WMS and quite bad at scripting. ;-(

so..
Is it possible to create a collection named like "Movies added in the last 30 days", where all Movies, added within the the last month, ordered by their file-creation date are listed?
May be useful: Settings - Additional - Events - "After adding of media resource at scanning" - "After addition of media resource at scanning": Adding new media resources to a folder "Playlists\Recently Added"
mic
Posts: 4
Joined: Sun Dec 05, 2010 5:44 pm

Re: Create automated playlists

Post by mic »

thx for your fast answer..

but..

- i can't find that setting: "Adding new media resources to a folder "Playlists\Recently Added" " :-( ?

EDIT: SRY, tried it! Function working, but second question is still 'active' ;-)
wms_1.PNG
wms_1.PNG (67.45 KiB) Viewed 7786 times
- and.. thats not exactly what i'm trying to do.. I want a folder, which includes all files not older than one month (creation date on disk), all the time. If i start WMS on 10/12/2010 all movies created between 11/11/2010 and 10/12/2010 are in that folder. If if use wms two days later all files created between 13/11/2010 and 12/12/2010 should be listed.
I think thats only possible with scripting?
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Create automated playlists

Post by Eugene »

mic wrote: - and.. thats not exactly what i'm trying to do.. I want a folder, which includes all files not older than one month (creation date on disk), all the time. If i start WMS on 10/12/2010 all movies created between 11/11/2010 and 10/12/2010 are in that folder. If if use wms two days later all files created between 13/11/2010 and 12/12/2010 should be listed.
I think thats only possible with scripting?
1. Folder Collections
2. Right click - Add Folder
3. Title: Movies added in the last 30 days
4. Type: Dynamic (Script)
5. Click Script
6.

Code: Select all

var
  i: Integer;
  AllMoviesFolder: TWmsScriptMediaItem;
begin
  AllMoviesFolder := WmsFindMediaFolder(mfVideoAllMoviesItemID);
  if AllMoviesFolder <> nil then  
    for i := 0 to AllMoviesFolder.ChildCount - 1 do    
      if Date - StrToDateTime(AllMoviesFolder.ChildItems[i].Properties[mpiFileDate]) <= 30 then
        WmsDatabaseAddLink(FolderItem.ItemID, '', AllMoviesFolder.ChildItems[i])
end.
7. Ok - Ok
mic
Posts: 4
Joined: Sun Dec 05, 2010 5:44 pm

Re: Create automated playlists

Post by mic »

Thank you for your help!

Needed to modify the script a little bit to work - i got an error: "" is not a valid date and time

Code: Select all

var
  i: Integer;
  AllMoviesFolder: TWmsScriptMediaItem;
begin
  AllMoviesFolder := WmsFindMediaFolder(mfVideoAllMoviesItemID);
  if AllMoviesFolder <> nil then 
    for i := 0 to AllMoviesFolder.ChildCount - 1 do  
      if Date - GetFileDate(AllMoviesFolder.ChildItems[i].Properties[mpiMediaResourceSource]) <= 30 then      
        WmsDatabaseAddLink(FolderItem.ItemID, '', AllMoviesFolder.ChildItems[i])        
end.
.. i realized that pascal script is easier than i thought ;-)
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Create automated playlists

Post by Eugene »

In the folder "All Movies" may be other folders, in the original script is not checked and not processed

Code: Select all

if not AllMoviesFolder.ChildItems[i].IsFolder then  // version 1.07.2
...
mic
Posts: 4
Joined: Sun Dec 05, 2010 5:44 pm

Re: Create automated playlists

Post by mic »

thx.. but are u sure?

I'm not missing any files in the collection..
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Create automated playlists

Post by Eugene »

Movies folders, DVD structure folders, BD Playlists - yes, I am sure. If you have everything working, then that is fine.
Post Reply