i tried to play the next unwatched in Progresss Episode and resume the point where i stop, but he always starts the episode from the begining and not from the last position.
in the wiki is this code, but that plays always from beginning.
i run in a little problem, i want to start the next unwatched inProgress Episode of a tvshow, but when there is no matching entry, i want that he plays a random episode of the tvshow, but i dont have any ideas if its possible to check if there is a episode with the first condition i dont believe or?
okay i found a way.
i check after the first Play command if the player is_idle when this is true, he sends a second play command with a random Episode of the TvShow.
Glad you found a workaround. There is a way to write more complex searches (e.g., logical âorâ searches for fallback) as shown in the âUsing Advanced Filtersâ section here: Library plexapi.library â Python PlexAPI documentation.
That being said, I havenât validated that âandâ/âorâ search syntax can be passed through as-is, but it seems like it should be possible without any changes on the HA side.
I was happy too early, it worked once, then it was over.is also clear, the first condition is always true. canât I omit the condition from the choose so that it only executes the code? this then runs into an error, because it does not find an appropriate episode, then it should skip to the other option
the problem is that he ends the automation after the first send command dont work, when he than execute the second there was no problem.
okay can you give me a little example how the call must be with this advanced filters?
I found a workaround for the other problem, but itâs not very practical. I have outsourced the first play command to a script, this must be started with script_on and not script_ so that the automation does not stop even if the script fails. Then I have to check whether the player has the status idle, unfortunately I have to take 15 seconds because it apparently takes a long time to run the script and change the status of the media player, I take a shorter time it doesnât work.
so you have unfortunately 15 seconds of silence until finally something is played. unfortunately this is impractical
Youâll probably need to wait for the continue_on_error feature in 2022.5 to avoid introducing a timeout. That should be released on May 4th. Without knowing if the first call failed youâd have to infer whatâs happening based on state, and that introduces a bit of guesswork.
Okay thank you for your time and help.
I thought I was too stupid after hours of try and error.
okay i wait for it, in the meantime i found a working workaround.
i check if the script is off, and than make the other conditions and commands, this takes only 3 seconds until before 15 seconds.
no, no luck, i dont know why he must have 14 seconds before check if the player is in idle, the script takes 0.7 seconds to run.
i added a 3 seconds delay, more than enough. but than he plays the new episode and stops and plays a random episode.
i dont understand why he needs 14 seconds for thisâŚ
Instead of using hardcoded delays, you may want to try using something like a wait_for_trigger and a wait timeout.
However youâre still going to run into the issue of not knowing if the first call succeeded. Instead of checking if itâs still idle after a timeout, maybe see how long it normally takes to change to the âplayingâ state when it succeeds.
Either way this problem is going to be overly complex to solve without knowledge of success/failure of that first step.