mirror of
https://github.com/FakeTV/pseudo-channel.git
synced 2025-12-22 19:23:21 +00:00
Updated the random movie logic concept.
This commit is contained in:
@@ -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".
|
||||||
|
|||||||
Reference in New Issue
Block a user