"Delete currently playing file & remove from DB&quo

Any ideas about how to improve MediaMonkey for Windows 4? Let us know!

Moderator: Gurus

AlCapone
Posts: 22
Joined: Thu May 05, 2005 4:25 am

"Delete currently playing file & remove from DB&quo

Post by AlCapone »

There should have been a method to "delete currently playing file & remove it from DB"
- this function should be possible to map to a hotkey or be trigged by WM_message

Thank you.
trixmoto
Posts: 10023
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

If a track is selected in the Now Playing window then hitting the "Del" key will bring up a confirmation box asking if you want to:

1) Remove from Now Playing only
2) Delete from Now Playing and the library only
3) Delete from Now Playing, the library, and the computer

You can also check "In the future, do not ask me" if you wish this behaviour to remain the same every time.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
AlCapone
Posts: 22
Joined: Thu May 05, 2005 4:25 am

Post by AlCapone »

no good.
- The currently playing track is almost never "selected" - I do not plan to be sitting there and selecting each thing manually as they play, it is not enough to show MM window, and my goal is obviously to be able to do it even in minimized mode - for remote control purposes.


(It's a pity MM does not have as complete & advanced WM_message /hotkey interface as Zoomplayer does..)
trixmoto
Posts: 10023
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Well you could have an external hotkey program linking to a script which deletes the currently playing song and skips onto the next. This been discussed recently, not with you I presume! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Alcapone.

Post by Alcapone. »

I have been searching for such a script - another thread gives some *very* vague clues that does not help me..
trixmoto
Posts: 10023
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Create a file called something like "DeleteAndSkip.vbs" containing this code:

Code: Select all

Set SDB = CreateObject("SongsDB.SDBApplication")
curindex = SDB.CurrentSongIndex
SDB.Player.Next
SDB.Player.PlaylistDelete(curindex)
Set SDB = Nothing
Then use an external hotkey program to launch this script. Most multimedia keyboards have a few assignable keys so you could probably use one of those, or you can download software which allows you to add global hotkey shortcuts.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Steegy
Posts: 3450
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Remember that the intention is to "delete currently playing file & remove it from DB".
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
trixmoto
Posts: 10023
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Deleting from Now Playing in this way should trigger the confirmation box which allows you to choose that you want it removed from the db and/or your computer as well.

If not, please let me know, and I'll try harder! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Steegy
Posts: 3450
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Well, I put the following in an autostart vbs and the first now playing track is removed without confirmation (manually, there is a confirmation).

Code: Select all

Sub OnStartup 
SDB.Player.PlaylistDelete(0) 
End Sub
That's all I can say for now...

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
trixmoto
Posts: 10023
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Well still not sure about removing from the library, but this will delete from now playing and the computer.

Code: Select all

Set SDB = CreateObject("SongsDB.SDBApplication")
curindex = SDB.CurrentSongIndex
curpath = SDB.CurrentSong.Path
SDB.Player.Next
SDB.Player.PlaylistDelete(curindex)

Set filesys = CreateObject("Scripting.FileSystemObject")
filesys.DeleteFile curpath, True

Set filesys = Nothing
Set SDB = Nothing
However, now it's deleted from the computer you can use the "Dead Links" node to delete all the tracks from the library in one go.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
AlCapone
Posts: 22
Joined: Thu May 05, 2005 4:25 am

Post by AlCapone »

thank you, when I executed that script I got:

[Windows script host]
line 2
char 1
error: Object does not support property or method "SDB.CurrentSongindex"
code: 800A01B6
M$ VBscript runtime error.
trixmoto
Posts: 10023
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Sorry, typo, try this:

Code: Select all

Set SDB = CreateObject("SongsDB.SDBApplication")
curindex = SDB.Player.CurrentSongIndex
curpath = SDB.Player.CurrentSong.Path
SDB.Player.Next
SDB.Player.PlaylistDelete(curindex)

Set filesys = CreateObject("Scripting.FileSystemObject")
filesys.DeleteFile curpath, True

Set filesys = Nothing
Set SDB = Nothing 
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
AlCapone
Posts: 22
Joined: Thu May 05, 2005 4:25 am

Post by AlCapone »

trixmoto:
Thank you.
It works wery well - I use Girder for all automation, so getting a confirmation dialog is not a problem, and your script does just what I were looking for :)

Thank you.

BTW: do you have any idea how I could fetch path information ?
(I would like to make a confirmation-dialog that displays the file to be deleted.)

Regards.
trixmoto
Posts: 10023
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Try this:

Code: Select all

Set SDB = CreateObject("SongsDB.SDBApplication")
curindex = SDB.Player.CurrentSongIndex
curpath = SDB.Player.CurrentSong.Path

message = "Would you like to delete '"&curpath&"'?"
If SDB.MessageBox(message, mtConfirmation, Array(mbYes,mbNo)) = 6 Then
  SDB.Player.Next
  SDB.Player.PlaylistDelete(curindex)
  Set filesys = CreateObject("Scripting.FileSystemObject")
  filesys.DeleteFile curpath, True
  Set filesys = Nothing
End If

Set SDB = Nothing
N.B. Yes = 6
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
trixmoto
Posts: 10023
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

By the way, this:

Code: Select all

filesys.DeleteFile curpath, True
will delete read-only files. If you wish to only delete writeable files then change it to:

Code: Select all

filesys.DeleteFile curpath, False
:)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Post Reply