Skip to content

Comments

feat: autoplay next episode support#779

Open
sudoAlphaX wants to merge 5 commits intoz411:masterfrom
sudoAlphaX:rework-autoplay
Open

feat: autoplay next episode support#779
sudoAlphaX wants to merge 5 commits intoz411:masterfrom
sudoAlphaX:rework-autoplay

Conversation

@sudoAlphaX
Copy link

@sudoAlphaX sudoAlphaX commented Jun 23, 2025

  • add autoplay mode handling in cli and in config
  • call new signal "finish" when player is closed after an "update"
  • handle the new finish signal in engine
  • add autoplay functionality in engine
  • add support for "finished" hook

Add new feature to autoplay next episode.

Testing and working for MPRIS and lsof. I couldn't get inotify based tracker to work at all, so i couldnt test that.

Inspiration

I've always wanted to use trackma to be my only anime watching app (as I download almost all of my anime using ani-cli, but also have an ani-cli hook in trackma, so I never really have a reason to not use it). But my only pain point is that it does not autoplay next episode, which is not helpful for "binging".

Of course I can use autoload.lua script for mpv, but I wanted a feature in trackma itself.

Working

I added a new signal called "finish". It is triggered whenever a player is closed after successfully watching an episode, i.e. when the player is open for atleast "tracker_update_wait_s" seconds.

Then I've added a new option called "autoplay_next" (defaults to false), which can be toggled at runtime.

The engine reacts to this signal, and plays the episode + 1 after checking runtime autoplay_next

Also added hook support for this finish signal.

TODO

The autoplay toggle is not yet ready for qt, gtk and curses interfaces. It is currently only available for the cli interface.

I prefer to have something like a switch in the interfaces below the play button (in the home page) to toggle autoplay on and off.

I do not know how to do this in the interfaces, I will need to look that up. In the meantime, if anyone is willing to help, it would be great.

Please let me know if i need to change anything in the code, or if you have any suggestions.

Created a new signal called "finish" which is called whenever a player
is closed (tested with mpris) whenever an update is due. This means if
an episode is just completed and it is needed to be updated, this signal
is called when that player is closed.

Intended to be used as a "episode completed" indicator for various uses
like autoplaying next episode
@sudoAlphaX
Copy link
Author

bump :(

@z411
Copy link
Owner

z411 commented Dec 21, 2025

Sorry I could just review just this now. I like the idea as I also like watching several episodes on a row. But wouldn't it better to use the playlist feature of the player for this? Like, feeding an episode list to the player? mpv would, in my experience, load them to a playlist and others I assume would do the same.

@FichteFoll
Copy link
Collaborator

For the playlist approach, we have #484 already that goes into that direction. However, I believe OP specifically wants to use ani-cli, from which I assume they want the next episode to be startedy dynamically because it does not exist on the file system.

if self.last_state == utils.Tracker.PLAYING and not self.last_updated:
self.msg.info('Player was closed before update.')
# Video was playing and timer reached zero but player just closed
elif self.last_state == utils.Tracker.PLAYING and self.last_updated and self.last_show_tuple:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't this also trigger when the player was simply paused after the timer has already reached zero (e.g. with the mpris tracker).

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.

3 participants