Updated the random movie logic concept.

This commit is contained in:
Justin Emter
2017-11-25 18:26:47 -08:00
parent 4d594ed8a0
commit 00ed0eb205

View File

@@ -3,12 +3,15 @@ PseudoChannelRandomMovie
In order to get a better randomization by avoiding movie repeates, In order to get a better randomization by avoiding movie repeates,
this class helps get a random movie based on its "lastPlayedDate". this class helps get a random movie based on its "lastPlayedDate".
The function keeps grabbing random movies, checking the "lastPlayedDate", A list of all the movies are passed into this class ordered by
comparing it with todays date, and checking the delta against "lastPlayedDate". The function then runs through the array to
the user specified "TIME_GAP_MONTHS" (which defaults at 6 [months]). find the first movie that satisfies the delta of "lastPlayedDate"
It stops and returns the first random movie that satisfies the condition. and "TIME_GAP_MONTHS". Then a new array with the rest of the movies
However, if it runs through every movie and no movie satifies the condition, that satisfy the condition is created. From there a random movie
it then simply returns any movie. is picked and returned. If however, the function hits the end of the
array of movies and the condition is not satisfied (all movies have
been played more recently than the "TIME_GAP_MONTHS"), a random movie
is then returned.
For smaller movie libraries it'll be useful to calculate a reasonable For smaller movie libraries it'll be useful to calculate a reasonable
"TIME_GAP_MONTHS". "TIME_GAP_MONTHS".