Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions plugin.switchback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,35 @@ Switchback

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

Kodi utility for fast switching between recently played media.
## What is Switchback for Kodi?

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

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

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.:
Keeps a list of recently played media - supports Kodi Addons, library episodes & movies, PVR (live & recordings), and non-library videos.

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

Consider this scenario:

- You are watching 'video A' with your partner. You are interrupted and your partner needs to tend to the kids/howl at the moon.
- You navigate to 'video B' and watch some of that.
- You're watching 'video A' with your partner. You're interrupted, and your partner needs to tend to the kids/howl at the moon.
- You navigate to 'video B' and watch some of that while you're waiting.
- Your partner comes back.
- You hit your one button 'Switchback' and 'video A' starts playing again, no need for tedious navigation etc.
- 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.
- You hit your one button 'Switchback' and 'video A' instantly starts playing again -> no need for tedious navigation etc.
- 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.

## Using Switchback

Switchback can be used like a standard Video plugin, via context menu, or bind a remote/keyboard key for instant Switchback, e.g.:

`<z mod="ctrl">PlayMedia(plugin://plugin.switchback/?mode=switchback,resume)</z>`
`

...or to show the full current Switchback list of recently played items:

`<x mod="ctrl">RunAddon(plugin.switchback)</x>`


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

Expand Down
68 changes: 48 additions & 20 deletions plugin.switchback/addon.xml
Original file line number Diff line number Diff line change
@@ -1,40 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.switchback" name="Switchback" version="1.0.0" provider-name="bossanova808">
<addon id="plugin.switchback" name="Switchback" version="2.0.0" provider-name="bossanova808">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.bossanova808" version="1.0.0"/>
<import addon="xbmc.python" version="3.0.0" />
<import addon="script.module.bossanova808" version="1.0.2" />
<import addon="script.module.infotagger" version="0.0.7" />
</requires>
<!-- A service entrypoint to keep track of playbacks -->
<!-- The main service entry point, to keep track of playbacks -->
<extension point="xbmc.service" library="service.py" />
<!-- ...and a plugin entrypoint to handle presenting and playing media from the switchback playlist -->
<!-- ...and a plugin entry point, to handle presenting and playing media from the switchback playlist -->
<extension point="xbmc.python.pluginsource" library="plugin.py">
<provides>video audio</provides>
</extension>
<provides>video audio</provides>
</extension>
<!-- ...and a context menu extension point, for another playback mechanism -->
<extension point="kodi.context.item">
<menu id="kodi.core.main">
<item library="context_menu.py" args="switchback">
<label>Switchback: $INFO[Window(Home).Property(Switchback_Item)]</label>
<visible>Integer.IsGreater(Window(Home).Property(Switchback_List_Length),1)</visible>
</item>
<item library="context_menu.py" args="switchback_list">
<label>32008</label>
<visible>Integer.IsGreater(Window(Home).Property(Switchback_List_Length),0)</visible>
</item>
</menu>
</extension>
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Utility for fast switching between recently played media.</summary>
<summary lang="en_GB">Switchback is a Kodi utility for fast switching between recently played media.</summary>
<summary lang="sv_SE">Switchback är ett Kodi-verktyg för snabb växling mellan nyligen spelade medier.</summary>
<description lang="en_GB">
Kodi utility for fast switching between recently played media.

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.

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).

Keeps a list of recently played videos.
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.
Consider this scenario:
- You are watching 'video A' with your partner. You are interrupted and your partner needs to tend to the kids/howl at the moon.
- You navigate to 'video B' and watch some of that.
- Your partner comes back.
- You hit your one button 'Switchback' and 'video A' starts playing again, no need for tedious navigation etc.
- 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.
* You're watching 'video A' with your partner. You're interrupted, and your partner needs to tend to the kids/howl at the moon.
* You navigate to 'video B' and watch some of that while you're waiting.
* Your partner comes back.
* You hit your one button 'Switchback' and 'video A' instantly starts playing again - no need for tedious navigation etc.
* 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.
</description>
<description lang="sv_SE">
Kodi-verktyg för snabb växling mellan nyligen spelade medier.
Spara en lista över nyligen spelade videor.
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.
Tänk dig följande scenario:
* 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.
* Du navigerar till ”video B” och tittar på den medan du väntar.
* Din partner kommer tillbaka.
* Du trycker på din enda knapp ”Switchback” och ”video A” börjar omedelbart spelas upp igen – utan tråkig navigering etc.
* 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.
</description>
<platform>all</platform>
<license>GPL-3.0-only</license>
<website>https://github.com/bossanova808/plugin.switchback/</website>
<source>https://github.com/bossanova808/plugin.switchback/</source>
<forum>https://forum.kodi.tv/showthread.php?tid=379330</forum>
<email>[email protected]</email>
<news>
v1.0.0 Initial release
<news>v2.0.0 Re-write!
- Support addons
- Support PVR live/recordings
- (Remove music support)
- Add context menus (configurable)
- Better artwork support
- Better notifications
- Filter watched items from list (configurable)
</news>
<assets>
<icon>resources/icon.png</icon>
Expand Down
9 changes: 9 additions & 0 deletions plugin.switchback/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v2.0.0 Re-write!
- Support addons
- Support PVR live/recordings
- (Remove music support)
- Add context menus (configurable)
- Better artwork support
- Better notifications
- Filter watched items from list (configurable)

v1.0.0
- Initial Release
- Supports Episodes, Movies, Songs, PVR channels, Non-library files
Expand Down
10 changes: 10 additions & 0 deletions plugin.switchback/context_menu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import sys

from bossanova808 import exception_logger
from resources.lib import switchback_context_menu

if __name__ == "__main__":
with exception_logger.log_exception():
# args would be passed through, if there were any...
# <itemlibrary = "context_menu.py" args="something">
switchback_context_menu.run(sys.argv[1:])
6 changes: 2 additions & 4 deletions plugin.switchback/plugin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from bossanova808 import exception_logger
from resources.lib import switchback_plugin
import sys


if __name__ == "__main__":
with exception_logger.log_exception():
switchback_plugin.run(sys.argv[1:])


switchback_plugin.run()
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Kodi Media Center language file
msgid ""
msgstr ""
"Project-Id-Version: XBMC-Addons\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2020-04-26 11:43+0000\n"
"Project-Id-Version: Kodi Addons\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE\n"
"Last-Translator: Kodi Translation Team\n"
"Language-Team: English (https://kodi.weblate.cloud/languages/en_gb/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

msgctxt "#32000"
msgid "General"
Expand All @@ -25,10 +25,30 @@ msgctxt "#32002"
msgid "Maximum Switchback list length"
msgstr ""

msgctxt "#32003"
msgid "Include Music Playbacks?"
msgctxt "#32004"
msgid "Delete from Switchback list"
msgstr ""

msgctxt "#32004"
msgid "Delete playback from Switchback list"
msgstr ""
msgctxt "#32006"
msgid "Save Switchback list across Kodi sessions?"
msgstr ""

msgctxt "#32007"
msgid "No Switchback found to play"
msgstr ""

msgctxt "#32008"
msgid "Switchback: List"
msgstr ""

msgctxt "#32009"
msgid "Enable Switchback context menu items?"
msgstr ""

msgctxt "#32010"
msgid "Automatically filter watched items out of the Switchback list?"
msgstr ""

msgctxt "#32011"
msgid "(After a switchback playback) force browse to episode in library?"
msgstr ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Kodi Media Center Swedish language file
msgid ""
msgstr ""
"Project-Id-Version: XBMC-Addons\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2020-04-26 11:43+0000\n"
"PO-Revision-Date: 2025-05-06 07:40+0200\n"
"Last-Translator: Daniel Nylander <[email protected]>\n"
"Language-Team: Swedish\n"
"Language: sv\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.6\n"

msgctxt "#32000"
msgid "General"
msgstr "Allmänt"

msgctxt "#32001"
msgid "Basic Settings"
msgstr "Grundläggande inställningar"

msgctxt "#32002"
msgid "Maximum Switchback list length"
msgstr "Maximal längd på Switchback-listan"

msgctxt "#32003"
msgid "Include Music Playbacks?"
msgstr "Inkludera musikuppspelningar?"

msgctxt "#32004"
msgid "Delete playback from Switchback list"
msgstr "Ta bort uppspelning från Switchback-listan"

msgctxt "#32005"
msgid "Filter watched items out of the Switchback list?"
msgstr "Filtrera sedda objekt från Switchback-listan?"
14 changes: 2 additions & 12 deletions plugin.switchback/resources/lib/monitor.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
from bossanova808.logger import Logger
from resources.lib.store import Store
import xbmc
import json


class KodiEventMonitor(xbmc.Monitor):

# noinspection PyUnusedLocal
def __init__(self, *args, **kwargs):
xbmc.Monitor.__init__(self)
Logger.debug('KodiEventMonitor __init__')
Logger.debug('Monitor __init__')

def onSettingsChanged(self):
Logger.info('onSettingsChanged - reload them.')
Store.load_config_from_settings()

# noinspection PyMethodMayBeStatic
def onAbortRequested(self):
Logger.debug('onAbortRequested')

def onNotification(self, sender, method, data):
if method == 'Player.OnStop':
data = json.loads(data)
Logger.debug("Notification:")
Logger.debug(data)
Loading