Author Topic: Reset playcount  (Read 7385 times)

BearthMark

  • Newbie
  • *
  • Posts: 18
Hi, is it possible to reset play count using the Plugin and Musicbee interface and if so, how do you do it?

redwing

  • Guest
Select tracks and go to Tools> Tagging Tools> Reset play count

BearthMark

  • Newbie
  • *
  • Posts: 18
Sorry, I'm really dumb for this one. I should have read my question before posting. I'm writing a plugin and I wanted to know if there was a method or piece of code I could use to reset the playcount.

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34313
a good place to get that sort of code would be from the tag tools plugin which has source code.
As long as you are using v3.1 (and possibly v3.0) you can update the playcount using Library_SetFileTag()

BearthMark

  • Newbie
  • *
  • Posts: 18
Yeah, I got the tagging tools source code (I wonder if it's the right one). Been searching but I'll see if I'm working with the latest API. I saw the Library_SetFileTag() method but the problem is playcount doesn't seem to be a metadata type, it's a file property type. Maybe I'm working with an old version of the Music Bee Plugin API. Let me see if there's an update version and I'll try again.


Thanks for your help.

BearthMark

  • Newbie
  • *
  • Posts: 18
Nah, still nothing. The value is unexposed. I don't think you can manipulate it from a plugin. The only way I can seem to change the Playcount is by using Plugin.PlayStatisticType.IncreasePlayCount.



This limits what my plugin can do but okay.  :(
Last Edit: July 09, 2017, 02:45:13 PM by BearthMark

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34313
it works fine but its possible you might need v3.1. Search the forum as changing play counts has come up before

BearthMark

  • Newbie
  • *
  • Posts: 18
Okay, I'll try downloading the 3.1 API.

I did search through the forum last night and came up with this -

https://getmusicbee.com/forum/index.php?topic=22010.msg129205#msg129205


BearthMark

  • Newbie
  • *
  • Posts: 18
Okay, still the same issue with the 3.1 C# API source code.

What I'm trying to say here is because Playcount is a file-property type and not a Metadata type, you can't change it from a Plugin unless you use PlayStatisticType.IncreasePlaycount, which only increases playcount by 1. You can't decrease the playcount or reset it.

reference:https://getmusicbee.com/forum/index.php?topic=22010.msg129205#msg129205

I know you can reset the playcount using tagging tools inside of Musicbee but you can't seem to do it from a plugin. There just isn't a method inside of the Musicbee Plugin API (Class/interface/structure) that allows you to change fileproperties.

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34313
i guess i will need to spell it out

Library_SetFileTag(url, (MetaDataType)FilePropertyType.PlayCount, "0");
Library_CommitTagsToFile(url);
and when completed to force the MB gui to refresh
MB_RefreshPanels();

BearthMark

  • Newbie
  • *
  • Posts: 18
Oh shit thanks, I tried casting to Metadata before but I didn't commit to file.

Thanks bigtime.