# Path: module/plugins/internal/misc.py
# class Expose(object):
#     """
#     Used for decoration to declare rpc services
#     """
#     def __new__(cls, fn, *args, **kwargs):
#         hookManager.addRPC(fn.__module__, fn.__name__, fn.__doc__)
#         return fn
# 
# def encode(value, encoding='utf-8', errors='backslashreplace'):
#     """
#     Unicode string -> encoded string (default to UTF-8)
#     """
#     if isinstance(value, unicode):
#         res = value.encode(encoding, errors)
# 
#     elif isinstance(value, str):
#         decoding = get_console_encoding(sys.stdin.encoding)
#         if encoding == decoding:
#             res = value
#         else:
#             res = transcode(value, decoding, encoding)
# 
#     else:
#         res = str(value)
# 
#     return res
# 
# def exists(path):
#     path = encode(path)
# 
#     if os.path.exists(path):
#         if os.name == "nt":
#             dir, name = os.path.split(path.rstrip(os.sep))
#             return name.upper() in map(str.upper, os.listdir(dir))
#         else:
#             return True
#     else:
#         return False
# 
# def fsjoin(*args):
#     """
#     Like os.path.join, but encoding aware
#     (for safe-joining see `safejoin`)
#     """
#     return encode(os.path.join(*args))
# 
# def threaded(fn):
#     def run(*args, **kwargs):
#         hookManager.startThread(fn, *args, **kwargs)
# 
#     return run


import operator
import os
import re
import sys
import time
from ..internal.Addon import Addon
from ..internal.misc import Expose, encode, exists, fsjoin, threaded
# -*- coding: utf-8 -*-

from __future__ import with_statement




class UpdateManager(Addon):
    __name__ = "UpdateManager"
    __type__ = "hook"
    __version__ = "1.17"
    __status__ = "testing"

    __config__ = [("activated", "bool", "Activated", True),
                  ("checkinterval", "int", "Check interval in hours", 6),
                  ("autorestart", "bool", "Auto-restart pyLoad when required", True),
                  ("checkonstart", "bool", "Check for updates on startup", True),
                  ("checkperiod", "bool", "Check for updates periodically", True),

# Path: module/plugins/internal/misc.py
# class Expose(object):
#     """
#     Used for decoration to declare rpc services
#     """
#     def __new__(cls, fn, *args, **kwargs):
#         hookManager.addRPC(fn.__module__, fn.__name__, fn.__doc__)
#         return fn
# 
# def encode(value, encoding='utf-8', errors='backslashreplace'):
#     """
#     Unicode string -> encoded string (default to UTF-8)
#     """
#     if isinstance(value, unicode):
#         res = value.encode(encoding, errors)
# 
#     elif isinstance(value, str):
#         decoding = get_console_encoding(sys.stdin.encoding)
#         if encoding == decoding:
#             res = value
#         else:
#             res = transcode(value, decoding, encoding)
# 
#     else:
#         res = str(value)
# 
#     return res
# 
# def exists(path):
#     path = encode(path)
# 
#     if os.path.exists(path):
#         if os.name == "nt":
#             dir, name = os.path.split(path.rstrip(os.sep))
#             return name.upper() in map(str.upper, os.listdir(dir))
#         else:
#             return True
#     else:
#         return False
# 
# def fsjoin(*args):
#     """
#     Like os.path.join, but encoding aware
#     (for safe-joining see `safejoin`)
#     """
#     return encode(os.path.join(*args))
# 
# def threaded(fn):
#     def run(*args, **kwargs):
#         hookManager.startThread(fn, *args, **kwargs)
# 
#     return run


# Path: module/plugins/hooks/UpdateManager.py
import operator
import os
import re
import sys
import time
from ..internal.Addon import Addon
from ..internal.misc import Expose, encode, exists, fsjoin, threaded

# -*- coding: utf-8 -*-

from __future__ import with_statement




class UpdateManager(Addon):
    __name__ = "UpdateManager"
    __type__ = "hook"
    __version__ = "1.17"
    __status__ = "testing"

    __config__ = [("activated", "bool", "Activated", True),
                  ("checkinterval", "int", "Check interval in hours", 6),
                  ("autorestart", "bool", "Auto-restart pyLoad when required", True),
                  ("checkonstart", "bool", "Check for updates on startup", True),
                  ("checkperiod", "bool", "Check for updates periodically", True),

                  ("reloadplugins", "bool",