Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aura-engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Kruse
aura-engine
Commits
40ea31bd
Commit
40ea31bd
authored
5 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
Improved timer handling.
parent
cb9a3a2a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/scheduling/scheduler.py
+28
-20
28 additions, 20 deletions
modules/scheduling/scheduler.py
with
28 additions
and
20 deletions
modules/scheduling/scheduler.py
+
28
−
20
View file @
40ea31bd
...
...
@@ -359,38 +359,45 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
for
p
in
schedule
.
playlist
:
planned_entries
.
append
(
p
)
self
.
enable_entries
(
planned_entries
)
# FIXME Same playlists are repeated over time - test with different schedules/timeslots/playlists
# Therefore only passing the first playlist for now:
self
.
logger
.
warn
(
"
ONLY PASSING 1ST PLAYLIST OF PROGRAMME
"
)
self
.
enable_entries
(
planned_entries
[
0
])
self
.
print_message_queue
()
# ------------------------------------------------------------------------------------------ #
def
enable_entries
(
self
,
playlist
):
# now in unixtime
"""
Iterates over all playlist entries and assigs their start time.
Additionally timers for fadings are created.
Args:
playlist(Playlist): The playlist to be scheduled for playout
"""
now_unix
=
time
.
mktime
(
datetime
.
datetime
.
now
().
timetuple
())
time_marker
=
playlist
.
start_unix
# switch to check if its the first stream in loaded programme
first_stream_in_programme
=
True
# old entry for fading out
# Old entry for fading out
# FIXME retrieve active entry from previous playlist
old_entry
=
None
# FIXME Correct timing behaviour
time_marker
=
playlist
[
0
].
start_unix
for
entry
in
playlist
[
0
].
entries
:
track_len
=
(
entry
.
duration
/
1000000
/
60
)
time_marker
+=
track_len
# since we get also programmes from the past, filter these out
for
entry
in
playlist
.
entries
:
time_marker
+=
1
# FIXME ???
# Since we also get entries from the past, filter these out
if
time_marker
>
now_unix
:
# when do we have to start?
diff
=
time_marker
-
now_unix
diff
=
diff
/
100
# testing purpose
diff
=
3
# FIXME test
entry
.
start_unix
=
time_marker
# enable the three timer
self
.
enable_timer
(
diff
,
entry
,
old_entry
)
old_entry
=
entry
# store the old entry for fading out
old_entry
=
entry
# ------------------------------------------------------------------------------------------ #
def
enable_timer
(
self
,
diff
,
entry
,
old_entry
):
...
...
@@ -421,8 +428,9 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
# ------------------------------------------------------------------------------------------ #
def
add_or_update_timer
(
self
,
diff
,
func
,
parameters
):
timer
=
None
# FIXME check we there's an array passed
entry
=
parameters
[
0
]
planned_timer
=
self
.
is_something_planned_at_time
(
entry
.
s
chedule_start
)
planned_timer
=
self
.
is_something_planned_at_time
(
entry
.
s
tart_unix
)
# if something is planned on entry.entry_start
#FIXME
...
...
@@ -431,7 +439,7 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
planned_entry
=
planned_timer
.
entry
# check if the playlist_id's are different
if
planned_entry
.
playlist_id
!=
entry
.
playlist_id
:
if
planned_entry
.
playlist
.
playlist
_id
!=
entry
.
playlist
.
playlist
_id
:
# if not stop the old timer and remove it from the list
self
.
stop_timer
(
planned_timer
)
...
...
@@ -477,7 +485,7 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
# ------------------------------------------------------------------------------------------ #
def
is_something_planned_at_time
(
self
,
given_time
):
for
t
in
self
.
message_timer
:
if
t
.
entry
.
entry_
start
==
given_time
:
if
t
.
entry
.
start
_unix
==
given_time
:
return
t
return
False
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment