Tv show shuffle

I made a option in my dev theme so you can play individual season episodes or all episodes via shuffle. Obviously when you watch tv normally you may want to watch them individually or via continuous play and/or in order as they become available, more power to ya. But what if you have kids that you want to dump a ton of random shows on if they are driving you nuts or want to watch a show randomly to simulate continuous random tv (fight night, UFC, Sports etc)? Better yet what if you don't desire to make a playlist via plexweb for ea individual tv show. Well now you can simply do it right from PlexConnect by simply clicking the shuffle option in the episode list. Here is the commit:

 

Episode Shuffle (fanart on/off compliant)

 

Enjoy ;)

 

https://www.youtube.com/watch?v=n-eWfInFOlU

Thanks, I will try it out tonight. 

One question though - are episodes really shuffled? I mean including the first one in the list. My use case is exactly as you explained, I have a kid and I need to shuffle a bunch of Peppa Pig episodes but having shuffled playlist starting always with first episode is, huh..., very inconvenient.

This is by design from when baa first implemented video playlists. A simple down then right arrow will skip thru the first show in the list within 5 sec or so:

https://github.com/iBaa/PlexConnect/commit/deaa7c25a1ca8c6cc1da822c567b50b61ca65887

Im not sure why this is so, audio playlists shuffle without playing the first item. Maybe a iOS limitation? Im not sure...

Yes, now they are!

Will this old post help ?

You would have to add it to each show prior to the initial episode and then it would only work for all episodes or the first season unless you only had one season. Otherwise creating a playlist the normal way would work as well instead. Hopefully adding the intro video would work out for his use.

Not needed anymore now that I made a new commit below.

You can now shuffle playlists (videos) and tv shows randomly without playing the first item ever again (unless it shuffles to it randomly). Enjoy ;)

Randomly Shuffle Video Playlists and TV shows w/o playing first video

You can now shuffle playlists (videos) and tv shows randomly without playing the first item ever again (unless it shuffles to it randomly). Enjoy ;)

Randomly Shuffle Video Playlists and TV shows w/o playing first video

My man! Are you planing to make a pull request for iBaa for inclusion in mainline?

@iBaa - I guess this could be toggled on/off in setting for those who don't want it?

That's an interesting approach - though a bit creepy to me.

- in the edited line (7) partIndex really doesn't seem to be initialized. That way, well, you might get some "random-ness".

- if it has a valid number (for whatever reason), you might get another initial show, true. But the first show from the real shuffled shows will get skipped, plus the initial played show might show up later again.

I didn't test it thoroughly, but my guess is that aTV is requested to play some unavailable files / or even out-of spec URL, directly skipping to the 2nd episode. This would leave the original 1st episode unplayed, forever.

Did anybody try to verify the generated XMLs?

I didn't test it thoroughly, but my guess is that aTV is requested to play some unavailable files / or even out-of spec URL, directly skipping to the 2nd episode. This would leave the original 1st episode unplayed, forever.

Did anybody try to verify the generated XMLs?

Just made a test with 3 episodes - shuffled list was - 2nd video, 3rd video, 2nd video - so you are right.

Better way may be inserting a false "zero video" just before the 1st one and shuffling afterwards. Fake, zero position video would stay always as the first item in the shuffled list but it will be skipped as unplayable? I'm lacking proper coding skills to try it out, though.

Another thing I just noticed is that if you use left or right on a remote in order to skip to previous/next item it does not work. At least this is how ATV skips playlists items played from iTunes or Youtube?

The first item in the list now shuffles also, metadata is fixed as well. The first randomly shuffled item still plays at the end of the playlist or shuffled tv show. If someone can figure out how to remove the first shuffled item from being played at the end of the list this will shuffle video content randomly when played without playing the first item anymore:

bug fix for shuffle (metadata & also play first item in list)

... I really would like to see the XML output (aTV-XML) of two or three shuffled playlists with a limited number of files.

I can send you one if you want, I tested it out quite a bit (for a few hours) and this was the results each time (testing using a 3 episode season):

When I hit shuffle it plays a random file (say 1 2 or 3) then which ever plays first upon shuffle it plays at the end so if it played episode 2 first it plays 1 or 3 (2nd and 3rd) then 2 at the end:

From first to last upon shuffle (2-->1-->3-->2)

Then if tested again it would go like this if episode one played first upon shuffle. episode 1 first then 3 or 2 (2nd and 3rd) then 1 at the end:

From first to last upon shuffle (1-->3-->2-->1)

I assume the aTV XML you want is from the loglevel=High PlexConnect.log?

>>I assume the aTV XML you want is from the loglevel=High PlexConnect.log?

yes... :-D

I didn't skip to the end of each video to end the playlist. Let me know if you need me to do so or if this is sufficient:

shuffle1.xml

shuffle2.xml

shuffle3.xml

Edit - skipped to the end of the playlist:

shufflethru1.xml

shufflethru2.xml

shufflethru3.xml

Ok, I still don't fully get how this thing shuffles... but here comes me trying to explain:

My guess - the "@copyVideo", that you added into the first/main actually gets fed by the XML part selected in the lower loop - the one filling the section. This at least fits to your experience, that the last clip is basically a duplicate of the first...

All of that might be related to the "two-pass" approach of the XMLConverter - first create all the leafs and stuff, the overall structure of the XML (using CUT, COPY), then later fill in the value fields (VAL, URL, ... you name it).

Again, this is not the way it is supposed to work. And I don't see a good chance to remove that last clip (as it is basically needed to fill in the initial player data). But it's interesting how it works slightly beyond specification... :-D

Ok, I still don't fully get how this thing shuffles... but here comes me trying to explain:

My guess - the "@copyVideo", that you added into the first/main actually gets fed by the XML part selected in the lower loop - the one filling the section. This at least fits to your experience, that the last clip is basically a duplicate of the first...

All of that might be related to the "two-pass" approach of the XMLConverter - first create all the leafs and stuff, the overall structure of the XML (using CUT, COPY), then later fill in the value fields (VAL, URL, ... you name it).

Again, this is not the way it is supposed to work. And I don't see a good chance to remove that last clip (as it is basically needed to fill in the initial player data). But it's interesting how it works slightly beyond specification... :-D

This discussion is beyond my programing skills but if the last item is needed for player initialization, can't we then remove the first one instead, before giving a playlist to a player?

So is there any way to inform the shuffled playlist to play all -1 item at the end using this alternative shuffle? Would xmlconverter.py (I assume) need an edit to cut the last item off or would the Play/Shuffle.xml need to be built differently?

@pecinko said:
Thanks, I will try it out tonight.

One question though - are episodes really shuffled? I mean including the first one in the list. My use case is exactly as you explained, I have a kid and I need to shuffle a bunch of Peppa Pig episodes but having shuffled playlist starting always with first episode is, huh…, very inconvenient.

I laughed out loud at this, that is literally my exact reason and need for shuffle.

@jamespower1990 said:

@pecinko said:
Thanks, I will try it out tonight.

One question though - are episodes really shuffled? I mean including the first one in the list. My use case is exactly as you explained, I have a kid and I need to shuffle a bunch of Peppa Pig episodes but having shuffled playlist starting always with first episode is, huh…, very inconvenient.

I laughed out loud at this, that is literally my exact reason and need for shuffle.

My fork shuffles the first item as well and is constantly synced to @baa:

@wahlman.j said:
The first item in the list now shuffles also, metadata is fixed as well. The first randomly shuffled item still plays at the end of the playlist or shuffled tv show. If someone can figure out how to remove the first shuffled item from being played at the end of the list this will shuffle video content randomly when played without playing the first item anymore:

bug fix for shuffle (metadata & also play first item in list)

Just added movie shuffle also to my theme so you don’t need to make an all movie playlist anymore and I don’t want to redo my all movie playlist anymore whenever I add or remove movies to keep it up to date which I find annoying:

Enjoy :slight_smile: