Release Switchback - utility for fast switching between recently played media.
#1
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 official Kodi repository now (in the Services section).

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.
  • Your partner comes back.
  • You hit your one button 'Switchback' and 'video A' starts playing again, no need for tedious library 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 library navigation.

Accessing the Swithback list:
  • You can access the full Switchback list (and remove anything in there if you want) - as you would access any Video addon.
  • Ideally, for one touch instant switching that resumes exactly what you last watched from its resume point - bind a remote/keyboard key to Switchback, e.g. this binds the SomeButton button:
         <SomeButton>PlayMedia(plugin://plugin.switchback/?mode=switchback,resume)</SomeButton>
  • Or, if you prefer for it to display the Switchback list (i.e. list of recently played things) use:
         <SomeButton>RunAddon(plugin.switchback)</SomeButton>


Support: Post here or open a github issue (please supply a link to a complete debug log and a copy of your switchback_list.json from the add-on data folder)
Github: https://github.com/bossanova808/plugin.switchback
Wiki: https://kodi.wiki/view/Add-on:Switchback
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | Caber Toss | Switchback | XSqueezeDisplay | Kodi 2nd Display
Sorry, no help w/out a *full debug log*.
Reply
#2
Great idea!
Where is its control point, how do I invoke it?
Reply
#3
It's a video addon that creates a playlist, but in a perfect world you bind a remote key as above.  (I think I will create another mode too that just opens a dialogue with the full switchback list basically wherever you are).
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | Caber Toss | Switchback | XSqueezeDisplay | Kodi 2nd Display
Sorry, no help w/out a *full debug log*.
Reply
#4
Available from the official repository now...(service section).
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | Caber Toss | Switchback | XSqueezeDisplay | Kodi 2nd Display
Sorry, no help w/out a *full debug log*.
Reply
#5
Have updated the first post with better instructions for accessing Switchback.
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | Caber Toss | Switchback | XSqueezeDisplay | Kodi 2nd Display
Sorry, no help w/out a *full debug log*.
Reply
#6
This is a great idea! It's one of those add-ons where I am wondering why the functionality is not already in the core of Kodi. Autowidget for structuring favorites is another one. Thanks for this ambitious add-on. Can't wait to see add-ons supported, as that is the media type I am consuming the most.
Reply
#7
Well most of the support is there really, it's just blocked with one bit of implementation - feel free to take this out if you want to give it a whirl and report back your results:
https://github.com/bossanova808/plugin.s...yer.py#L41

....but the problem is, add-ons have so many playback mechanisms that often just the URL is not enough.  And/or parts of those URLs (tokens) only stay valid for a small amount of time.  Thus in my testing I just found the results too inconsistent - some recorded plauybacks worked fine on Switchback, others not at all, and others worked for a few hours then stopped working.    I could add a switch (default disable) - I guess, so people could enable this is they want, but odds are fairly high things just won't work how you want them to unless they are basic addons to basic services where the URLs just stay the same & keep working...
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | Caber Toss | Switchback | XSqueezeDisplay | Kodi 2nd Display
Sorry, no help w/out a *full debug log*.
Reply
#8
Great idea !!

I use it in KODI 20.5 (W11) and there are reproductions that show the description and empty cover...

If it helps you, they are online reproductions of addons, they are not local files

Image
Reply
#9
As above:

Support: Post here or open a github issue (please supply a link to a complete debug log and a copy of your switchback_list.json from the add-on data folder)
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | Caber Toss | Switchback | XSqueezeDisplay | Kodi 2nd Display
Sorry, no help w/out a *full debug log*.
Reply
#10
(2024-12-01, 23:52)bossanova808 Wrote: ....but the problem is, add-ons have so many playback mechanisms that often just the URL is not enough.  And/or parts of those URLs (tokens) only stay valid for a small amount of time.

You could grab the ListItem instead, so you get the add-on path, e.g. plugin://plugin.video.youtube/play/?video_id=1234abc. This way the add-on is responsible for resolving the actual URL incl. tokens and whatnot each time.

Oversimplified example:

def onNotification(self, sender, method, data):
    if method == 'Player.OnAVStart':
        player = xbmc.Player(1)
        item = player.getPlayingItem()
        path = item.getPath()
        ...
Reply
#11
Hmm, ok, here's a test version that basically uses that ^ to add support for addons (and PVR recordings): 
https://www.dropbox.com/scl/fi/f97ty0an6x5avhscnjm5p/plugin.switchback.zip?rlkey=1pftcu28h72ix6btfetjb4gfi&e=1&st=83msgeil&dl=0

I'm not convinced it will work properly with many addons (I just don't use them really, so haven't got many to test with etc.) - but worth a try.  Perhaps I will implement a filter that removes addon URLs from the list after say 24 hours to avoid issues?  Not sure.

In the meantime @MaxMustermann @Laser78 if you could perhaps test this version?  Just download this one, and overwrite your local install, and then go crazy with testing and report back.

(If it doesn't work, please supply a debug log and your switchback_list.json as per above so I can dig into it).
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | Caber Toss | Switchback | XSqueezeDisplay | Kodi 2nd Display
Sorry, no help w/out a *full debug log*.
Reply
#12
In my own testing, I have about a 50% success rate after 24 hours - am using TV channel addons - some are playing fine (likely non DRM things), but others not.

I am not sure that's good enough to add it as part of the addon - without getting into expiring such playback records, anyway - but then, which ones to expire, and after how long?  It's almost certainly going to vary...

Still, would love to get your feedback if you can do some testing.
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | Caber Toss | Switchback | XSqueezeDisplay | Kodi 2nd Display
Sorry, no help w/out a *full debug log*.
Reply
#13
(2024-12-04, 01:16)bossanova808 Wrote: In my own testing, I have about a 50% success rate after 24 hours - am using TV channel addons - some are playing fine (likely non DRM things), but others not.

I am not sure that's good enough to add it as part of the addon - without getting into expiring such playback records, anyway - but then, which ones to expire, and after how long?  It's almost certainly going to vary...
Have you tested these channels with Kodi's builtin favourite feature? I'd guess that the success rate would be similar and thus satisfactory for me. Resolving the concrete stream URLs for playback on demand should be best practice among video add-ons.
Quote:Still, would love to get your feedback if you can do some testing.
Sorry for the delay. I will have a closer look on the weekend.
Reply
#14
No worries, I have a busy end to the week anyway - lets regroup over the weekend.

And no I haven't tried Kodi's favourites, that's a good idea (these are specific shows on TV catch-up addons - I might speak to the addon author too, to get another view...)
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | Caber Toss | Switchback | XSqueezeDisplay | Kodi 2nd Display
Sorry, no help w/out a *full debug log*.
Reply
#15
Gave the dropbox version a shot yesterday. These are my results:

Test 1
  1. Delete switchback list (json file)
  2. Play PVR channel and stop after some seconds
  3. Play YouTube video
  4. Use switchback Switch command while watching; Result: "No previous item found to play"
Test 2
  1. Delete switchback list (json file)
  2. Play PVR channel and stop after some seconds
  3. Play YouTube video and stop after some seconds
  4. Use switchback Switch command; Result: "Playback failed"
Test 3
  1. Delete switchback list (json file)
  2. Play PVR channel and stop after some seconds
  3. Play YouTube video
  4. Use switchback List command while watching; Result: List is shown, 1 entry (PVR)
  5. Open entry; Result: PVR channel starts playing
Test 4
  1. Delete switchback list (json file)
  2. Play PVR channel and stop after some seconds
  3. Play YouTube videoand stop after some seconds
  4. Use switchback List command; Result: List is shown, 2 entries (Add-on, PVR)
  5. Open first entry; Result: YouTube video not playing (infinite busy animation)
  6. Cancel attempt by pressing Stop
  7. Open second entry; Result: PVR channel starts playing
Results 1.4 and 3.4 are a design choice, I assume. It is necessary to stop playback before a video is added to the switchback list.

For result 2.4 the log shows that the player is trying the wrong path.
kodi.log: error <general>: CVideoPlayer::OpenInputStream - error opening [plugin://plugin.switchback/?mode=switchback]

For result 4.5 the source code shows that the 'file' attribute is used for playback, not the path. And with add-on videos this attribute contains the concrete URL which becomes invalid (see discussion above).
resources/lib/switchback_plugin.py, line 118: xbmcplugin.addDirectoryItem(plugin_instance, playback.file, list_item)
Using the path attribute here instead makes playback work.

General thoughts:

It quite depends on whether it is enough to play a previous video or whether the context shall be recreated. For example opening the TV show library view of an episode before playing it, so that after watching the video the user can continue navigating through the TV show. If the latter is intended, it could be tried to store information about the window/container from where a video was originally opened. I assume that this becomes complex rather quickly. Take the 4th page of a YouTube search result list as an example.

For my needs it would be enough to just play the video with as little metadata as possible, title and path would do the job.

I think it is the better approach to use ListItems. They usually contain all information needed for playback and presentation. However, there is a major problem with xbmcgui.ListItem being not serializable. Add-ons that actually want to store whole ListItems (e.g. SuperFavourites, AutoWidget, Switchback) have to come up with a custom data structure (class 'playback' in this case) and store individual media type specific properties. The correct provision of these properties is quite complex and hard to maintain. It would at least make sense to outsource this ListItem reproduction to a dedicated module.
Reply

Logout Mark Read Team Forum Stats Members Help
Switchback - utility for fast switching between recently played media.0