INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: changing play stats using com  (Read 3108 times)

robydago

  • Citizen of the Universe
  • *****
  • Posts: 518
changing play stats using com
« 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
Logged

robydago

  • Citizen of the Universe
  • *****
  • Posts: 518
Re: changing play stats using com
« Reply #1 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
Logged

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: changing play stats using com
« Reply #2 on: March 04, 2008, 10:43:35 am »

robydago

  • Citizen of the Universe
  • *****
  • Posts: 518
Re: changing play stats using com
« Reply #3 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!
Logged

John Gateley

  • Citizen of the Universe
  • *****
  • Posts: 4957
  • Nice haircut
Re: changing play stats using com
« Reply #4 on: March 04, 2008, 05:06:41 pm »

glad it worked...

j

robydago

  • Citizen of the Universe
  • *****
  • Posts: 518
Re: changing play stats using com
« Reply #5 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?

Logged
Pages: [1]   Go Up