Skip to content

Commit 8991e00

Browse files
committed
Significant efactor
Add Context Menu items Add support for Addons & PVR (PVR not fully working yet) Tidy-ups Use direct xbmc.whatever rather than JSON-RPC where possible Use updated scipt.module.bossanova808 (yet to submit) Playback/PlaybackList move to scipt.module.bossanova808
1 parent a4d4c11 commit 8991e00

11 files changed

Lines changed: 285 additions & 355 deletions

File tree

‎addon.xml‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,34 @@
1111
<extension point="xbmc.python.pluginsource" library="plugin.py">
1212
<provides>video audio</provides>
1313
</extension>
14+
<!-- ...and a context menu extension point -->
15+
<extension point="kodi.context.item">
16+
<menu id="kodi.core.main">
17+
<item library="context_menu.py" args="switchback">
18+
<label>Switchback: $INFO[Window(Home).Property(Switchback_Item)]</label>
19+
<visible>Integer.IsGreater(Window(Home).Property(Switchback_List_Length),1)</visible>
20+
</item>
21+
<item library="context_menu.py" args="switchback_list">
22+
<label>32008</label>
23+
<visible>Integer.IsGreater(Window(Home).Property(Switchback_List_Length),0)</visible>
24+
</item>
25+
</menu>
26+
</extension>
1427
<extension point="xbmc.addon.metadata">
1528
<summary lang="en_GB">Utility for fast switching between recently played media.</summary>
1629
<description lang="en_GB">
1730
Kodi utility for fast switching between recently played media.
1831

1932
Keeps a list of recently played media - supports Kodi library episodes, movies, PVR channels, songs and non-library files. Does not (yet?) support add-ons or PVR recordings.
2033

21-
The primary intended use is to make for super easy Switchback between two in progress videos (by binding a remote key to Switchback, see Wiki/Forum thread for info).
34+
The primary intended use is to make for super easy Switchback between two in-progress videos (by binding a remote key to Switchback, see Wiki/Forum thread for info).
2235

2336
Consider this scenario:
24-
- You are watching 'video A' with your partner. You are interrupted and your partner needs to tend to the kids/howl at the moon.
25-
- You navigate to 'video B' and watch some of that.
26-
- Your partner comes back.
27-
- You hit your one button 'Switchback' and 'video A' starts playing again, no need for tedious navigation etc.
28-
- You are interrupted again - the moon is so very bright tonight - hit your 'Switchback' to resume 'video B' immediately, again with one magic button and no tedious navigation.
37+
— You are watching 'video A' with your partner. You're interrupted, and your partner needs to tend to the kids/howl at the moon.
38+
— You navigate to 'video B' and watch some of that.
39+
— Your partner comes back.
40+
— You hit your one button 'Switchback' and 'video A' starts playing again, no need for tedious navigation etc.
41+
— You're interrupted - again - (the moon is so very bright tonight!) hit your 'Switchback' to resume 'video B' immediately, again with one magic button and no tedious navigation.
2942
</description>
3043
<platform>all</platform>
3144
<license>GPL-3.0-only</license>

‎context_menu.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from bossanova808 import exception_logger
2+
from resources.lib import switchback_context_menu
3+
import sys
4+
5+
if __name__ == "__main__":
6+
with exception_logger.log_exception():
7+
# args would be passed through, if there were any...
8+
# <itemlibrary = "context_menu.py" args="something">
9+
switchback_context_menu.run(sys.argv[1:])

‎plugin.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@
55
if __name__ == "__main__":
66
with exception_logger.log_exception():
77
switchback_plugin.run(sys.argv[1:])
8-
9-
Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Kodi Media Center language file
22
msgid ""
33
msgstr ""
4-
"Project-Id-Version: XBMC-Addons\n"
5-
"Report-Msgid-Bugs-To: alanwww1@xbmc.org\n"
6-
"POT-Creation-Date: 2020-04-26 11:43+0000\n"
4+
"Project-Id-Version: Kodi Addons\n"
5+
"Report-Msgid-Bugs-To: translations@kodi.tv\n"
6+
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
77
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
9-
"Language-Team: LANGUAGE\n"
8+
"Last-Translator: Kodi Translation Team\n"
9+
"Language-Team: English (https://kodi.weblate.cloud/languages/en_gb/)\n"
1010
"MIME-Version: 1.0\n"
1111
"Content-Type: text/plain; charset=UTF-8\n"
1212
"Content-Transfer-Encoding: 8bit\n"
1313
"Language: en\n"
14-
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
14+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
1515

1616
msgctxt "#32000"
1717
msgid "General"
@@ -25,14 +25,18 @@ msgctxt "#32002"
2525
msgid "Maximum Switchback list length"
2626
msgstr ""
2727

28-
msgctxt "#32003"
29-
msgid "Include Music Playbacks?"
28+
msgctxt "#32004"
29+
msgid "Delete from Switchback list"
3030
msgstr ""
3131

32-
msgctxt "#32004"
33-
msgid "Delete playback from Switchback list"
32+
msgctxt "#32006"
33+
msgid "Save Switchback list across Kodi sessions?"
3434
msgstr ""
3535

36-
msgctxt "#32005"
37-
msgid "Filter watched items out of the Switchback list?"
38-
msgstr ""
36+
msgctxt "#32007"
37+
msgid "No Switchback found to play"
38+
msgstr ""
39+
40+
msgctxt "#32008"
41+
msgid "Switchback: List"
42+
msgstr ""

‎resources/lib/monitor.py‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
from bossanova808.logger import Logger
22
from resources.lib.store import Store
33
import xbmc
4-
import json
54

65

76
class KodiEventMonitor(xbmc.Monitor):
87

8+
# noinspection PyUnusedLocal
99
def __init__(self, *args, **kwargs):
1010
xbmc.Monitor.__init__(self)
1111
Logger.debug('KodiEventMonitor __init__')
1212

1313
def onSettingsChanged(self):
1414
Logger.info('onSettingsChanged - reload them.')
1515
Store.load_config_from_settings()
16-
17-
# noinspection PyMethodMayBeStatic
18-
def onAbortRequested(self):
19-
Logger.debug('onAbortRequested')
20-
21-
def onNotification(self, sender, method, data):
22-
if method == 'Player.OnStop':
23-
data = json.loads(data)
24-
Logger.debug("Notification:")
25-
Logger.debug(data)

0 commit comments

Comments
 (0)