예제 #1
0
파일: obj.py 프로젝트: z3ntu/jellyfin-kodi
    def mapping(self):
        ''' Load objects mapping.
        '''
        file_dir = os.path.dirname(
            ensure_text(__file__, get_filesystem_encoding()))

        with open(os.path.join(file_dir, 'obj_map.json')) as infile:
            self.objects = json.load(infile)
예제 #2
0
    def format(self, record):
        if record.pathname:
            record.pathname = ensure_text(record.pathname, get_filesystem_encoding())

        self._gen_rel_path(record)

        # Call the original formatter class to do the grunt work
        result = logging.Formatter.format(self, record)

        return result
예제 #3
0
    def formatException(self, exc_info):
        _pluginpath_real = os.path.realpath(__pluginpath__)
        res = []

        for o in traceback.format_exception(*exc_info):
            o = ensure_text(o, get_filesystem_encoding())

            if o.startswith('  File "'):
                # If this split can't handle your file names, you should seriously consider renaming your files.
                fn = o.split('  File "', 2)[1].split('", line ', 1)[0]
                rfn = os.path.realpath(fn)
                if rfn.startswith(_pluginpath_real):
                    o = o.replace(fn, os.path.relpath(rfn, _pluginpath_real))

            res.append(o)

        return ''.join(res)