mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-24 22:30:37 +01:00
Added config path argument
This commit is contained in:
parent
8375ea224a
commit
19bfe35fe3
@ -7,6 +7,7 @@ import sys
|
|||||||
import argparse
|
import argparse
|
||||||
parser = argparse.ArgumentParser(description="Sideband LXMF Client")
|
parser = argparse.ArgumentParser(description="Sideband LXMF Client")
|
||||||
parser.add_argument("-v", "--verbose", action='store_true', default=False, help="increase logging verbosity")
|
parser.add_argument("-v", "--verbose", action='store_true', default=False, help="increase logging verbosity")
|
||||||
|
parser.add_argument("-c", "--config", action='store', default=None, help="specify path of config directory")
|
||||||
parser.add_argument("-d", "--daemon", action='store_true', default=False, help="run as a daemon, without user interface")
|
parser.add_argument("-d", "--daemon", action='store_true', default=False, help="run as a daemon, without user interface")
|
||||||
parser.add_argument("--version", action="version", version="sideband {version}".format(version=__version__))
|
parser.add_argument("--version", action="version", version="sideband {version}".format(version=__version__))
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@ -182,10 +183,15 @@ class SidebandApp(MDApp):
|
|||||||
self.no_transition = NoTransition()
|
self.no_transition = NoTransition()
|
||||||
self.slide_transition = SlideTransition()
|
self.slide_transition = SlideTransition()
|
||||||
|
|
||||||
if RNS.vendor.platformutils.get_platform() == "android":
|
if args.config != None:
|
||||||
self.sideband = SidebandCore(self, is_client=True, android_app_dir=self.app_dir, verbose=__debug_build__)
|
self.config_path = os.path.expanduser(args.config)
|
||||||
else:
|
else:
|
||||||
self.sideband = SidebandCore(self, is_client=False, verbose=(args.verbose or __debug_build__))
|
self.config_path = None
|
||||||
|
|
||||||
|
if RNS.vendor.platformutils.get_platform() == "android":
|
||||||
|
self.sideband = SidebandCore(self, config_path=self.config_path, is_client=True, android_app_dir=self.app_dir, verbose=__debug_build__)
|
||||||
|
else:
|
||||||
|
self.sideband = SidebandCore(self, config_path=self.config_path, is_client=False, verbose=(args.verbose or __debug_build__))
|
||||||
|
|
||||||
self.set_ui_theme()
|
self.set_ui_theme()
|
||||||
self.font_config()
|
self.font_config()
|
||||||
@ -4972,7 +4978,14 @@ if not args.daemon:
|
|||||||
def run():
|
def run():
|
||||||
if args.daemon:
|
if args.daemon:
|
||||||
RNS.log("Starting Sideband in daemon mode")
|
RNS.log("Starting Sideband in daemon mode")
|
||||||
sideband = SidebandCore(None, is_client=False, verbose=(args.verbose or __debug_build__), is_daemon=True)
|
sideband = SidebandCore(
|
||||||
|
None,
|
||||||
|
config_path=args.config,
|
||||||
|
is_client=False,
|
||||||
|
verbose=(args.verbose or __debug_build__),
|
||||||
|
is_daemon=True
|
||||||
|
)
|
||||||
|
|
||||||
sideband.start()
|
sideband.start()
|
||||||
while True:
|
while True:
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
@ -106,7 +106,7 @@ class SidebandCore():
|
|||||||
# stream logger
|
# stream logger
|
||||||
self.log_announce(destination_hash, app_data, dest_type=SidebandCore.aspect_filter)
|
self.log_announce(destination_hash, app_data, dest_type=SidebandCore.aspect_filter)
|
||||||
|
|
||||||
def __init__(self, owner_app, is_service=False, is_client=False, android_app_dir=None, verbose=False, owner_service=None, service_context=None, is_daemon=False):
|
def __init__(self, owner_app, config_path = None, is_service=False, is_client=False, android_app_dir=None, verbose=False, owner_service=None, service_context=None, is_daemon=False):
|
||||||
self.is_service = is_service
|
self.is_service = is_service
|
||||||
self.is_client = is_client
|
self.is_client = is_client
|
||||||
self.is_daemon = is_daemon
|
self.is_daemon = is_daemon
|
||||||
@ -139,10 +139,14 @@ class SidebandCore():
|
|||||||
self.service_context = service_context
|
self.service_context = service_context
|
||||||
self.owner_service = owner_service
|
self.owner_service = owner_service
|
||||||
|
|
||||||
self.app_dir = plyer.storagepath.get_home_dir()+"/.config/sideband"
|
if config_path == None:
|
||||||
if self.app_dir.startswith("file://"):
|
self.app_dir = plyer.storagepath.get_home_dir()+"/.config/sideband"
|
||||||
self.app_dir = self.app_dir.replace("file://", "")
|
if self.app_dir.startswith("file://"):
|
||||||
self.cache_dir = self.app_dir+"/cache"
|
self.app_dir = self.app_dir.replace("file://", "")
|
||||||
|
else:
|
||||||
|
self.app_dir = config_path
|
||||||
|
|
||||||
|
self.cache_dir = self.app_dir+"/cache"
|
||||||
|
|
||||||
self.rns_configdir = None
|
self.rns_configdir = None
|
||||||
if RNS.vendor.platformutils.is_android():
|
if RNS.vendor.platformutils.is_android():
|
||||||
|
Loading…
Reference in New Issue
Block a user