[SOLVED] Addon to save Playcounter, LastPlayed, SkipCounter, LastSkipped to tag

Get help for different MediaMonkey 5 Addons.

Moderators: jiri, drakinite, Addon Administrators

Andre_H
Posts: 415
Joined: Thu Jan 21, 2021 2:04 pm
Location: Germany

[SOLVED] Addon to save Playcounter, LastPlayed, SkipCounter, LastSkipped to tag

Post by Andre_H »

Feature Request: Statistic Data to Tags.

I would really appreciate the possibility of automatically creating and filling custom tags like Playcounter, LastPlayed, SkipCounter, LastSkipped, etc., to write these data to the track tags (not only in database), just to be able to reconstruct this data in the event of a database crash or reset.

Maybe as daily or weekly sceduled job, or something like this, if "on the fly" consumes to much performance.

Any chance for these to MMW5.1, or anyone here who wants to pick this up for an Addon.
Last edited by Andre_H on Mon Jun 14, 2021 6:24 am, edited 3 times in total.
- MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 2016 # only essential addons # my 24/7 media server
- MMW MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 10 # playing, testing skins & addons # my desktop app
- MMA Pro (2.0.0.1063) on Android 10, 11, 12 Phones & Tabs # WiFi Sync # playing

- MP3Tag, MP3Diags, MP3DirectCut, IrfanView
Lowlander
Posts: 56465
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: [REQ] Addon to save Playcounter, LastPlayed, SkipCounter, LastSkipped to tag

Post by Lowlander »

You can backup the database to keep the data safe: https://www.mediamonkey.com/wiki/WebHel ... y_Database
Peke
Posts: 17446
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: [REQ] Feature or Addon request

Post by Peke »

Hi,
For those that do search here as of MM5 in File -> Manage Database you can set auto Backups of library and do a manual backup/restore.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Andre_H
Posts: 415
Joined: Thu Jan 21, 2021 2:04 pm
Location: Germany

Re: [REQ] Feature or Addon request

Post by Andre_H »

Hi there,

thank you for the response. The possibilities of a database backup are known to me and are used on daily base. But ... Suppose I accidentally delete a single album or an full artist or something like that ... Then doing a full database recovery may reset much more data than if I could restore the few missing ones from the MP3 tags.

Don't get me wrong: This is not meant as a bug report, or any critique. More a question about a additional function or possible add-on. I am currently save these tag-data with an export of a view from the database in CSV. Tags in the files would be more convenient, thats all.

Andre.
- MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 2016 # only essential addons # my 24/7 media server
- MMW MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 10 # playing, testing skins & addons # my desktop app
- MMA Pro (2.0.0.1063) on Android 10, 11, 12 Phones & Tabs # WiFi Sync # playing

- MP3Tag, MP3Diags, MP3DirectCut, IrfanView
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: [REQ] Feature or Addon request

Post by drakinite »

I could be wrong, but I believe that the file format for metadata in MP3 files (ID3v2) doesn't make it possible to add those custom tags to the file. It appears to me that the tags in ID3v2 are part of the spec, and can't be extended. (At least, not in a straightforward way.) See https://en.wikipedia.org/wiki/ID3#ID3v2 ... cification

If my assumption above is correct, then setting your database to be backed up on a regular basis is your best bet. I understand that the database backups being in the same AppData folder can be an irritation, but it is planned to allow DB backups in other locations in the future.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Lowlander
Posts: 56465
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: [REQ] Addon to save Playcounter, LastPlayed, SkipCounter, LastSkipped to tag

Post by Lowlander »

There are no ID3 tags for this, but you can use any custom tags via Extended Tags or use the Custom Tags both of which are supported by the ID3 standard. So any Addon that can take the info from the database and save it to either Extended Tags or Custom Tags would do the trick.

Ideally the Addon would auto-trigger when files are played or skipped.
Andre_H
Posts: 415
Joined: Thu Jan 21, 2021 2:04 pm
Location: Germany

Re: [REQ] Feature or Addon request

Post by Andre_H »

drakinite wrote: Mon Feb 01, 2021 8:26 pmI could be wrong, but I believe that the file format for metadata in MP3 files (ID3v2) doesn't make it possible to add those custom tags to the file.
I'm also not sure, I think I have read that a maximum of 3 custom tags could be saved. That would match the behavior of MMW%: As far as i tried, CustomField #1 to CustomField #3 are saved to Tag, 4-10 are not. (So, that is not meant as a technical fact, more an observation.)

I wouldn't care about players reading capabilities for these tags, i just want to store *all* relevant information in the database AND the tag, in case of database lost (or moving to another software - shame on me ... ;-))
- MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 2016 # only essential addons # my 24/7 media server
- MMW MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 10 # playing, testing skins & addons # my desktop app
- MMA Pro (2.0.0.1063) on Android 10, 11, 12 Phones & Tabs # WiFi Sync # playing

- MP3Tag, MP3Diags, MP3DirectCut, IrfanView
Andre_H
Posts: 415
Joined: Thu Jan 21, 2021 2:04 pm
Location: Germany

Re: [REQ] Feature or Addon request

Post by Andre_H »

Lowlander wrote: Mon Feb 01, 2021 8:36 pm So any Addon that can take the info from the database and save it to either Extended Tags or Custom Tags would do the trick.
Ideally the Addon would auto-trigger when files are played or skipped.
i will quote that again as soon as MMW5 is released and those scripting skilled people around here want to do some stuff.. ;-)
- MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 2016 # only essential addons # my 24/7 media server
- MMW MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 10 # playing, testing skins & addons # my desktop app
- MMA Pro (2.0.0.1063) on Android 10, 11, 12 Phones & Tabs # WiFi Sync # playing

- MP3Tag, MP3Diags, MP3DirectCut, IrfanView
Lowlander
Posts: 56465
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: [REQ] Feature or Addon request

Post by Lowlander »

Custom 1 through 10 should be saved to tag by MediaMonkey.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: [REQ] Feature or Addon request

Post by drakinite »

Hmmm. If that's true, do you think it'd be feasible for said addon to simply replicate the MM's database-saved tags into custom1-10?

Edit: Just saw Andre's mention that only Custom 1-3 are saved to tags. Maybe that's a bug?
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Andre_H
Posts: 415
Joined: Thu Jan 21, 2021 2:04 pm
Location: Germany

Re: [REQ] Feature or Addon request

Post by Andre_H »

drakinite wrote: Sat Feb 13, 2021 1:22 pm Edit: Just saw Andre's mention that only Custom 1-3 are saved to tags. Maybe that's a bug?
Checked it right now (v.2310), and yes! Tag01-10 are saved.
100% sure it wasn't as i tried it a few days ago, with RC3 (RC4?) maybe.
drakinite wrote: Sat Feb 13, 2021 1:22 pm Hmmm. If that's true, do you think it'd be feasible for said addon to simply replicate the MM's database-saved tags into custom1-10?
that would be simply ... great ... so ... where is those guy who has sufficient programming knowledge for this? :wink:

Edit: I like lowlander's idea with triggering on play or skip, but i even would be ok with some kind of sceduled task.
- MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 2016 # only essential addons # my 24/7 media server
- MMW MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 10 # playing, testing skins & addons # my desktop app
- MMA Pro (2.0.0.1063) on Android 10, 11, 12 Phones & Tabs # WiFi Sync # playing

- MP3Tag, MP3Diags, MP3DirectCut, IrfanView
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: [REQ] Feature or Addon request

Post by drakinite »

🙂
It's true I'm the new "addon guy", and I'd love to look into making it soon– but I'm in school at the minute, and it's taking most of my free time. I've purposefully not yet tracked it on Mantis, though, in case another potential addon developer wants to do it before I/we have a chance to get to it. I have a feeling that if we have it in our bug tracker, then they'll go "Oh, they claimed it. Guess I shouldn't bother."

So, note to any addon dev that wants to do this: Go for it!
If nobody has by the time I have enough time for it, I'll give it a shot 😉
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Andre_H
Posts: 415
Joined: Thu Jan 21, 2021 2:04 pm
Location: Germany

Re: [REQ] Feature or Addon request

Post by Andre_H »

drakinite wrote: Sat Feb 13, 2021 1:53 pm So, note to any addon dev that wants to do this: Go for it!
Just to be sure ... :wink:
- MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 2016 # only essential addons # my 24/7 media server
- MMW MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 10 # playing, testing skins & addons # my desktop app
- MMA Pro (2.0.0.1063) on Android 10, 11, 12 Phones & Tabs # WiFi Sync # playing

- MP3Tag, MP3Diags, MP3DirectCut, IrfanView
Ludek
Posts: 4947
Joined: Fri Mar 09, 2007 9:00 am

Re: [REQ] Addon to save Playcounter, LastPlayed, SkipCounter, LastSkipped to tag

Post by Ludek »

Technically it should be just about code like this:

Code: Select all


app.listen(app, 'trackmodified', function (track) {
    if (track.playCounter > 0 && track.playCounter != Number(track.custom6)) {
        track.custom6 = track.playCounter;
        track.commitAsync(); // saves to DB & tag
    }                    
});

Andre_H
Posts: 415
Joined: Thu Jan 21, 2021 2:04 pm
Location: Germany

Re: [REQ] Addon to save Playcounter, LastPlayed, SkipCounter, LastSkipped to tag

Post by Andre_H »

if you wanted to make the whole thing more "universal", i think you need to

- a little GUI (or INI file, or whatever) to allow the user to "map" what database-fields he want so save to what custom tag 1-10, (optional with a marker, if they are rather static or dynamic. Example: DateAdded, Source, Kind of Media, Ranking, etc. are static and only needs to copied / saved on change; PlayCount, etc. are dynamic and should be saved on event)

- build a batch-sync routine to initial save / full update (for all tracks, or per playlist, or per selected tracks, ...)

- build a routine like Ludek's Example to update the (marked/dynamic) fields on play, skip, edit, ...

not sure if that "dynamic/static thing" is necessary for performance reasons or whether everything can always be synced on the fly.

guess that's what i would do ... from the user's point of view. I am not a programmer :wink:
edit: "you" does not necessarily mean Ludek, but maybe those "Addon Guy" ... :wink:
- MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 2016 # only essential addons # my 24/7 media server
- MMW MMW 5.0.4.2690 (non-portable, shared DB & files) on Windows 10 # playing, testing skins & addons # my desktop app
- MMA Pro (2.0.0.1063) on Android 10, 11, 12 Phones & Tabs # WiFi Sync # playing

- MP3Tag, MP3Diags, MP3DirectCut, IrfanView
Post Reply