Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

Commit

Permalink
Added debug setting, to show LOGINFO messages when not in XBMC debug …
Browse files Browse the repository at this point in the history
…mode
  • Loading branch information
Thijs Waalen committed Mar 6, 2012
1 parent 74fcaaa commit 328e01a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
23 changes: 14 additions & 9 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,28 @@
SECOND_SUBMENU = "Unadded TV Shows"
HELP_SUBMENU = "Help!"

# plugin handle
# log("THESE ARE THE SYS ARGUMENTS: %s" % sys.argv, xbmc.LOGNOTICE)
handle = int(sys.argv[1])

FILE_EXTENSIONS = ['mpg', 'mpeg', 'avi', 'flv', 'wmv', 'mkv', '264', '3g2', '3gp', 'ifo', 'mp4', 'mov', 'iso', 'ogm']
FILE_EXTENSIONS.extend(xbmcplugin.getSetting(handle, "custom_file_extensions").split(";"))

OUTPUT_FILE = xbmcplugin.getSetting(handle, "output_dir") + xbmcplugin.getSetting(handle, "output_file");
DEBUG = xbmcplugin.getSetting(handle, "debug");

def log(txt, severity=xbmc.LOGDEBUG):
if DEBUG and severity == xbmc.LOGINFO:
severity = xbmc.LOGNOTICE
try:
message = (u"%s" % txt)
xbmc.log(msg=message, level=severity)
except UnicodeEncodeError:
message = ("UnicodeEncodeError")
xbmc.log(msg=message, level=xbmc.LOGWARNING)

log("MISSING MOVIE VIEWER STARTED.", xbmc.LOGNOTICE);

# plugin handle
log("THESE ARE THE SYS ARGUMENTS: %s" % sys.argv)
handle = int(sys.argv[1])

FILE_EXTENSIONS = ['mpg', 'mpeg', 'avi', 'flv', 'wmv', 'mkv', '264', '3g2', '3gp', 'ifo', 'mp4', 'mov', 'iso', 'ogm']
FILE_EXTENSIONS.extend(xbmcplugin.getSetting(handle, "custom_file_extensions").split(";"))

OUTPUT_FILE = xbmcplugin.getSetting(handle, "output_dir") + xbmcplugin.getSetting(handle, "output_file");

def remove_duplicates(files):
# converting it to a set and back drops all duplicates
return list(set(files))
Expand Down
1 change: 1 addition & 0 deletions resources/language/english/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<string id="30001">Output File</string>
<string id="30002">Misc Settings (semicolon delimited)</string>
<string id="30003">Custom File Extensions</string>
<string id="30004">Debug</string>
</strings>

2 changes: 2 additions & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
<setting id="output_file" type="text" label="30001" default="" />
<setting type="lsep" label="30002" />
<setting id="custom_file_extensions" type="text" label="30003" default="" />
<setting type="sep" />
<setting id="debug" type="bool" label="30004" default="false" />
</settings>

0 comments on commit 328e01a

Please sign in to comment.