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
Compare revisions
main to ca62e57a43b69502fb1389c0a7891b362948c662
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
sumpfralle/aura-engine
Select target project
No results found
ca62e57a43b69502fb1389c0a7891b362948c662
Select Git revision
Branches
dev-old
dev-old-david
develop
lars-tests
master
master-old
topic/filesystem-fallbacks
topic/tank_connection
topic/tank_connection_david
user/equinox/docker
10 results
Swap
Target
aura/engine
Select target project
aura/engine
hermannschwaerzler/engine
sumpfralle/aura-engine
3 results
main
Select Git revision
Branches
122-synchronized-ci
feat-use-docker-main-tag
fix-aura-sysuser
fix-broken-pipe-153
fix-docker-release
fix-push-latest-with-tag
fix-streamchannel-retries
gitlab-templates
improve-test-coverage-137
improve-test-coverage-143
main
orm-less-scheduling
remove-mailer
update-changelog-alpha3
virtual-timeslots-131
Tags
1.0.0-alpha1
1.0.0-alpha2
1.0.0-alpha3
1.0.0-alpha4
1.0.0-alpha5
20 results
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
systemd service/aura-engine.service
+14
-0
14 additions, 0 deletions
systemd service/aura-engine.service
systemd service/aura-lqs.service
+13
-0
13 additions, 0 deletions
systemd service/aura-lqs.service
test.py
+52
-0
52 additions, 0 deletions
test.py
testing/test.py
+145
-0
145 additions, 0 deletions
testing/test.py
with
224 additions
and
0 deletions
systemd service/aura-engine.service
0 → 100644
View file @
ca62e57a
[Unit]
Description
=
Aura Engine Playout Server
After
=
network.target
[Service]
Type
=
simple
User
=
gg
WorkingDirectory
=
/home/gg/PycharmProjects/engine
ExecStart
=
/home/gg/PycharmProjects/engine/aura.py
ExecStop
=
/home/gg/PycharmProjects/engine/guru.py --shutdown --quiet
Restart
=
always
[Install]
WantedBy
=
multi-user.target
This diff is collapsed.
Click to expand it.
systemd service/aura-lqs.service
0 → 100644
View file @
ca62e57a
[Unit]
Description
=
Aura Engine Playout Server
After
=
network.target aura-engine.service
Wants
=
aura-engine.service
[Service]
Type
=
simple
User
=
gg
ExecStart
=
/usr/bin/liquidsoap /home/gg/PycharmProjects/engine/modules/liquidsoap/engine.liq
Restart
=
always
[Install]
WantedBy
=
multi-user.target
This diff is collapsed.
Click to expand it.
test.py
0 → 100755
View file @
ca62e57a
#!/usr/bin/python3
from
libraries.database.broadcasts
import
*
import
simplejson
import
logging
import
sqlalchemy
from
modules.communication.liquidsoap.communicator
import
LiquidSoapCommunicator
from
modules.monitoring.diskspace_watcher
import
DiskSpaceWatcher
from
libraries.base.config
import
AuraConfig
def
alchemyencoder
(
obj
):
"""
JSON encoder function for SQLAlchemy special classes.
"""
if
isinstance
(
obj
,
datetime
.
date
):
return
obj
.
isoformat
()
elif
isinstance
(
obj
,
decimal
.
Decimal
):
return
float
(
obj
)
elif
isinstance
(
obj
,
sqlalchemy
.
orm
.
state
.
InstanceState
):
return
""
#elif isinstance(obj, Schedule):
# return simplejson.dumps([obj._asdict()], default=alchemyencoder)
else
:
return
str
(
obj
)
def
select_with_relationship
():
se
=
TrackServiceScheduleEntry
.
select_all
()
for
e
in
se
:
print
(
e
.
_asdict
())
# programme_as_string = simplejson.dumps([se[0]._asdict()], default=alchemyencoder)
# print(programme_as_string)
def
start_diskspace_watcher
():
config
=
AuraConfig
()
config
.
read_config
()
diskspace_watcher
=
DiskSpaceWatcher
(
config
.
config
,
logging
.
getLogger
(
"
AuraEngine
"
),
LiquidSoapCommunicator
(
config
.
config
))
diskspace_watcher
.
run
()
# # ## ## ## ## ## # #
# # ENTRY FUNCTION # #
# # ## ## ## ## ## # #
def
main
():
#select_with_relationship()
start_diskspace_watcher
()
# # ## ## ## ## ## ## # #
# # End ENTRY FUNCTION # #
# # ## ## ## ## ## ## # #
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
testing/test.py
0 → 100644
View file @
ca62e57a
import
os
import
unittest
import
validators
from
datetime
import
datetime
# libraries.base
from
libraries.base.logger
import
AuraLogger
from
libraries.base.config
import
AuraConfig
# libraries.database
from
libraries.database.broadcasts
import
Schedule
,
ScheduleEntry
,
TrackService
# libraries.security
from
libraries.security.user
import
AuraUser
# modules
from
modules.communication.liquidsoap.communicator
import
LiquidSoapCommunicator
from
modules.scheduling.scheduler
import
AuraScheduler
class
TestLogger
(
unittest
.
TestCase
):
aura_logger
=
None
def
setUp
(
self
):
self
.
aura_logger
=
AuraLogger
()
def
test_logger
(
self
):
self
.
assertTrue
(
self
.
aura_logger
.
logger
.
hasHandlers
())
class
TestConfig
(
unittest
.
TestCase
):
aura_config
=
None
def
setUp
(
self
):
self
.
aura_config
=
AuraConfig
()
def
test_config
(
self
):
# is ini path correct set?
self
.
assertEqual
(
self
.
aura_config
.
config
.
ini_path
,
"
/etc/aura/engine.ini
"
)
# install_dir is set by runtime. is it a directory?
self
.
assertTrue
(
os
.
path
.
isdir
(
self
.
aura_config
.
config
.
get
(
"
install_dir
"
)))
# calendarurl and importerurl set and valid urls?
self
.
assertTrue
(
validators
.
url
(
self
.
aura_config
.
config
.
get
(
"
calendarurl
"
)))
self
.
assertTrue
(
validators
.
url
(
self
.
aura_config
.
config
.
get
(
"
importerurl
"
)))
# is liquidsoap socketdir set and a directory?
self
.
assertTrue
(
os
.
path
.
isdir
(
self
.
aura_config
.
config
.
get
(
"
socketdir
"
)))
# database settings set?
self
.
assertIsNotNone
(
self
.
aura_config
.
config
.
get
(
"
db_user
"
))
self
.
assertIsNotNone
(
self
.
aura_config
.
config
.
get
(
"
db_pass
"
))
self
.
assertIsNotNone
(
self
.
aura_config
.
config
.
get
(
"
db_name
"
))
self
.
assertIsNotNone
(
self
.
aura_config
.
config
.
get
(
"
db_host
"
))
class
TestSchedule
(
unittest
.
TestCase
):
schedule
=
None
def
setUp
(
self
):
self
.
schedule
=
Schedule
()
def
test_schedule
(
self
):
# select one and check if its not None and a Schedule
entry
=
self
.
schedule
.
select_by_id
(
1
)
self
.
assertIsNotNone
(
entry
)
self
.
assertIsInstance
(
entry
,
Schedule
)
class
TestScheduleEntry
(
unittest
.
TestCase
):
schedule_entry
=
None
def
setUp
(
self
):
self
.
schedule_entry
=
ScheduleEntry
()
def
test_schedule_entry
(
self
):
# select one playlist and check if its not None, a ScheduleEntry
entry
=
self
.
schedule_entry
.
select_playlist
(
2
)
self
.
assertIsNotNone
(
entry
)
self
.
assertIsInstance
(
entry
,
list
)
self
.
assertGreaterEqual
(
len
(
entry
),
1
)
class
TestTrackService
(
unittest
.
TestCase
):
track_service
=
None
def
setUp
(
self
):
self
.
track_service
=
TrackService
()
def
test_track_service
(
self
):
day
=
datetime
.
strptime
(
"
19.03.2018
"
,
"
%d.%m.%Y
"
)
entry
=
self
.
track_service
.
select_by_day
(
day
)
self
.
assertIsNotNone
(
entry
)
self
.
assertIsInstance
(
entry
,
list
)
class
TestAuraUser
(
unittest
.
TestCase
):
aura_user
=
None
def
setUp
(
self
):
self
.
aura_user
=
AuraUser
()
def
test_add_user
(
self
):
username
=
"
user
"
password
=
"
password
"
role
=
"
admin
"
login_cnt
=
len
(
self
.
aura_user
.
getLogins
())
# insert user
key
=
self
.
aura_user
.
insertUser
(
username
,
password
,
role
)
self
.
assertGreaterEqual
(
len
(
self
.
aura_user
.
getLogins
()),
login_cnt
)
# selecting user and check data
user
=
self
.
aura_user
.
getUserByKey
(
key
)
self
.
assertEqual
(
user
[
"
username
"
],
username
)
# TODO: no encrypted storage.., but usermgm not really in use
self
.
assertEqual
(
user
[
"
password
"
],
password
)
self
.
assertEqual
(
user
[
"
role
"
],
role
)
class
TestLQSComm
(
unittest
.
TestCase
):
comm
=
None
def
setUp
(
self
):
# wosn do passiert?
p
=
AuraConfig
().
config
self
.
comm
=
LiquidSoapCommunicator
(
p
)
self
.
comm
.
scheduler
=
AuraScheduler
(
p
)
self
.
comm
.
init_player
()
def
test_get_active_channel
(
self
):
active_channel
=
self
.
comm
.
get_active_channel
()
print
(
active_channel
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
Next