IncrementPlayerCount / DecrementPlayerCount

Get help for different MediaMonkey 5 Addons.

Moderators: jiri, drakinite, Addon Administrators

Barry4679
Posts: 2408
Joined: Fri Sep 11, 2009 8:07 am
Location: Australia
Contact:

Re: IncrementPlayerCount / DecrementPlayerCount

Post by Barry4679 »

Erwin Hanzl wrote: Fri Jun 17, 2022 6:01 am This request was from 20.9.2021 - and today, 9 months later, you answer.
I didn't notice that the beginning of this thread was that long ago.
But I was primarily responding to your suggestion from a few days ago.
There is a bug worth knowing about in the facility that you suggesting.
I wanted to warn about that. You have a problem with that?
Want a dark skin for MM5? This is the one that works best for me .. elegant, compact & clear.
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: IncrementPlayerCount / DecrementPlayerCount

Post by Erwin Hanzl »

If you read my post carefully, I'm referring to individual songs, with a note on multi-selection - direct entry of the Played# value.
NOTHING is added.

And no, I have no problem with your reference.
MMW 4.1.31.1919 Gold-Standardinstallation
OzPonder
Posts: 4
Joined: Wed Aug 12, 2020 4:11 pm

Re: IncrementPlayerCount and set Last Played to now

Post by OzPonder »

I found this thread researching options to resolve a similar sync need, and followed the suggestion to clone and modify the swapArtistTitle script to achieve both incrementing the playCounter and Last Played date (I drive a few smart playlists from Last Played). Here it is if it helps anyone:

Code: Select all

// C:\Program Files (x86)\MediaMonkey 5\Scripts\setLastPlayed\actions_add.js
// A simple script that sets last played
actions.setLastPlayednow = {
    title: _('Set Last Played to now'),
    hotkeyAble: true,
    disabled: uitools.notMediaListSelected,
    visible: window.uitools.getCanEdit,
    execute: async function () {
        var list = await uitools.getSelectedTracklist().whenLoaded();
        if (list. Count === 0) {
            return;
        }
		
        var msg = sprint(_('Are you sure that you want to set Last Played to now on %d files ?'), list.count);
        messageDlg(msg, 'Confirmation', ['btnYes', 'btnNo'], {
            defaultButton: 'btnNo',
            title: _('Set Last Played to now'),
        }, function (result) {
            if (result.btnID === 'btnYes') {
				var tmp;
				list.forEach(function(itm) {
					// Swap the fields
					itm.beginUpdate();
					itm.lastTimePlayed_UTC = app.utils.timestamp2DateTime( new Date().toISOString());
					itm.playCounter = itm.playCounter + 1;
					itm.endUpdate();
				});
				list.commitAsync();  
            }
        });                      
    }
}

window._menuItems.editTags.action.submenu.push({
        action: actions.setLastPlayednow,
        order: 22,
        grouporder: 10
});
Post Reply