Problem with script playlist too slow

Post Reply
pipTheGeek
Posts: 26
Joined: Sat Jan 01, 2011 10:25 pm

Problem with script playlist too slow

Post by pipTheGeek »

I have written a COM object in c# that reads the iTunes Music Library.xml file and exposes all the playlists. I've then written a script type playlist that uses this COM object to build an equivelent of the itunes playlists in WMS. It works. Except that it takes too long to run. If I browse in the WMS console it is okay but both my TV and Amp time out before the script has finished. The COM component takes about a second to process the XML file. The slowness appears to be caused by the script having to repeatedly call WmsFindMediaItemByFileName.

Is there anything I can do (or you can do) to speed it up? The script is currently in BasicScript as that is the language I am most comfortable with, would I get any benfit by changing the language?

Initially I had one script that processed several iTunes files and added folders for each. I have now changed to having multiple playlists each with a script attached in the hope that WMS would only run the script when the folder was requested, but either the device is making requests before I ask it to or WMS is running the scripts ahead of time as it hasn't helped. In fact, the Amp can't browse WMS at all if the scripted playlists are visible. Not even to get the root Music, Photo, Movie list.
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Problem with script playlist too slow

Post by Eugene »

pipTheGeek wrote:I have written a COM object in c# that reads the iTunes Music Library.xml file and exposes all the playlists. I've then written a script type playlist that uses this COM object to build an equivelent of the itunes playlists in WMS. It works. Except that it takes too long to run. If I browse in the WMS console it is okay but both my TV and Amp time out before the script has finished. The COM component takes about a second to process the XML file. The slowness appears to be caused by the script having to repeatedly call WmsFindMediaItemByFileName.

Is there anything I can do (or you can do) to speed it up? The script is currently in BasicScript as that is the language I am most comfortable with, would I get any benfit by changing the language?

Initially I had one script that processed several iTunes files and added folders for each. I have now changed to having multiple playlists each with a script attached in the hope that WMS would only run the script when the folder was requested, but either the device is making requests before I ask it to or WMS is running the scripts ahead of time as it hasn't helped. In fact, the Amp can't browse WMS at all if the scripted playlists are visible. Not even to get the root Music, Photo, Movie list.
You try use the processing of media resources (Settings - Processing), as an example "Create Artist Index".

Settings - "Media-resources" - Scanning - turn off "Skip intermediate folder"
Settings - Devices - choose a device - Settings - turn off "Exclude empty folders"
pipTheGeek
Posts: 26
Joined: Sat Jan 01, 2011 10:25 pm

Re: Problem with script playlist too slow

Post by pipTheGeek »

I've moved the script for one of the playlists into a processing script and amended it so it finds the correct folder to create sub folders from. However, it now fails to check. The first line is

Sub AddTracks(playlist,playFold)

When I click check script I get an error of ????????? ????????? and the cursor moves to this line. This worked fine in the playlist script so I don't understand why it now doesn't parse. (I have remembered to set the language to BasicScript).

Any ideas?
pipTheGeek
Posts: 26
Joined: Sat Jan 01, 2011 10:25 pm

Re: Problem with script playlist too slow

Post by pipTheGeek »

After some more playing, it appears that whatever I put in the script fails to check with the same error. Even if I put only an empty Sub or just a single comment in a brand new processing script. Is there something wrong with the BasicScript option for processing scripts?
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Problem with script playlist too slow

Post by Eugene »

pipTheGeek
Posts: 26
Joined: Sat Jan 01, 2011 10:25 pm

Re: Problem with script playlist too slow

Post by pipTheGeek »

Sorry, I don't see how that is helpful.

I've given up with BasicScript (I assumed it was going to be VBScript, it isn't, and the differences were annoying). I've converted the script to JScript instead, it now checks and runs. I see the new playlists in the WMS console, but devices don't see them, or see old versions. I tried excluding some of the playlists, the TV still didn't see the folder, so I put it back, now the TV sees the version before with some missing. And the web interface seeems to be showing something from yesterday and won't change. I've tried restarting the service, I've tried rescanning media resource but can't seem to make it display up-to-date on the TV.

I did try turning off the Skip Intermediate Folders and Exclude Empty Folders but that doesn't appear to make any difference. I've turned them back on at the moment.
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Problem with script playlist too slow

Post by Eugene »

pipTheGeek wrote:
Sorry, I don't see how that is helpful.

I've given up with BasicScript (I assumed it was going to be VBScript, it isn't, and the differences were annoying). I've converted the script to JScript instead, it now checks and runs. I see the new playlists in the WMS console, but devices don't see them, or see old versions. I tried excluding some of the playlists, the TV still didn't see the folder, so I put it back, now the TV sees the version before with some missing. And the web interface seeems to be showing something from yesterday and won't change. I've tried restarting the service, I've tried rescanning media resource but can't seem to make it display up-to-date on the TV.

I did try turning off the Skip Intermediate Folders and Exclude Empty Folders but that doesn't appear to make any difference. I've turned them back on at the moment.
You probably need to use WmsDatabaseAutoSave;
Post Reply