INTERACT FORUM

Windows => Plug-in Development => Topic started by: robydago on February 26, 2008, 07:25:00 am

Title: changing play stats using com
Post by: robydago on February 26, 2008, 07:25:00 am
hi,
is it possible to overwrite play stats ("Last Played" and "Number Plays") fields using COM Media Center Automation?

thanks
Title: Re: changing play stats using com
Post by: robydago on March 04, 2008, 10:14:41 am
* bump *

to be more clear (I hope):
once I get the MJFieldAutomation objects (http://wiki.jrmediacenter.com/index.php/MJFieldsAutomation#IMJFieldAutomation_.2A_GetField.28number_nField.29) corresponding to the "Last Played" and "Number Plays" fields, is it possible to write them?? (i.e. not just reading them)

thanks
Title: Re: changing play stats using com
Post by: John Gateley on March 04, 2008, 10:43:35 am
I'm not sure, but try the MJFileAutomation function to set a field:

http://wiki.jrmediacenter.com/index.php/MJFileAutomation#boolean_Set.28string_strField.2C_string_strValue.29

j
Title: Re: changing play stats using com
Post by: robydago on March 04, 2008, 03:10:11 pm
THANKS!!!

This works using Mr ChriZ Scripting Plugin!!!
 
Code: [Select]
For y = 0 To MJFiles.GetNumberFiles() - 1
       Dim MJFile as MediaCenter.IMJFileAutomation
       MJFile = MJFiles.GetFile(y)
       CurrentNumberPlays = MJFile.Get("Number Plays", 0)
       NewNumberPlays = CurrentNumberPlays + NumberPlaysIncreaseValue
       If CurrentNumberPlays <> NewNumberPlays then MJFile.Set("Number Plays", NewNumberPlays)
Next y

Now I have to work on Last Played but with dates it's not as easy as with numbers...

THANKS AGAIN!
Title: Re: changing play stats using com
Post by: John Gateley on March 04, 2008, 05:06:41 pm
glad it worked...

j
Title: Re: changing play stats using com
Post by: robydago on March 06, 2008, 02:01:01 pm
another question.

to get all files in a playlist, given the playlist name (PlayListName), i wrote something like this:

Code: [Select]
     For z = -2 To MJPlaylists.GetNumberPlaylists - 1
          MJPlaylist = MJPlaylists.GetPlaylist(z)
          If MJPlaylist.Name = PlayListName then
                   Dim MJFiles as MediaCenter.IMJFilesAutomation
                   PLFilesObject = MJPlaylist.GetFiles()
                   exit for
          end if
     Next z

it works, but looping trough all playlists and testing their name is very slow; is there another (smarter and faster) way to get a PlayList object given a playlist name?