Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rough implementation of automatic seekpoint using bookmarks #2437

Merged
merged 4 commits into from Jun 17, 2017

Conversation

Meriipu
Copy link
Contributor

@Meriipu Meriipu commented Jun 15, 2017

#2432

This could probably be tidier in ways but it seems to work well enough for me.
Set bookmark names to use for points (A,B) in plugin config if desired (defaults are A,B).
Create bookmarks A and /or B for a track, whenever plugin is enabled and track is played, it skips to point A if it exists and stops after point B if it exists.

Are there cleaner ways to detect whether a time tracker has been destroyed?
I destroy it if point B does not exist, as there is no point I can see checking every tick if the current position is past point B if point B does not exist.


def enabled(self):
self._SeekPoint_A, self._SeekPoint_B = self._get_SeekPoints()
self._try_create_tracker(force=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to just use enabled() and disabled() for creating/removing TimeTracker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the tracker be stopped and started otherwise so to not make on_tick callbacks for tracks that do not have a B-seekpoint, or is the overhead from that minimal?

# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# For more information, please refer to <http://unlicense.org>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the following license to fix the tests:

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

if self._SeekPoint_B <= time:
self._seek(app.player.info("~#length"))

def _get_SeekPoints(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use lowercase function names and variable names. https://www.python.org/dev/peps/pep-0008/#function-names

@lazka lazka merged commit 2b8a0d7 into quodlibet:master Jun 17, 2017
@lazka
Copy link
Member

lazka commented Jun 17, 2017

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants