Clear Now Playing 3.1 - Updated 09/07/2012

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Clear Now Playing 3.1 - Updated 09/07/2012

Postby trixmoto » Tue Nov 22, 2005 7:49 am

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

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 3.1
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 09/07/2012
'
' INSTALL: Copy to Scripts\Auto directory
'
' FIXES: Fixed mode setting not storing correctly
'

Option Explicit       

Sub OnStartup
  'default settings
  Dim ini : Set ini = SDB.IniFile
  If ini.StringValue("ClearNowPlaying","Limit") = "" Then
    ini.IntValue("ClearNowPlaying","Limit") = 100
  End If
  If ini.StringValue("ClearNowPlaying","Mode") = "" Then
    ini.IntValue("ClearNowPlaying","Mode") = 4
  End If
 
  'add option sheet
  Call SDB.UI.AddOptionSheet("ClearNowPlaying Settings",Script.ScriptPath,"InitSheet","SaveSheet",-2)
 
  'run script
  Dim cur : cur = ini.IntValue("Player","NowPlayingPosition")
  Dim lim : lim = ini.IntValue("ClearNowPlaying","Limit")
  If SDB.Player.PlaylistCount > lim Then
    Select Case ini.IntValue("ClearNowPlaying","Mode")
      Case 1
        Call SDB.Player.PlaylistClear()
      Case 2
        Call ClearPlayed(cur,lim)
      Case 3
        Call ClearExtra(lim)
      Case 4
        If Not ClearPlayed(cur,lim) Then
          Call ClearExtra(lim)
        End If       
    End Select
  End If
End Sub

Function ClearPlayed(cur,lim)
  Dim i : i = 0
  For i = 0 To cur-1
    Call SDB.Player.PlaylistDelete(0)
  Next
  If SDB.Player.PlaylistCount > lim Then
    ClearPlayed = False
  Else
    ClearPlayed = True
  End If
End Function

Function ClearExtra(lim)
  Dim i : i = 0
  For i = lim To SDB.Player.PlaylistCount
    Call SDB.Player.PlaylistDelete(lim)
  Next   
  ClearExtra = True
End Function

Sub InitSheet(Sheet)
  Dim ini : Set ini = SDB.IniFile 
  Dim ui : Set ui = SDB.UI
  Dim edt : Set edt = ui.NewLabel(Sheet)
  edt.Common.SetRect 5, 10, 50, 20
  edt.Caption = "Run mode:"
  edt.Autosize = False 
 
  Set edt = ui.NewDropdown(Sheet)
  edt.Common.SetRect 80, 7, 300, 20
  edt.Common.ControlName = "CNPMode"
  edt.Style = 2
  edt.AddItem("Disabled")
  edt.AddItem("Clear all tracks")
  edt.AddItem("Clear played tracks")
  edt.AddItem("Clear tracks leaving 'limit' remaining")
  edt.AddItem("Clear played tracks then leave 'limit' remaining")
  edt.ItemIndex = ini.IntValue("ClearNowPlaying","Mode")
 
  Set edt = ui.NewLabel(Sheet)
  edt.Common.SetRect 5, 35, 50, 20
  edt.Caption = "Track limit:"
  edt.Autosize = False
 
  Set edt = ui.NewSpinEdit(Sheet)
  edt.Common.SetRect 80, 32, 50, 20
  edt.Common.ControlName = "CNPLimit"
  edt.MinValue = 0
  edt.MaxValue = 9999
  edt.Value = ini.IntValue("ClearNowPlaying","Limit")           
End Sub

Sub SaveSheet(Sheet)
  Dim ini : Set ini = SDB.IniFile 
  ini.IntValue("ClearNowPlaying","Mode") = Sheet.Common.ChildControl("CNPMode").ItemIndex
  ini.IntValue("ClearNowPlaying","Limit") = Sheet.Common.ChildControl("CNPLimit").Value
End Sub
Last edited by trixmoto on Wed Nov 07, 2007 12:06 pm, edited 3 times in total.
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby trixmoto » Tue Nov 22, 2005 8:43 am

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?
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby psyXonova » Tue Nov 22, 2005 9:42 am

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 3:57 am
Location: Nicosia, Cyprus

Postby trixmoto » Tue Nov 22, 2005 10:15 am

I was looking in the database. Never though to look in the ini. Thanks! :)
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby trixmoto » Tue Nov 22, 2005 10:18 am

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 10:26 am, edited 2 times in total.
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby psyXonova » Tue Nov 22, 2005 10:26 am

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 3:57 am
Location: Nicosia, Cyprus

Postby trixmoto » Tue Nov 22, 2005 10:27 am

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?
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby psyXonova » Tue Nov 22, 2005 10:31 am

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 3:57 am
Location: Nicosia, Cyprus

Postby trixmoto » Tue Nov 22, 2005 10:38 am

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!]
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby judas » Tue Nov 22, 2005 11:26 am

I hope i could be of any help here... :-)
judas
 
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Postby trixmoto » Tue Nov 22, 2005 11:28 am

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 12:06 pm, edited 2 times in total.
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby judas » Tue Nov 22, 2005 12:49 pm

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

Heres something in return trix:

Image
judas
 
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Postby onkel_enno » Wed Nov 23, 2005 1: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: 2145
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany

Postby trixmoto » Wed Nov 23, 2005 4: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!

:)
Download my scripts at trixmoto.net.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby onkel_enno » Wed Nov 23, 2005 5: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: 2145
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany

Next

Return to Need Help with Addons?

Who is online

Users browsing this forum: No registered users and 28 guests