Skip to content

Commit

Permalink
[script.service.checkpreviousepisode] 0.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
bossanova808 committed Oct 16, 2024
1 parent afe0a48 commit 752333a
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 300 deletions.
8 changes: 6 additions & 2 deletions script.service.checkpreviousepisode/addon.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.service.checkpreviousepisode" version="0.4.7" name="Kodi Check Previous Episode" provider-name="bossanova808, Razzeee, Lucleonhart" >
<addon id="script.service.checkpreviousepisode" version="0.4.8" name="Kodi Check Previous Episode" provider-name="bossanova808, Razzeee, Lucleonhart" >
<requires>
<import addon="xbmc.python" version="3.0.0" />
<import addon="script.module.yaml" version="3.11.0" />
<import addon="script.module.bossanova808" version="1.0.0"/>
</requires>
<extension library="default.py" point="xbmc.service" />
<extension point="xbmc.addon.metadata">
Expand All @@ -16,7 +17,10 @@
<forum>https://forum.kodi.tv/showthread.php?tid=355464</forum>
<website>https://kodi.wiki/view/Add-on:XBMC_Check_Previous_Episode</website>
<source>https://github.com/bossanova808/script.service.checkpreviousepisode</source>
<news>v0.4.7 Add Window Property so skinners can dress up the dialog</news>
<news>v0.4.8
- Remove old common code, use new module
- Fix bug if last ignored show is removed from ignore list then that show is re-played in same Kodi session
</news>
<assets>
<icon>icon.png</icon>
</assets>
Expand Down
6 changes: 5 additions & 1 deletion script.service.checkpreviousepisode/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.4.8
- Remove old common code, use new module
- Fix bug if last ignored show is removed from ignore list then that show is re-played in same Kodi session

v0.4.7
- Add Window Property so skinners can dress up the dialog

Expand All @@ -23,7 +27,7 @@ v0.4.1
v0.3.5
- (N.B. this is the last version for Kodi Leia and below)
- Fixed error with non ascii chars in show title
- Better addon profile path handling, create profile directory if doesn't exists
- Better addon profile path handling, create profile directory if it doesn't exist

v0.3.4
- Add new option to ignore particular shows
Expand Down
4 changes: 3 additions & 1 deletion script.service.checkpreviousepisode/default.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
from resources.lib import check_previous_episode
import sys
from bossanova808 import exception_logger

if __name__ == "__main__":
check_previous_episode.run(sys.argv)
with exception_logger.log_exception():
check_previous_episode.run(sys.argv)
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
from .common import *
from bossanova808.utilities import *
from bossanova808.constants import *
from bossanova808.logger import Logger
from bossanova808.notify import Notify
# noinspection PyPackages
from .store import Store
# noinspection PyPackages
from .monitor import KodiEventMonitor
# noinspection PyPackages
from .player import KodiPlayer
import xbmc
import os


def manage_ignored():
"""
Manage ignored shows in settings..
Manage ignored shows in settings...
:return:
"""

log("Managing ignored shows...")
Logger.info("Managing ignored shows...")
dialog = xbmcgui.Dialog()
Store.get_ignored_shows_from_config_file()

# Short circuit if no ignored shows, so nothing to manage...
if len(Store.ignored_shows) < 1:
notify(LANGUAGE(32060), xbmcgui.NOTIFICATION_INFO, 5000)
Notify.info(LANGUAGE(32060), 5000)
return

# Ok, there are ignored shows in the list...
# OK, there are ignored shows in the list...

# Convert our dict to a list for the dialog...
ignored_list = []
Expand All @@ -33,20 +39,13 @@ def manage_ignored():
selected = dialog.select(LANGUAGE(32062), ignored_list)
if selected != -1:
show_title = ignored_list[selected]
log("User has requested we stop ignoring: " + show_title)
log("Ignored shows before removal is: " + str(Store.ignored_shows))
# find the key (tv_show_id) for this show& remove from dict
Logger.info("User has requested we stop ignoring: " + show_title)
Logger.debug("Ignored shows before removal is: " + str(Store.ignored_shows))
# find the key (new_to_ignore_tv_show_id) for this show& remove from dict
key = list(Store.ignored_shows.keys())[list(Store.ignored_shows.values()).index(show_title)]
Store.ignored_shows.pop(key, None)
log("Ignored shows after removal is: " + str(Store.ignored_shows))

# No ignored shows? Clean up & delete the empty file..
if len(Store.ignored_shows) == 0:
if os.path.exists(Store.ignored_shows_file):
os.remove(Store.ignored_shows_file)
else:
# write the ignored list back out
Store.write_ignored_shows_to_config(Store.ignored_shows)
Logger.debug("Ignored shows after removal is: " + str(Store.ignored_shows))
Store.write_ignored_shows_to_config()


def run(args):
Expand All @@ -57,22 +56,18 @@ def run(args):
"""
footprints()
# Initialise the global store and load the addon settings
config = Store()
Store()

# TWO RUN-MODES - we're either running as a service, or we're running the tool to manage ignored shows..
# TWO RUN-MODES - we're either running as a service, or we're running the tool to manage ignored shows...

# MANAGE IGNORED SHOWS
if len(args) > 1:
try:
if args[1].startswith('ManageIgnored'):
manage_ignored()
# if not, carry on, nothing to see here...
except Exception as inst:
log("Exception in manage_ignored " + format_exc(inst))
if args[1].startswith('ManageIgnored'):
manage_ignored()

# DEFAULT - RUN AS A SERVICE & WATCH PLAYBACK EVENTS
else:
log("Listening to onAvStarted for episode playback.")
Logger.info("Listening to onAvStarted for episode playback.")
Store.kodi_event_monitor = KodiEventMonitor(xbmc.Monitor)
Store.kodi_player = KodiPlayer(xbmc.Player)

Expand All @@ -83,19 +78,3 @@ def run(args):
break

footprints(False)
















216 changes: 0 additions & 216 deletions script.service.checkpreviousepisode/resources/lib/common.py

This file was deleted.

Loading

0 comments on commit 752333a

Please sign in to comment.