get avatar path from pkg_resources, refs #108
This commit is contained in:
parent
9a86bc23be
commit
0a16500133
@ -5,6 +5,7 @@ from owrx.sdr import SdrService
|
|||||||
from owrx.config import Config
|
from owrx.config import Config
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
import pkg_resources
|
||||||
|
|
||||||
|
|
||||||
class StatusController(Controller):
|
class StatusController(Controller):
|
||||||
@ -12,6 +13,7 @@ class StatusController(Controller):
|
|||||||
pm = Config.get()
|
pm = Config.get()
|
||||||
# convert to old format
|
# convert to old format
|
||||||
gps = (pm["receiver_gps"]["lat"], pm["receiver_gps"]["lon"])
|
gps = (pm["receiver_gps"]["lat"], pm["receiver_gps"]["lon"])
|
||||||
|
avatar_path = pkg_resources.resource_filename("htdocs", "gfx/openwebrx-avatar.png")
|
||||||
# TODO keys that have been left out since they are no longer simple strings: sdr_hw, bands, antenna
|
# TODO keys that have been left out since they are no longer simple strings: sdr_hw, bands, antenna
|
||||||
vars = {
|
vars = {
|
||||||
"status": "active",
|
"status": "active",
|
||||||
@ -23,7 +25,7 @@ class StatusController(Controller):
|
|||||||
"asl": pm["receiver_asl"],
|
"asl": pm["receiver_asl"],
|
||||||
"loc": pm["receiver_location"],
|
"loc": pm["receiver_location"],
|
||||||
"sw_version": openwebrx_version,
|
"sw_version": openwebrx_version,
|
||||||
"avatar_ctime": os.path.getctime("htdocs/gfx/openwebrx-avatar.png"),
|
"avatar_ctime": os.path.getctime(avatar_path),
|
||||||
}
|
}
|
||||||
self.send_response("\n".join(["{key}={value}".format(key=key, value=value) for key, value in vars.items()]))
|
self.send_response("\n".join(["{key}={value}".format(key=key, value=value) for key, value in vars.items()]))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user