For To Long, Didn't Read --
SEE: TL:DR at bottom of post (will save you some time if you don't want to read the mess of text I ended up writing).
I'm reading and re-reading your post.. Maybe I'm dense.
Anyhow -- This is a live stream that never goes offline.. with several hundred viewers at any given time. Around 150 or so 45minute videos in the playlist. So the goal here is to randomize so those watching (and they watch literally for 3-4 hours or more at a time) to not see the same episode of the series I'm playing until all the others have been played.
I always have *Loop All* on,.. and *DID* have random on,.. but everyone complained that the same episodes were showing up time and time again..
For example.. 150 episodes/files -- It might play file 50, then 80, then 104, then 116, then 53, then 50 again, and so on.. For all 150 files to play it takes 4+ days.. With random on , in those 4 days there would be tons of repeats and not all series/episodes would have been played..
This wouldn't be an issue if it just occasionally played an episode it had just played a few hours before.. but for whatever reason it played them so often that people would notice,.. including myself. The simple goal is to have it NOT play an episode it has played until all the others have been played 1 time. Then it can reset the random order, and do so again.
To your question.. "Is it all right if the last file will be one of the first ones in the next (new) random order?" -- Well, preferably it would be one of the last .. if it must be placed at a certain position I suppose placing it in the middle of the random order would be just fine.
Also, I don't know if you are intending for it to be this way -- but it seems that maybe you are saying I will need to turn random off and then back on to get a new random order --
A few issues with that, if it is the case. This is a live video stream, and while I try to attend to it as much as possible, I obviously am not around all the time,.. so it would be nearly impossible to be at the computer at the exact time to reset the random order. Is there no way this can be automated?
Again my logic would be this:
Let's use 100 files for ease of math.
Set script (or playlist on Random and Loop-All) -- (I was kind of thinking this script/extension would replace the random feature of VLC as I don't know how it would modify the built in Random feature that is giving me issues) -- But however it works is fine.
Anyhow -- Set playlist on Loop-All (so that it can function , in theory, indefinitely, without any input from me after I press play the first time.)
The code does something like this:
Take all files in playlist (I DO play a a saved playlist) -- and generate a random order -- and then play that entire order like it was a set playlist NOT on random... since it randomized the playlist (sort of like if you pressed randomize in Winamp (if you are familiar) and then pressed play. -- THEN, at file 100 (the last file),.. it would automatically Re-randomize all the files, create new playlist order and play them.. and it goes on and on like this.
Or -- perhaps:
It is easier with code/script to eliminate using VLC's random and loop-all function all together on the command bar. (Essentially I suppose I would be using this extension to run my playlist, instead of the command bar's loopall/random) -- Anyhow, if so -- The script/extension would have a little easy menu in it that I could pull down and load my playlist file into, and then press GO -- (If I had to enter all the files manually one time into this script menu for it to work properly, I would be happy to do so.)
Then the script had the logic of:
1)Take all files entered (pseudo playlist) and generate a number correlation to each file. --
2) Script then uses Random Number Generator to mix up the order of the total number (say 50,13,99,4,33,76,21,5,... and so on till it has a complete random order of all files).
3) Script plays first Random file.
4) At end of the video playing, the script stores this number (or filename) and writes it to a text file on the hard drive (or into a memory address)
5) Script then queues up next file (video) to play, and does a check -- Does number correlated to this queued video = number stored at Step (4)? If yes, then =! do not play, queue next video and repeat the Does this filename (or number correlated to filename) = any number stored (obviously these stored names or numbers would be videos/files already played once) -- If no, then play file.
6) Somewhere in this logic would need to be a check of does Total Played files = Total Number of Files stored in list (file/memory)? If yes, then Go back to Step 1, which would re-randomize the list, and erase the stored played files in memory/file, and start over again with a New random order, and a clean memory of files already played.
Sheesh, Looking at that logic is bound to be confusing -- but I've done some basic scripting in other scripting languages but it has been a while.. but I know how code works on a very basic level.. so if that is too confusing just ignore it --
Code: Select all
From some simple scripting languages (and general bullshit) I've used I would do something like:
$totalfiles = all videos in playlist.
$file = current file (video about to be played).
$playedfiles = all videos that have been played once and stored.
$totalnumber = Total Number of Files (assigned a number) in playlist.
$playednumber = Total Number of Files that have been played.
#MENU
Insert Code to build menu with options that are applicable to this extension.
#BEGIN
Open playlist.xspf
*Insert Code For Randomizing the files in this list* (ie: Something using the RNG)
Save playlist.xspf > randomplaylist.xspf
$totalnumber = findstr /R /N "^" randomplaylist | find /C ":"
GOTO #FILE_CHECK
#FILE_CHECK
If $file != $playedfiles
THEN
GOTO #FILE_VIDEO_PLAY
ELSE
GOTO #NEXT_FILE
ENDIF
#NEXT_FILE
IF $playednumber = totalnumber
GOTO #BEGIN
ELSE
Open randomplaylist.xspf
Select.Next.File // Code to open the randomly generated playlist file and select the next file on the list.
$file = Next.File // Setting variable of the selected next filename.
CALL #FILE_CHECK
#FILE_VIDEO_PLAY
Play filename // The action of playing the file (video)
$playednumber = $playednumber + 1 // To set variable adding 1, so once it reaches the total $playednumber it starts the process all over.
GOTO #NEXTFILE
Ok, I am by no means a coder -- as is painfully obvious.. but the basic idea is to run a loop to take my playlist... randomize it,.. then perhaps write it to another filename (ie: Randomplaylist.txt) -- Then the code can use this new playlist file the code made,.. and filter through the file until EOF (end of file.. or with the use of $playednumber = $totalnumber) then Go back to the begining of the code. At the beginning of the code it would erase the randomplaylist.txt (or whatever extension) if it exists, and randomize the existing playlist.xspf file and write it to randomplaylist.txt for the code to work through until EOF, or the +1 counter on $playednumber equals the total lines in the file -- Which should equate to the total number of videos in the playlist.
Of course, some simple menu with a box to enter the name/path of my playlist file,.. and a START or GO button. (And any other options you think are needed on the menu). Obviously if the script/extension code is playing the files/videos then it wouldn't matter what I did with the loop and random buttons on the VLC command menu.
But, I know nothing of how the lua extensions integrate with the command line -- but maybe this fuzzy logic will give you some sort of idea of what I'm trying to accomplish.
I think a bit of smart thinking and it wouldn't take a huge amount of lines of code/script.
I remember scripting things years back in something called Vscript for a BBS and then while going to sleep thinking of another way to take 1000 lines of code and perform the same function with 10 lines of code. But, neat or bloated I care not!
Yes, I know the above example "code" is not real code.. it wouldn't work in any way, shape, or form! Maybe, it shows you just how much I need your help, lol.
TL:DR -- Basically to answer you question, I need something that can be left alone without any input from me after I start it that will take my playlist, randomize it,.. play all the files ONE time, then once it has played them all once, starts over -- re-randomizes them, and plays the new random order 1 time per file.. it won't work if I have to press a button after it plays each file 1 time. It literally needs to be on autopilot mode randomizing, playing all 150 files, then re-randomizing, playing all 150 files, re-randomizing, playing all 150 files.. ad infinitum.
Thank you so much for helping with this!