Changed logging level to LOGDEBUG as requested by https://kodi.wiki/view/Add-on_rules

This commit is contained in:
Cyrille Bollu 2018-07-27 11:26:40 +02:00
parent fbd6a0599e
commit 143e066fbc
2 changed files with 12 additions and 12 deletions

View File

@ -30,7 +30,7 @@ class PeertubeAddon():
""" """
""" """
xbmc.log('PeertubeAddon: Initialising', xbmc.LOGINFO) xbmc.log('PeertubeAddon: Initialising', xbmc.LOGDEBUG)
# Nothing to play at initialisation # Nothing to play at initialisation
self.play = 0 self.play = 0
self.torrent_name = '' self.torrent_name = ''
@ -114,7 +114,7 @@ class PeertubeAddon():
:return: None :return: None
""" """
xbmc.log('PeertubeAddon: Received metadata_downloaded signal, will start playing media', xbmc.LOGINFO) xbmc.log('PeertubeAddon: Received metadata_downloaded signal, will start playing media', xbmc.LOGDEBUG)
self.play = 1 self.play = 1
self.torrent_f = data['file'] self.torrent_f = data['file']
@ -127,7 +127,7 @@ class PeertubeAddon():
:return: None :return: None
""" """
xbmc.log('PeertubeAddon: playing video ' + torrent_url, xbmc.LOGINFO) xbmc.log('PeertubeAddon: playing video ' + torrent_url, xbmc.LOGDEBUG)
# Start a downloader thread # Start a downloader thread
AddonSignals.sendSignal('start_download', {'url': torrent_url}) AddonSignals.sendSignal('start_download', {'url': torrent_url})

View File

@ -26,27 +26,27 @@ class PeertubeDownloader(Thread):
:return: None :return: None
""" """
xbmc.log('PeertubeDownloader: Opening bitTorent session', xbmc.LOGINFO) xbmc.log('PeertubeDownloader: Opening bitTorent session', xbmc.LOGDEBUG)
# Open bitTorrent session # Open bitTorrent session
ses = libtorrent.session() ses = libtorrent.session()
ses.listen_on(6881, 6891) ses.listen_on(6881, 6891)
# Add torrent # Add torrent
xbmc.log('PeertubeDownloader: Adding torrent ' + self.torrent, xbmc.LOGINFO) xbmc.log('PeertubeDownloader: Adding torrent ' + self.torrent, xbmc.LOGDEBUG)
h = ses.add_torrent({'url': torrent, 'save_path': self.temp_dir}) h = ses.add_torrent({'url': torrent, 'save_path': self.temp_dir})
# Set sequential mode to allow watching while downloading # Set sequential mode to allow watching while downloading
h.set_sequential_download(True) h.set_sequential_download(True)
# Download torrent # Download torrent
xbmc.log('PeertubeDownloader: Downloading torrent ' + self.torrent, xbmc.LOGINFO) xbmc.log('PeertubeDownloader: Downloading torrent ' + self.torrent, xbmc.LOGDEBUG)
signal_sent = 0 signal_sent = 0
while not h.is_seed(): while not h.is_seed():
xbmc.sleep(1000) xbmc.sleep(1000)
s = h.status() s = h.status()
# Inform addon that all the metadata has been downloaded and that it may start playing the torrent # Inform addon that all the metadata has been downloaded and that it may start playing the torrent
if s.state >=3 and signal_sent == 0: if s.state >=3 and signal_sent == 0:
xbmc.log('PeertubeDownloader: Received all torrent metadata, notifying PeertubeAddon', xbmc.LOGINFO) xbmc.log('PeertubeDownloader: Received all torrent metadata, notifying PeertubeAddon', xbmc.LOGDEBUG)
i = h.torrent_file() i = h.torrent_file()
f = self.temp_dir + i.name() f = self.temp_dir + i.name()
AddonSignals.sendSignal('metadata_downloaded', {'file': f}) AddonSignals.sendSignal('metadata_downloaded', {'file': f})
@ -64,7 +64,7 @@ class PeertubeService():
PeertubeService initialisation function PeertubeService initialisation function
""" """
xbmc.log('PeertubeService: Initialising', xbmc.LOGINFO) xbmc.log('PeertubeService: Initialising', xbmc.LOGDEBUG)
# Create our temporary directory # Create our temporary directory
self.temp = xbmc.translatePath('special://temp') + '/plugin.video.peertube/' self.temp = xbmc.translatePath('special://temp') + '/plugin.video.peertube/'
if not xbmcvfs.exists(self.temp): if not xbmcvfs.exists(self.temp):
@ -79,7 +79,7 @@ class PeertubeService():
:return: None :return: None
""" """
xbmc.log('PeertubeService: Received a start_download signal', xbmc.LOGINFO) xbmc.log('PeertubeService: Received a start_download signal', xbmc.LOGDEBUG)
downloader = PeertubeDownloader(data['url'], self.temp) downloader = PeertubeDownloader(data['url'], self.temp)
downloader.start() downloader.start()
@ -95,7 +95,7 @@ class PeertubeService():
AddonSignals.registerSlot('plugin.video.peertube', 'start_download', self.download_torrent) AddonSignals.registerSlot('plugin.video.peertube', 'start_download', self.download_torrent)
# Monitor Kodi's shutdown signal # Monitor Kodi's shutdown signal
xbmc.log('PeertubeService: service started, Waiting for signals', xbmc.LOGINFO) xbmc.log('PeertubeService: service started, Waiting for signals', xbmc.LOGDEBUG)
monitor = xbmc.Monitor() monitor = xbmc.Monitor()
while not monitor.abortRequested(): while not monitor.abortRequested():
if monitor.waitForAbort(1): if monitor.waitForAbort(1):
@ -107,7 +107,7 @@ class PeertubeService():
if __name__ == '__main__': if __name__ == '__main__':
# Start a peertubeService instance # Start a peertubeService instance
xbmc.log('PeertubeService: Starting', xbmc.LOGINFO) xbmc.log('PeertubeService: Starting', xbmc.LOGDEBUG)
service = PeertubeService() service = PeertubeService()
service.run() service.run()
xbmc.log('PeertubeService: Exiting', xbmc.LOGINFO) xbmc.log('PeertubeService: Exiting', xbmc.LOGDEBUG)