Skip to content

Commit

Permalink
Version 1.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
enen92 committed Jun 22, 2020
1 parent c590576 commit 2d4d63c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 69 deletions.
9 changes: 5 additions & 4 deletions addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="screensaver.kaster" name="Kaster" version="1.3.2" provider-name="enen92">
<addon id="screensaver.kaster" name="Kaster" version="1.3.3" provider-name="enen92">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.requests" version="2.22.0"/>
Expand All @@ -20,9 +20,10 @@
<description lang="es_ES">Muestra bellas imágenes como las del protector de pantalla de chromecast. También puede mostrar sus propias fotos junto con su respectiva información.</description>
<description lang="nl_NL">Toon prachtige afbeeldingen afkomstig van de Chromecast screensaver. Je kunt ook je eigen foto's tonen met al hun informatie.</description>
<description lang="fr_FR">Affichez de jolies images provenant de l’écran de veille de Chromecast. Vous pouvez aussi afficher vos propres images avec leurs informations respectives.</description>
<news>v1.3.2
[new] Automated submissions for matrix
[fix] Addon.xml and screenshots (addon-checker compliance)
<news>v1.3.3
[fix] CPU usage
[fix] HTTP request number in case of 429 status code
[cosmetic] SPDX headers
</news>
<assets>
<icon>resources/images/icon.png</icon>
Expand Down
18 changes: 4 additions & 14 deletions entrypoint.py
@@ -1,20 +1,10 @@
# -*- coding: utf-8 -*-
"""
screensaver.kaster
Copyright (C) 2017 enen92
Copyright (C) 2017-2020 enen92
This file is part of kaster
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: GPL-2.0-or-later
See LICENSE for more information.
"""

from resources.lib.screensaver import Kaster
Expand Down
18 changes: 4 additions & 14 deletions resources/lib/kodiutils.py
@@ -1,20 +1,10 @@
# -*- coding: utf-8 -*-
"""
screensaver.kaster
Copyright (C) 2017 enen92
Copyright (C) 2017-2020 enen92
This file is part of kaster
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: GPL-2.0-or-later
See LICENSE for more information.
"""
import xbmc
import xbmcaddon
Expand Down
38 changes: 15 additions & 23 deletions resources/lib/screensaver.py
@@ -1,20 +1,10 @@
# -*- coding: utf-8 -*-
"""
screensaver.kaster
Copyright (C) 2017 enen92
Copyright (C) 2017-2020 enen92
This file is part of kaster
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: GPL-2.0-or-later
See LICENSE for more information.
"""
import xbmc
import os
Expand Down Expand Up @@ -73,7 +63,11 @@ def onInit(self):

# if it is a google image....
if "private" not in self.images[rand_index]:
if requests.head(url=self.images[rand_index]["url"]).status_code != 200:
req = requests.head(url=self.images[rand_index]["url"])
if req.status_code != 200:
# sleep for a bit to avoid 429 (too many requests)
if req.status_code == 429:
self.exit_monitor.waitForAbort(5)
continue

# photo metadata
Expand Down Expand Up @@ -105,13 +99,11 @@ def onInit(self):
self.backgroud.setImage(self.images[rand_index]["url"])
# Pop image and wait
del self.images[rand_index]
# Sleep for a given ammount of time if the window is active abort is not requested
# note: abort requested is only called after kodi kills the entrypoint and we need to return
# as soon as possible
loop_count = (kodiutils.get_setting_as_int("wait-time-before-changing-image") * 1000) / 200
for _ in range(0, int(loop_count)):
if self._isactive and not self.exit_monitor.abortRequested():
xbmc.sleep(200)
# sleep for the configured time
wait_time = kodiutils.get_setting_as_int("wait-time-before-changing-image")
self.exit_monitor.waitForAbort(wait_time)
if not self._isactive or self.exit_monitor.abortRequested():
break
# Check if images dict is empty, if so read the file again
if not self.images:
self.get_images()
Expand Down Expand Up @@ -154,7 +146,7 @@ def set_property(self):
# Set animations
if kodiutils.get_setting_as_int("animation") == 1:
self.setProperty("animation","panzoom")
return
return


def exit(self):
Expand Down
18 changes: 4 additions & 14 deletions resources/lib/screensaverutils.py
@@ -1,20 +1,10 @@
# -*- coding: utf-8 -*-
"""
screensaver.kaster
Copyright (C) 2017 enen92
Copyright (C) 2017-2020 enen92
This file is part of kaster
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: GPL-2.0-or-later
See LICENSE for more information.
"""
from . import kodiutils
import xbmcvfs
Expand Down

0 comments on commit 2d4d63c

Please sign in to comment.