Release Play Random Videos - context item and script
#1
Play Random Videos
A Kodi add-on to quickly play random videos from (nearly) any list. This add-on can play random episodes from TV shows, movies from genres/sets/years/tags, and videos
from playlists, file systems, and just about anything else*.

It adds a context item to most playable lists of videos and provides a script that can be executed by skins with RunScript and JSON-RPC with Addons.ExecuteAddon.

Install it from the official Kodi repo, under "Context menus".
Source available on GitHub at script.playrandomvideos.

Skin usage
Skins can use it with an action like so: RunScript(script.playrandomvideos, "<list path>", "label=<list label>").

List path is the path to the list to play, like ListItem.FolderPath, which should be escaped ($ESCINFO[]). label is the list name, like ListItem.Label or FolderName, and is required when available, also escaped/quoted. There are optional arguments watchmode, which can override the default watch mode selected in the add-on settings, and singlevideo to play just a single video, if you have occasion for such an action.

In MyVideoNav.xml an action like RunScript(script.playrandomvideos, "$INFO[Container.FolderPath]", "label=$INFO[Container.FolderName]", watchmode=$INFO[Control.GetLabel(10)]) makes for a good button in the sidebar or as some other container-focused option. Use

Code:
<visible>ListItem.IsFolder + !ListItem.IsParentFolder + !SubString(ListItem.FolderPath, plugin, Left) + !SubString(ListItem.FolderPath, addons, Left) + !SubString(ListItem.FolderPath, sources, Left) + !StringCompare(ListItem.FolderPath, add)</visible>

to match the context item's visibility on this window.

A label is available with $ADDON[script.playrandomvideos 32100], 'Play Random'.

watchmode accepts 'Unwatched', 'Watched', and 'Ask me', as well as their localized equivalents with these IDs: `16101`, `16102`, and `36521`. In MyVideoNav.xml, watchmode=$INFO[Control.GetLabel(10)] should match the behavior of the button that switches between watched/unwatched/all, if it is on your window. singlevideo needs no value.

Button/menu actions

It is also possible to create an action that always plays randomly from one specific list, for use in a home menu or even as flair on another window, which can be assigned with Skin Shortcuts or added directly to skin files.

- Play randomly from a list of all movies: RunScript(script.playrandomvideos, "videodb://movies/")
- all episodes: RunScript(script.playrandomvideos, "videodb://tvshows/")
- all music videos: RunScript(script.playrandomvideos, "videodb://musicvideos/")
- from any of your playlists: RunScript(script.playrandomvideos, "special://playlists/video/<playlist filename>")
- movies from any genre: RunScript(script.playrandomvideos, "videodb://movies/genres/xx/", "label=Documentary")
- episodes from any TV network: RunScript(script.playrandomvideos, "videodb://tvshows/studios/xx/", "label=Cartoon Network")

Plugins
It doesn't work for plugin paths Sad. I would like it to, but I can't figure a good way to implement it, considering all the things plugins do.

Troubles?
If you are experiencing an error, please post your log file and a brief description of the issue.
Reply
#2
Cool idea, thanks
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Twitter | Help?
Reply
#3
Added watched filters with version 0.6.0 of the script, more details above.

The context item has been updated to 1.0.2.
Reply
#4
Removed plugin support in 0.7.0.

Localized settings options and some other cleanup for 1.0.0, which I'll put in a request for inclusion in the official repo in the next couple of days.

Edit: Submitted to official repo on Dec 22.
Reply
#5
These are now available in the official Kodi Add-on Repository.
Reply
#6
This has been my most sought after feature for years now. I still don't understand why this isn't a standard built-in feature for Kodi.

I have the context add on installed but I don't know how to take the next step and get it working. I'd rather not switch skins from Confluence if it's not absolutely necessary. Any tips on the easiest way I can get the context menu feature to work with it?
Reply
#7
(2016-02-23, 05:41)Hooterman Wrote: This has been my most sought after feature for years now. I still don't understand why this isn't a standard built-in feature for Kodi.

I have the context add on installed but I don't know how to take the next step and get it working. I'd rather not switch skins from Confluence if it's not absolutely necessary. Any tips on the easiest way I can get the context menu feature to work with it?

After installing the context item, open the context menu on something that contains videos (a TV show, video playlist, directory on the filesystem), and "Play Random" should be towards the bottom of that menu. Pressing that button should play a random video from the selected list.

I've just noticed an issue with Android and Python 2.6, so if you are on Android and "Play Random" is there, just not playing anything, I will have a fix ready soon.

Otherwise, post your log file, which should give me a better picture of what's going wrong.
Reply
#8
(2016-02-23, 22:59)rmrector Wrote:
(2016-02-23, 05:41)Hooterman Wrote: This has been my most sought after feature for years now. I still don't understand why this isn't a standard built-in feature for Kodi.

I have the context add on installed but I don't know how to take the next step and get it working. I'd rather not switch skins from Confluence if it's not absolutely necessary. Any tips on the easiest way I can get the context menu feature to work with it?

After installing the context item, open the context menu on something that contains videos (a TV show, video playlist, directory on the filesystem), and "Play Random" should be towards the bottom of that menu. Pressing that button should play a random video from the selected list.

I've just noticed an issue with Android and Python 2.6, so if you are on Android and "Play Random" is there, just not playing anything, I will have a fix ready soon.

Otherwise, post your log file, which should give me a better picture of what's going wrong.


Ah yes, that's my problem. All of my Kodi boxes are Android TV now. Smile

I just get the error to check my log file when I try to run it via the context menu item. I can grab and post my log file if you need it, but it sounds like you're already aware of the issue.

Thanks!
Reply
#9
(2016-02-23, 23:23)Hooterman Wrote: Ah yes, that's my problem. All of my Kodi boxes are Android TV now. Smile

I just get the error to check my log file when I try to run it via the context menu item. I can grab and post my log file if you need it, but it sounds like you're already aware of the issue.

Thanks!

I've updated the script to version 1.0.3 with a fix for this issue. Thanks for posting, it could have taken some time before I came back around to this add-on and tested it on Android.

I've submitted the new version to the official add-on repository, and it should be available from within Kodi in the next few days, or you can download the installable zip.
Reply
#10
looks as if version 103 still doesnt do the job in raspbmc/ osmc:

raspbmc until Kodi 15 (compiled feb? 2015)/ confluence skin on RPi B offered shuffle and repeat function for videoclips identical to same function for music play (no playlist used, just the file list). set in the left side slidein tool.

Now using RPi2 to do the same thing, but prefer newer Kodi (16.0 compiled feb21 2016) due to improved conectivity, USB analog audio support (Teufel C200WL dongle. Finally Smile) and some others.
For music, same repeat/ shuffle play method works still fine.

-> to shuffle play or repeat play video clips from file list, the old setting has disappeared?
--> Found your addon "play random video". Installed version 1.03.
It just shows error message "see for logfile".
How can i now get osmc shuffle or repeat play video?

-> is there any way to mix plays of videoclips and pure audio?
Reply
#11
(2016-03-06, 15:56)greybearosmc Wrote: looks as if version 103 still doesnt do the job in raspbmc/ osmc:

raspbmc until Kodi 15 (compiled feb? 2015)/ confluence skin on RPi B offered shuffle and repeat function for videoclips identical to same function for music play (no playlist used, just the file list). set in the left side slidein tool.

Now using RPi2 to do the same thing, but prefer newer Kodi (16.0 compiled feb21 2016) due to improved conectivity, USB analog audio support (Teufel C200WL dongle. Finally Smile) and some others.
For music, same repeat/ shuffle play method works still fine.

-> to shuffle play or repeat play video clips from file list, the old setting has disappeared?
--> Found your addon "play random video". Installed version 1.03.
It just shows error message "see for logfile".
How can i now get osmc shuffle or repeat play video?

-> is there any way to mix plays of videoclips and pure audio?

Please post your log file. I don't have one of those little guys to work with, but the log should point me in the right direction.

This add-on will just pick out video files from a mixed list.
Reply
#12
Helli rmrector,

i'm not sure if this went right;
the logfile is posted at
http://xbmclogs.com/pli8lnahg

helpful?
Reply
#13
(2016-03-08, 17:14)greybearosmc Wrote: Helli rmrector,

i'm not sure if this went right;
the logfile is posted at
http://xbmclogs.com/pli8lnahg

helpful?

Ahh, it's designed to run right on a specified list of videos, not directly from programs. I can make running it from programs at least mildly useful, though.

The quickest way to get it running is to install the Context menu item "Play Random Video" along with the script, then you can open the context menu on the list of videos (TV show, movie set, playlist, so on) in the video library, and "Play Random" will be toward the bottom.

Adding it to the sidebar is a bit more involved; the skin will have to be modified, with details in the first post or the README.
Reply
#14
Sorry, I meant to report back sooner but kind of forgot due to travel. 1.0.3 works great for me now on my Android TV Kodi's! Well, to be more specific I'm running SPMC now, but the update works fine on both.

It definitely plays a random video just fine, but is there anyway that it can create a random playlist of sorts when you do run it? So that you can just let it play continuously in a random order if you wanted to?

Thanks again for the quick update!
Reply
#15
There currently isn't a way to play more than one video at a time with the context item.

For the next update I will add a few options for setting number of videos to play to the add-on settings. I'll also look into a way to play through all selected videos like party mode. It may be a month before I get back to Kodi stuff, so the next update won't be quite so quick.
Reply
 
Thread Rating:
  • 2 Vote(s) - 5 Average



Logout Mark Read Team Forum Stats Members Help
Play Random Videos - context item and script52