Page 1 of 1
Create automated playlists
Posted: Wed Dec 08, 2010 7:06 pm
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!
Re: Create automated playlists
Posted: Wed Dec 08, 2010 7:23 pm
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"
Re: Create automated playlists
Posted: Wed Dec 08, 2010 7:43 pm
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 (67.45 KiB) Viewed 10058 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?
Re: Create automated playlists
Posted: Wed Dec 08, 2010 8:09 pm
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
Re: Create automated playlists
Posted: Wed Dec 08, 2010 9:52 pm
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

Re: Create automated playlists
Posted: Thu Dec 09, 2010 9:12 am
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
...
Re: Create automated playlists
Posted: Fri Dec 10, 2010 2:29 pm
by mic
thx.. but are u sure?
I'm not missing any files in the collection..
Re: Create automated playlists
Posted: Fri Dec 10, 2010 2:44 pm
by Eugene
Movies folders, DVD structure folders, BD Playlists - yes, I am sure. If you have everything working, then that is fine.