mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 10:46:11 +00:00
78fda95853
json.dumps is a processing intensive operation. This is being called every time data is received from the server (most noticeably during library updates) for debug logging. If the user has debug logging disabled (the default option) then the user is still paying for processing which is discarded. The fix is to add a level of indirection where the dumps function is only called if a string representation of the json is requested; ie. when the debug string is evaluated.
15 lines
397 B
Python
15 lines
397 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
##################################################################################################
|
|
|
|
import json
|
|
|
|
##################################################################################################
|
|
|
|
class JsonDebugPrinter(object):
|
|
|
|
def __init__(self, json):
|
|
self.json = json
|
|
|
|
def __str__(self):
|
|
return json.dumps(self.json, indent=4)
|