Author Topic: Remember Last Position of each track  (Read 7480 times)

simshaun

  • Newbie
  • *
  • Posts: 8
Hi,

I'm using MusicBee solely for listening to Audiobooks, and I wanted it to remember where I left off on each book (I listen to multiple books at a time), so I wrote this plugin.

https://github.com/simshaun/musicbee-audiobook-position-tracker
Last Edit: January 12, 2019, 06:25:07 PM by simshaun

frankz

  • Sr. Member
  • ****
  • Posts: 3834
Being too apparently inept to write a plugin myself I'm not sure of the significance or if it helps at all, but this exists in the API:

Code
        [Flags()]
        public enum LibraryCategory
        {
            Music = 0,
            Audiobook = 1,
            Video = 2,
            Inbox = 4
        }

simshaun

  • Newbie
  • *
  • Posts: 8
Thanks, but I don't think that helps. It looks like the API uses that for Library_AddFileToLibrary and Library_GetSyncDelta and that's it.

Maybe I can use Library_QueryFilesEx, but I'm not sure of the proper query. Seems like it accepts a string like domain=Library or an XML-like syntax (which I found in Tag Tools source), but all my guesses have come up short.

boroda

  • Sr. Member
  • ****
  • Posts: 4595
@simshaun, your suggestions are right. xml syntax for Library_QueryFilesEx (without 'domain=Library', its another possible syntax) is simplified xml from autoplaylists (which are xml-files). just create required autoplaylist and remove excessive tags (see tag tools plugin for example, unfortunately I don't have access to my source code now). maybe ipod driver plugin source code could be more useful for this situation (I recall that I somehow was filtering music, audiobooks, etc. in this plugin).

-----------------------------------------------------------------------------

I think you can easily implement the following request in you plugin (not through player controls, but through hotkeys/toolbar buttons):

https://getmusicbee.com/forum/index.php?topic=27649.0

boroda

  • Sr. Member
  • ****
  • Posts: 4595
@Steven, this plugin will work completely improperly on any *manual* seeking within track (in fact manual seeking will be impossible when this plugin is enabled). I think that mb must not send 'track changed' event on any seeking (manual or by plugin) within one track at all. its not logical.

simshaun

  • Newbie
  • *
  • Posts: 8
@boroda74

Are you talking about when I drag the scrobble to another spot in the track? It's working for me. All I'm doing is saving the position when the scrobble is moved.

Thanks for the advice on the query syntax. I'll take a look.

Edit: Bingo! <Source Type="32"></Source>
Last Edit: January 12, 2019, 05:25:13 PM by simshaun

boroda

  • Sr. Member
  • ****
  • Posts: 4595
Are you talking about when I drag the scrobble to another spot in the track? It's working for me. All I'm doing is saving the position when the scrobble is moved.
whats happening if you just click on any point at the progress bar (don't have mb now to check this)?

simshaun

  • Newbie
  • *
  • Posts: 8
I've got it working on Audiobooks only now. Woo!


@boroda74 Clicking any point in the progress bar is working. All I'm doing is saving the position when this occurs. Actually I should probably take that out to avoid potentially a lot of HDD writes if I'm dragging the scrobbler. It isn't really necessary anyway since I'm saving the position every second.


Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
@Steven, this plugin will work completely improperly on any *manual* seeking within track (in fact manual seeking will be impossible when this plugin is enabled). I think that mb must not send 'track changed' event on any seeking (manual or by plugin) within one track at all. its not logical.
testing this now, it doesnt send "track changed" notification and i dont see any code that would do that when changing the progress bar position

I've got it working on Audiobooks only now. Woo!
MB automatically remembers the position for audio books