ISDBSongData::LastPlayed: Difference between revisions

From MediaMonkey Wiki
Jump to navigation Jump to search
No edit summary
 
Line 2: Line 2:


===Property description===
===Property description===
[[Category:Scripting|{{PAGENAME}}]]
[[Category:Automation objects|{{PAGENAME}}]]
[[Category:CoClass SDBSongData|{{PAGENAME}}]]
[[Category:Interface ISDBSongData|{{PAGENAME}}]]
Some discussion in [http://www.mediamonkey.com/forum/viewtopic.php?t=25687 this thread], in summary use vb datediff() function to compare dates (ie .LastPlayed > x seconds/minutes/hours/days/etc).
Some discussion in [http://www.mediamonkey.com/forum/viewtopic.php?t=25687 this thread], in summary use vb datediff() function to compare dates (ie .LastPlayed > x seconds/minutes/hours/days/etc).


Line 20: Line 13:


Another good [http://www.mediamonkey.com/forum/viewtopic.php?p=131973#131973 post] regarding dates in MM.
Another good [http://www.mediamonkey.com/forum/viewtopic.php?p=131973#131973 post] regarding dates in MM.
{{Property Summary|SongData|LastPlayed|Value|Songs|LastTimePlayed|Real|Last Played|2415018.5|}}
[[Category:Scripting|{{PAGENAME}}]]
[[Category:Automation objects|{{PAGENAME}}]]
[[Category:CoClass SDBSongData|{{PAGENAME}}]]
[[Category:Interface ISDBSongData|{{PAGENAME}}]]

Latest revision as of 02:38, 22 April 2008

CoClass SDBSongData, Interface ISDBSongData

Property Get/Let LastPlayed As Date


Property description

Some discussion in this thread, in summary use vb datediff() function to compare dates (ie .LastPlayed > x seconds/minutes/hours/days/etc).

Don't forget to take into account if using SQL with MM dates, to adjust for timezone differences between sqlite:

Now = (JulianDay('now','localtime')-2415018.5)

LastTimePlayed = JulianDay(LastTimePlayed)

These are for SQL, not for the 'date' object.

Another good post regarding dates in MM.

LastPlayed
Scripting Object SDBSongData
Value Name LastPlayed
Value Type Value
Database Table Songs
Field Name LastTimePlayed
Field Type Real
Tracklist Column Last Played
Example Data 2415018.5

Example Code

Complete script

Sub

  For iCounter = 0 to objSongList.count - 1                                    'SongLists
      Set objSongData = objSongList.Item(iCounter)
      ValueLastPlayed = objSongData.LastPlayed
      SDB.MessageBox "Value = '" &  ValueLastPlayed & "'", mtError, Array(mbOK)    'SDB.MessageBox
  Next
' objSongData.LastPlayed = ValueNewLastPlayed 'Commented Out For Safety
' objSonglist.UpdateAll              'Commented Out For Safety                 'UpdateAll
                         Updates db and writes tags (if checked in options)
End Sub