1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 11:19:18 +01:00
Clementine-audio-player-Mac.../data/pythonstartup.py

21 lines
497 B
Python
Raw Normal View History

import clementine
import sys
class __ClementineLogger__:
def __init__(self, error):
self._error = error
self._buffer = ''
def write(self, data):
self._buffer = self._buffer + data
i = self._buffer.find('\n')
while i != -1:
line = self._buffer[0:i]
self._buffer = self._buffer[i+1:]
i = self._buffer.find('\n')
clementine.pythonengine.AddLogLine(line, self._error)
sys.stdout = __ClementineLogger__(False)
sys.stderr = __ClementineLogger__(True)