Clear Now Playing 2.0 - Updated 22/11/2005

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Clear Now Playing 2.0 - Updated 22/11/2005

Postby trixmoto on Tue Nov 22, 2005 12:49 pm

I thought I'd created a topic on this, but obviously I haven't. Here is a bit of background: viewtopic.php?t=4644

:o :D :o NEW CODE BELOW :o :D :o

judas wrote:Hey...i checked out the clear now playing script in your page, its a great idea...one small suggestion to add to the next version: why not leave say 10 (or five) files? that way you wouldn't start with an empty now playing...or i dont know if it can be done, but is there a way to know what was the last song in now playing that was played? this way you could remove all songs before that one and you get to keep the ones you didnt get to hear.


Code: Select all
'
' MediaMonkey Script
'
' NAME: ClearNowPlaying 2.0
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 22/11/2005
'
' FIXES: Added user definable parameters
'
' INSTALL: Copy to Scripts\Auto directory
'

limit = 100      'maximum number of songs to leave in now playing

clearall = 0       'set to 1 if you wish to clear all files
clearplayed = 1    'set to 1 if you wish to clear just those before the current
clearextra = 0      'set to 1 if you wish to clear all but the first (limit) songs
'NB. Only one of these options can be set to 1, the rest must be 0


sub OnStartup
If SDB.Player.PlaylistCount > limit Then
    If clearall = 1 Then
      SDB.Player.PlaylistClear
    ElseIf clearplayed = 1 Then
      If not fPlayed() Then fExtra()
    ElseIf clearextra = 1 Then
      fExtra()
    End If
  End If
End Sub

Function fPlayed ()
  cur = CInt(SDB.IniFile.StringValue("Player","NowPlayingPosition"))
  For i = 0 To cur-1
    SDB.Player.PlaylistDelete(0)
  Next

  If ( SDB.Player.PlaylistCount > limit ) Then
    fPlayed = false
  Else
    fPlayed = true
  End If
End Function

Function fExtra ()
  For i = limit To SDB.Player.PlaylistCount
    SDB.Player.PlaylistDelete(limit)
  Next   

  fExtra = true
End Function
Last edited by trixmoto on Wed Nov 07, 2007 5:06 pm, edited 3 times in total.
Loving the Monkey? - Get Gold
Check out my scripts at http://trixmoto.net including my top ten
Getting "Product Installation Error" when installing scripts? - Try this
Subscribe to my RSS feed for all the latest news
trixmoto
 
Posts: 8509
Joined: Fri Aug 26, 2005 8:28 am
Location: England

Postby trixmoto on Tue Nov 22, 2005 1:43 pm

Is there a way to know what was the last song in now playing that was played? I notice that when you close MM and reopen it, the song that was selected in now playing is selected again. Where is this information stored and can it be accessed from a script?
Loving the Monkey? - Get Gold
Check out my scripts at http://trixmoto.net including my top ten
Getting "Product Installation Error" when installing scripts? - Try this
Subscribe to my RSS feed for all the latest news
trixmoto
 
Posts: 8509
Joined: Fri Aug 26, 2005 8:28 am
Location: England

Postby psyXonova on Tue Nov 22, 2005 2:42 pm

Current now playing list is stored inside mediamonkey.m3u which is located under the My Music/Media Monkey folder.

Now playing position (or else last song played in now playing list) is stored inside the MediaMonkey.ini file, Player section, NowPlayingPosition line.
If NowPlayingPosition is 1 then the last song played was the second song inside the mediamonkey.m3u playlist.

There is a method (cant recall it now) to access MediaMonkey.ini entries.
As for m3u, cant remember if there is an out of the box method, but it is just a text file and thus you can easily parse its contents
psyXonova
 
Posts: 785
Joined: Fri May 20, 2005 8:57 am
Location: Nicosia, Cyprus

Postby trixmoto on Tue Nov 22, 2005 3:15 pm

I was looking in the database. Never though to look in the ini. Thanks! :)
Loving the Monkey? - Get Gold
Check out my scripts at http://trixmoto.net including my top ten
Getting "Product Installation Error" when installing scripts? - Try this
Subscribe to my RSS feed for all the latest news
trixmoto
 
Posts: 8509
Joined: Fri Aug 26, 2005 8:28 am
Location: England

Postby trixmoto on Tue Nov 22, 2005 3:18 pm

My .ini says "NowPlayingPosition=16" but in my Now Playing list the selected song is 62. Any ideas why the discrepancy?
Last edited by trixmoto on Tue Nov 22, 2005 3:26 pm, edited 2 times in total.
Loving the Monkey? - Get Gold
Check out my scripts at http://trixmoto.net including my top ten
Getting "Product Installation Error" when installing scripts? - Try this
Subscribe to my RSS feed for all the latest news
trixmoto
 
Posts: 8509
Joined: Fri Aug 26, 2005 8:28 am
Location: England

Postby psyXonova on Tue Nov 22, 2005 3:26 pm

I believe (not sure though) that the ini entry is written while MM shuts downs, so it can continue playback after it has restarted. So, shut down MM and the check for NowPlayingPosition (should be 61).
Now playing position is available through other methods when MM is running so there is no need to be written inside the ini.
psyXonova
 
Posts: 785
Joined: Fri May 20, 2005 8:57 am
Location: Nicosia, Cyprus

Postby trixmoto on Tue Nov 22, 2005 3:27 pm

It turns out MM is completely ignoring the .ini in the MM folder and created a new one in MyMusic folder. Why is it ignoring my .ini file?
Loving the Monkey? - Get Gold
Check out my scripts at http://trixmoto.net including my top ten
Getting "Product Installation Error" when installing scripts? - Try this
Subscribe to my RSS feed for all the latest news
trixmoto
 
Posts: 8509
Joined: Fri Aug 26, 2005 8:28 am
Location: England

Postby psyXonova on Tue Nov 22, 2005 3:31 pm

Ts, forgot to mention that MM reads the ini file inside my music folder
This way every user can personalize MM even on the same computer!

now playing list is personalized also
psyXonova
 
Posts: 785
Joined: Fri May 20, 2005 8:57 am
Location: Nicosia, Cyprus

Postby trixmoto on Tue Nov 22, 2005 3:38 pm

I thought if you put an ini in the program folder then it used this instead?

Anyway, any idea how to read from the ini file? [Found in helpfile!]
Loving the Monkey? - Get Gold
Check out my scripts at http://trixmoto.net including my top ten
Getting "Product Installation Error" when installing scripts? - Try this
Subscribe to my RSS feed for all the latest news
trixmoto
 
Posts: 8509
Joined: Fri Aug 26, 2005 8:28 am
Location: England

Postby judas on Tue Nov 22, 2005 4:26 pm

I hope i could be of any help here... :-)
judas
 
Posts: 572
Joined: Fri Jun 03, 2005 4:26 am
Location: Bogotá, Colombia

Postby trixmoto on Tue Nov 22, 2005 4:28 pm

Ok here is the new script. Much more advanced:

1) New version allows user to set limit to anything (default=100).
2) Has the option of:
a) Clearing list if over the limit (removing all)
b) Reducing list size to the limit (removing from the end)
c) Removing those before currently playing (removing from the beginning)

N.B. Option C - If this is still over the limit then option B is run and if you are listening to your list with shuffle mode on then this option doesn't really make sense!

An installer for this script can be downloaded from my website.

Code: Select all
See first post
Last edited by trixmoto on Wed Nov 07, 2007 5:06 pm, edited 2 times in total.
Loving the Monkey? - Get Gold
Check out my scripts at http://trixmoto.net including my top ten
Getting "Product Installation Error" when installing scripts? - Try this
Subscribe to my RSS feed for all the latest news
trixmoto
 
Posts: 8509
Joined: Fri Aug 26, 2005 8:28 am
Location: England

Postby judas on Tue Nov 22, 2005 5:49 pm

WOW!!! I was needing this...now MM loads so fast!!!!!

Heres something in return trix:

Image
judas
 
Posts: 572
Joined: Fri Jun 03, 2005 4:26 am
Location: Bogotá, Colombia

Postby onkel_enno on Wed Nov 23, 2005 6:37 am

Doesn't AutoDJ do the same???
SansaMonkey - for SanDisk Sansa and Rockbox Users

Please no PMs for Questions which should be asked in the Forum. Thx
onkel_enno
 
Posts: 2110
Joined: Fri Jan 14, 2005 6:45 am
Location: Germany

Postby trixmoto on Wed Nov 23, 2005 9:36 am

1) I don't think Auto-DJ does this when you start up. This script was originally designed to help load MM because it was struggling to read in a long Now Playing list on startup

2) If Auto-DJ does do this, then you'll be glad to know that my script is backward compatible with MM2.4 so people without Auto-DJ will still have a solution!

:)
Loving the Monkey? - Get Gold
Check out my scripts at http://trixmoto.net including my top ten
Getting "Product Installation Error" when installing scripts? - Try this
Subscribe to my RSS feed for all the latest news
trixmoto
 
Posts: 8509
Joined: Fri Aug 26, 2005 8:28 am
Location: England

Postby onkel_enno on Wed Nov 23, 2005 10:15 am

I didn't want to criticize it, I only wanted to give a hint :wink: :)
SansaMonkey - for SanDisk Sansa and Rockbox Users

Please no PMs for Questions which should be asked in the Forum. Thx
onkel_enno
 
Posts: 2110
Joined: Fri Jan 14, 2005 6:45 am
Location: Germany

Next

Return to Need Help with Addons?

Who is online

Users browsing this forum: No registered users and 4 guests