Skip to content

Commit

Permalink
Small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dagwieers committed Oct 31, 2019
1 parent 7ac3ab7 commit c502627
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
<!-- setting type="action" label="33412" action="ActivateScreensaver"/ --> <!-- activate -->
<!-- /category -->
<setting label="33420" type="lsep"/> <!-- Logging -->
<setting label="33421" help="33422" type="enum" id="max_log_level" lvalues="33430|33431|33432|33433" default="0"/>
<setting label="33421" help="33422" type="enum" id="max_log_level" lvalues="33430|33431|33432|33433" default="1"/>
</category>
</settings>
6 changes: 3 additions & 3 deletions screensaver.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def to_unicode(text, encoding='utf-8'):
def log(level=1, msg='', **kwargs):
''' Log info messages to Kodi '''
max_log_level = int(get_setting('max_log_level', 0))
if not DEBUG_LOGGING and not (level <= max_log_level or max_log_level == 0):
if not DEBUG_LOGGING and not (level <= max_log_level and max_log_level != 0):
return
from string import Formatter
if kwargs:
Expand Down Expand Up @@ -175,7 +175,7 @@ def run_command(*command, **kwargs):
''' Run commands on the OS while catching exceptions '''
# TODO: Add options for running using su or sudo
try:
cmd = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kwargs)
cmd = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, **kwargs)
(out, err) = cmd.communicate()
if cmd.returncode == 0:
log(2, msg="Running command '{command}' returned rc={rc}", command=' '.join(command), rc=cmd.returncode)
Expand Down Expand Up @@ -271,7 +271,7 @@ def exit(self):
del self.monitor

self.close()
del self
# del self


class TurnOffMonitor(Monitor, object):
Expand Down

0 comments on commit c502627

Please sign in to comment.