-
Notifications
You must be signed in to change notification settings - Fork 81
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
CLI: Added optional range param to 'play' command for easier continuous play of show #484
base: master
Are you sure you want to change the base?
Conversation
Noticed a problem with mpv where it goes recursively into the folder and adds any media file (.jpg/.flac/.mp3) to playlist. |
After more use, trackma-cli doesn't properly update series watched count. |
I believe a better solution would be to allow inputting an episode range to the play argument that may be open-ended on both sides and just appends all episodes from the library as arguments to the player call. I think most players support this. The defaults for the lower end would be the next episode and the higher and would be the last (continuous?) episode in the library. Examples: |
That sounds like a better idea. Removed mpv --playlist-index=[episode number] for now since playlist-index won't always correspond to the correct episode. |
I have implemented a play range function, I will test further.
|
651e9d9
to
042f1ee
Compare
for episode in range(playep, playto+1): | ||
ep = self.get_episode_path(show, episode, error_on_fail=False) | ||
if ep: | ||
arg_list.append(ep) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be safer to stop appending episodes after the first unfound episode because this suggested behavior is equivalent to silent failure. If episode 4 was missing but 5+ were not, that episode would not be added to the player's playlist and a user wanting hands-off playback would be likely to miss that this episode was never there. If instead we stopped adding episodes alltogether, the user is implicitly prompted to start investigating once he reaches the end of the playlist.
An alternative would be to abort on any error and request an episode range that can be found. For that, the default playto value needs to be the last available episode, not the show's total according to metadata.
In my local setup, some months ago i changed There's really a use case for selecting a specific range of episodes? It can be easy on CLI, but creating an option for this in the other interfaces is not trivial. Also, probably some trackers have problems when you enqueue multiple episodes at once (i use MPRIS), so i didn't make a PR before, but with a config, this behavior could be enabled only when supported. What do y'all think about it? Should I also make a PR? |
I can get behind that. Personally, I don't use the feature at all (as I have different means of selecting the next episode(s) to watch), but use case seems like a reasonable default to me and it's also easier to configure as a simple flag compared to a more complex episode range specification. Adjusting the various popups where you can insert an episode number in an input field to state that all following episodes are also queued should make this easy to understand as well.
What does the tracker have to do with this? Generally, the tracker should work regardless of whether the player is playing from a playlist or not (and I'd argue the player shouldn't hold file handles for files it isn't playing in the first place for trackers like inotify or fs handle polling).
Hardly, but I can see a use case for CLI specifically when invoked by other processes or on the shell for example. Not so much in a GUI. |
I'm sorry, i just assumed that, since only MPRIS can handle ani-cli #600. I did a test here and
I thought the same. So it would be better to implement both ideas then. I disagree with a number of code decisions here, so after #634 is closed, i will open my own PR and the maintainers can decide the best impl. Also, regarding the range notation:
Imho the relative behavior is more useful (both manually and in scripts), also the absolute behavior can be emulated with |
Agreed. In summary, I believe we have the following syntax options:
|
I think that we should always stop at the first missing episode, otherwise one could miss an episode without noticing, which is very frustrating. Especially if one have episodes from different sources. Or maybe we could make a new parameter, to change the behavior on CLI.
We could always convert But even if i love the chaining with I have possible a solution: changing
I'm not sure if i understood you mean My summary:
Then, a |
That is indeed what I meant and understood from your proposal, but that was definitely a misunderstanding. An open range is much more useful and consitent with the right-open-range version (and what I proposed initially), so I'd go with that. However, that still leaves us with the question about whether the numbers should be relative to the "last seen" episode or to 0. I propose to make them relative we can use a
+1 for stopping at the first unseen episode as well.
It's easier to just treat the expression differently when a comma occurs.
SGTM, though it should be renamed to |
Agreed.
It seems like it should be better to change I'm also not a fan of Since in scripts one should prefer stable arguments (where the outcome shouldn't change based on config.json), it would drive me nuts to see an bash script calling this:
I think In your examples you didn't show |
Disagree regarding introducing
None of your proposed characters can be re-purposed for marking a number as relative, though we could expore
If the script wants to explicit about it, it should indeed always specify a range. With the
Making
I was undecided whether a left-open range should begin at episode 1 or at the next unseen episode, so I didn't include it. One attempt would be to base this decision on whether the right end is relative or not, as I did above in the |
I think the left-open-range should always expand the same way, it's more intuitive and easier to implement correctly. Except for that, after thinking for a while, i agree completely with your last proposal, it's the most simple and reasonable solution. I'm working in the PR. |
These examples contradict each other. I highly favor the conversion of the second/third row, it's way more useful and simpler to setup; so i will leave that way for now. So as it is, the syntax parsing and opening of episodes is done, but i still need to add the new config option, along with documentation. I'm thinking, should i leave the option |
You're right, this doesn't make sense in the last proposal. I find |
I see, i think this inconsistency will favor a more usable interface. In my opinion, these will be the more common uses (ignoring the show index):
|
I disagree with any breaking changes (changing the current default behavior). Even if the new behavior might be more natural, people who use the command might (and will) be confused if we suddenly change the default behavior to be relative rather than absolute. If |
I see, i personally would prefer to prepend a character like
Would you guys prefer any other characters? |
I forgot to ask. Then you are also against leaving You are against leaving the blank range the same as |
In a vacuum, I believe what we agreed on earlier is a pretty good solution, but it does indeed break compatibility. Out of the alternatives presented so far:
As such, I favor the separate |
But if we use the We also lose the ability to mix absolute and relative numbers: I still prefer to remain with a single command, even if the relative prefix is a little odd. There's not that much of semantic difference between |
I have added @FichteFoll's suggestion of passing ranges of episodes to play function.
His examples:
Additionally:
Now also works with curses but no with secondary optional parameter (eg:
play 12 1 10
)only
play 12 1-10
and so on works.Added some verbosity to curses dialog
Added clearer error message on wrong input to play_episode
Might be a bit to verbose, I'm open to suggestions.