Skip to content

Commit f10c878

Browse files
bossanova808bossanova808
andauthored
[plugin.switchback] 2.0.0 (#4711)
Co-authored-by: bossanova808 <[email protected]>
1 parent 8377661 commit f10c878

File tree

16 files changed

+951
-452
lines changed

16 files changed

+951
-452
lines changed

plugin.switchback/README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,35 @@ Switchback
66

77
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/bossanova808)
88

9-
Kodi utility for fast switching between recently played media.
9+
## What is Switchback for Kodi?
1010

11-
Available from the Kodi official repository (i.e. don't install from here - just go to Add-ons -> Get Add-ons -> Video -> Switchback)
11+
Kodi utility for fast switching between recently played media.
1212

13-
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.
13+
Available from the Kodi official repository (i.e. don't install from here - just go to Add-ons -> Get Add-ons -> Services -> Switchback)
1414

15-
The primary intended use is to make for super easy Switchback between two in progress video. Bind a remote/keyboard key to Switchback, e.g.:
15+
Keeps a list of recently played media - supports Kodi Addons, library episodes & movies, PVR (live & recordings), and non-library videos.
1616

17-
`<z mod="ctrl">PlayMedia(plugin://plugin.switchback/?mode=switchback,resume)</z>`
17+
The primary intended use is to make for super easy Switchback between two in progress video.
1818

1919
Consider this scenario:
2020

21-
- You are watching 'video A' with your partner. You are interrupted and your partner needs to tend to the kids/howl at the moon.
22-
- You navigate to 'video B' and watch some of that.
21+
- You're watching 'video A' with your partner. You're interrupted, and your partner needs to tend to the kids/howl at the moon.
22+
- You navigate to 'video B' and watch some of that while you're waiting.
2323
- Your partner comes back.
24-
- You hit your one button 'Switchback' and 'video A' starts playing again, no need for tedious navigation etc.
25-
- 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.
24+
- You hit your one button 'Switchback' and 'video A' instantly starts playing again -> no need for tedious navigation etc.
25+
- You're interrupted, again! The moon really _is_ so very bright tonight. Hit your 'Switchback' button to instantly resume 'video B', again with no tedious navigation.
26+
27+
## Using Switchback
28+
29+
Switchback can be used like a standard Video plugin, via context menu, or bind a remote/keyboard key for instant Switchback, e.g.:
30+
31+
`<z mod="ctrl">PlayMedia(plugin://plugin.switchback/?mode=switchback,resume)</z>`
32+
`
33+
34+
...or to show the full current Switchback list of recently played items:
35+
36+
`<x mod="ctrl">RunAddon(plugin.switchback)</x>`
37+
2638

2739
Support is via the [forum thread](https://forum.kodi.tv/showthread.php?tid=379330), or open an issue here.
2840

plugin.switchback/addon.xml

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,68 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<addon id="plugin.switchback" name="Switchback" version="1.0.0" provider-name="bossanova808">
2+
<addon id="plugin.switchback" name="Switchback" version="2.0.0" provider-name="bossanova808">
33
<requires>
4-
<import addon="xbmc.python" version="3.0.0"/>
5-
<import addon="script.module.bossanova808" version="1.0.0"/>
4+
<import addon="xbmc.python" version="3.0.0" />
5+
<import addon="script.module.bossanova808" version="1.0.2" />
66
<import addon="script.module.infotagger" version="0.0.7" />
77
</requires>
8-
<!-- A service entrypoint to keep track of playbacks -->
8+
<!-- The main service entry point, to keep track of playbacks -->
99
<extension point="xbmc.service" library="service.py" />
10-
<!-- ...and a plugin entrypoint to handle presenting and playing media from the switchback playlist -->
10+
<!-- ...and a plugin entry point, to handle presenting and playing media from the switchback playlist -->
1111
<extension point="xbmc.python.pluginsource" library="plugin.py">
12-
<provides>video audio</provides>
13-
</extension>
12+
<provides>video audio</provides>
13+
</extension>
14+
<!-- ...and a context menu extension point, for another playback mechanism -->
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">
15-
<summary lang="en_GB">Utility for fast switching between recently played media.</summary>
28+
<summary lang="en_GB">Switchback is a Kodi utility for fast switching between recently played media.</summary>
29+
<summary lang="sv_SE">Switchback är ett Kodi-verktyg för snabb växling mellan nyligen spelade medier.</summary>
1630
<description lang="en_GB">
1731
Kodi utility for fast switching between recently played media.
18-
19-
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.
20-
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).
22-
32+
Keeps a list of recently played videos.
33+
The primary intended use is to make for super easy Switchback between two in progress video. See Wiki for usage notes including how to bind remote/keyboard controls for instant Switchback.
2334
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.
35+
* You're watching 'video A' with your partner. You're interrupted, and your partner needs to tend to the kids/howl at the moon.
36+
* You navigate to 'video B' and watch some of that while you're waiting.
37+
* Your partner comes back.
38+
* You hit your one button 'Switchback' and 'video A' instantly starts playing again - no need for tedious navigation etc.
39+
* You're interrupted, again! The moon really is so very bright tonight. Hit your 'Switchback' button to instantly resume 'video B', again with no tedious navigation.
40+
</description>
41+
<description lang="sv_SE">
42+
Kodi-verktyg för snabb växling mellan nyligen spelade medier.
43+
Spara en lista över nyligen spelade videor.
44+
Den primära användningen är att göra det superenkelt att växla mellan två pågående videor. Se Wiki för användningsanvisningar, inklusive hur du kopplar fjärrkontroll/tangentbordskontroller för omedelbar växling.
45+
Tänk dig följande scenario:
46+
* Du tittar på ”video A” med din partner. Ni blir avbrutna och din partner måste ta hand om barnen/skälla på månen.
47+
* Du navigerar till ”video B” och tittar på den medan du väntar.
48+
* Din partner kommer tillbaka.
49+
* Du trycker på din enda knapp ”Switchback” och ”video A” börjar omedelbart spelas upp igen – utan tråkig navigering etc.
50+
* Du blir avbruten igen! Månen är verkligen väldigt ljus ikväll. Tryck på din ’Switchback’-knapp för att omedelbart återuppta ”video B”, återigen utan tråkig navigering.
2951
</description>
3052
<platform>all</platform>
3153
<license>GPL-3.0-only</license>
3254
<website>https://github.com/bossanova808/plugin.switchback/</website>
3355
<source>https://github.com/bossanova808/plugin.switchback/</source>
3456
<forum>https://forum.kodi.tv/showthread.php?tid=379330</forum>
3557
<email>[email protected]</email>
36-
<news>
37-
v1.0.0 Initial release
58+
<news>v2.0.0 Re-write!
59+
- Support addons
60+
- Support PVR live/recordings
61+
- (Remove music support)
62+
- Add context menus (configurable)
63+
- Better artwork support
64+
- Better notifications
65+
- Filter watched items from list (configurable)
3866
</news>
3967
<assets>
4068
<icon>resources/icon.png</icon>

plugin.switchback/changelog.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
v2.0.0 Re-write!
2+
- Support addons
3+
- Support PVR live/recordings
4+
- (Remove music support)
5+
- Add context menus (configurable)
6+
- Better artwork support
7+
- Better notifications
8+
- Filter watched items from list (configurable)
9+
110
v1.0.0
211
- Initial Release
312
- Supports Episodes, Movies, Songs, PVR channels, Non-library files

plugin.switchback/context_menu.py

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

plugin.switchback/plugin.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
from bossanova808 import exception_logger
22
from resources.lib import switchback_plugin
3-
import sys
3+
44

55
if __name__ == "__main__":
66
with exception_logger.log_exception():
7-
switchback_plugin.run(sys.argv[1:])
8-
9-
7+
switchback_plugin.run()
Lines changed: 31 additions & 11 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: [email protected]\n"
6-
"POT-Creation-Date: 2020-04-26 11:43+0000\n"
4+
"Project-Id-Version: Kodi Addons\n"
5+
"Report-Msgid-Bugs-To: [email protected]\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,10 +25,30 @@ 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"
34-
msgstr ""
32+
msgctxt "#32006"
33+
msgid "Save Switchback list across Kodi sessions?"
34+
msgstr ""
35+
36+
msgctxt "#32007"
37+
msgid "No Switchback found to play"
38+
msgstr ""
39+
40+
msgctxt "#32008"
41+
msgid "Switchback: List"
42+
msgstr ""
43+
44+
msgctxt "#32009"
45+
msgid "Enable Switchback context menu items?"
46+
msgstr ""
47+
48+
msgctxt "#32010"
49+
msgid "Automatically filter watched items out of the Switchback list?"
50+
msgstr ""
51+
52+
msgctxt "#32011"
53+
msgid "(After a switchback playback) force browse to episode in library?"
54+
msgstr ""
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Kodi Media Center Swedish language file
2+
msgid ""
3+
msgstr ""
4+
"Project-Id-Version: XBMC-Addons\n"
5+
"Report-Msgid-Bugs-To: [email protected]\n"
6+
"POT-Creation-Date: 2020-04-26 11:43+0000\n"
7+
"PO-Revision-Date: 2025-05-06 07:40+0200\n"
8+
"Last-Translator: Daniel Nylander <[email protected]>\n"
9+
"Language-Team: Swedish\n"
10+
"Language: sv\n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: 8bit\n"
14+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
15+
"X-Generator: Poedit 3.6\n"
16+
17+
msgctxt "#32000"
18+
msgid "General"
19+
msgstr "Allmänt"
20+
21+
msgctxt "#32001"
22+
msgid "Basic Settings"
23+
msgstr "Grundläggande inställningar"
24+
25+
msgctxt "#32002"
26+
msgid "Maximum Switchback list length"
27+
msgstr "Maximal längd på Switchback-listan"
28+
29+
msgctxt "#32003"
30+
msgid "Include Music Playbacks?"
31+
msgstr "Inkludera musikuppspelningar?"
32+
33+
msgctxt "#32004"
34+
msgid "Delete playback from Switchback list"
35+
msgstr "Ta bort uppspelning från Switchback-listan"
36+
37+
msgctxt "#32005"
38+
msgid "Filter watched items out of the Switchback list?"
39+
msgstr "Filtrera sedda objekt från Switchback-listan?"
Lines changed: 2 additions & 12 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)
11-
Logger.debug('KodiEventMonitor __init__')
11+
Logger.debug('Monitor __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)