[RELEASE] RandomItems (Random Items) Script

  Thread Rating:
  • 2 Votes - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Hitcher Offline
Skilled Skinner
Posts: 10,255
Joined: Aug 2007
Reputation: 80
Location: Eastleigh, UK
Thumbs Up  [RELEASE] RandomItems (Random Items) Script
Post: #1
Superseded by the Skin Widgets Addon post 4th Oct 2012.

Based on Nuka1195's RecentlyAdded script.

Uses -
  • Alternative to Recently Added items (ie Welo's 'Random Items')
  • Additional to Recently Added items (ie Fusion's 'Featured Items')


Parameters (separated by &) -

PHP Code:
limit=#         ; # to limit returned results (default=5)
unplayed=True   True to return only items (not supported for albumsthat have not been played (default=False)
trailer=True    True to play the trailer (if available) (default=False)
alarm=#         ; # number of minutes before running again (default=Off) 

For example -

PHP Code:
XBMC.RunScript(script.randomitems,limit=10&unplayed=True&alarm=30

will return 10 random, unplayed movies, episodes and songs every 30 minutes.


Labels -

PHP Code:
"RandomMovie.%d.Title"
"RandomMovie.%d.Rating"
"RandomMovie.%d.Year"
"RandomMovie.%d.Plot"
"RandomMovie.%d.RunningTime"
"RandomMovie.%d.Path"
"RandomMovie.%d.Trailer"
"RandomMovie.%d.Fanart"
"RandomMovie.%d.Thumb"
"RandomMovie.Count" 

PHP Code:
"RandomEpisode.%d.ShowTitle"
"RandomEpisode.%d.EpisodeTitle"
"RandomEpisode.%d.EpisodeNo"
"RandomEpisode.%d.EpisodeSeason"
"RandomEpisode.%d.EpisodeNumber"
"RandomEpisode.%d.Plot"
"RandomEpisode.%d.Rating"
"RandomEpisode.%d.Path"
"RandomEpisode.%d.Fanart"
"RandomEpisode.%d.Thumb"
"RandomEpisode.Count" 


PHP Code:
"RandomMusicVideo.%d.Title"
"RandomMusicVideo.%d.Year"
"RandomMusicVideo.%d.Plot"
"RandomMusicVideo.%d.RunningTime"
"RandomMusicVideo.%d.Path"
"RandomMusicVideo.%d.Artist"
"RandomMusicVideo.%d.Fanart"
"RandomMusicVideo.%d.Thumb"
"RandomMusicVideo.Count" 

PHP Code:
"RandomAlbum.%d.Title"
"RandomAlbum.%d.Year"
"RandomAlbum.%d.Artist"
"RandomAlbum.%d.Path"
"RandomAlbum.%d.Fanart"
"RandomAlbum.%d.Thumb"
"RandomAlbum.%d.Rating"
"RandomAlbum.Count" 

PHP Code:
"RandomSong.%d.Title"
"RandomSong.%d.Year"
"RandomSong.%d.Artist"
"RandomSong.%d.Album"
"RandomSong.%d.Path"
"RandomSong.%d.Fanart"
"RandomSong.%d.Thumb"
"RandomSong.%d.Rating"
"RandomSong.Count" 

PHP Code:
"RandomAddon.%d.Name"
"RandomAddon.%d.Author"
"RandomAddon.%d.Summary"
"RandomAddon.%d.Version"
"RandomAddon.%d.Path"
"RandomAddon.%d.Type"
"RandomAddon.%d.Fanart"
"RandomAddon.%d.Thumb"
"RandomAddon.Count" 

Download:
XBMC EDEN: http://mirrors.xbmc.org/addons/eden-pre/...ndomitems/
Frodo Nightly Builds: https://github.com/XBMC-Addons/script.ra.../downloads

IF YOU HAVE ANY ISSUES, ALWAYS INCLUDE A FULL Debug Log WITH YOUR REPORT

Thanks to ppic and ronie for all the updates.
(This post was last modified: 2012-10-10 17:49 by Hitcher.)
find quote
mcborzu Offline
Skilled Skinner
Posts: 3,381
Joined: Feb 2009
Reputation: 15
Location: dsf
Post: #2
I'm just getting the same 3 movies while testing this out?

At the moment I'm running it in startup.xml, also have run it as that 8999 button -
PHP Code:
<control type="button" id="10">
            <
description>trigger</description>
            <
onfocus>ReplaceWindow(Home)</onfocus>
            <
onfocus>XBMC.RunScript(script.randomitems,limit=10&amp;unplayed=True)</onfocus>
            <
texturenofocus>-</texturenofocus>
            <
texturefocus>-</texturefocus>
    </
control

And this is the property fields:

Quote:<label>$INFO[Window.Property(RandomMovie.1.Title)]</label>
<label>$INFO[Window.Property(RandomMovie.2.Title)]</label>
Etc..

Am I missing something?

[Image: widget]

Check out The Carmichael - A Skin For XBMC

Check out Night - A Skin For XBMC

Check out Unfinished - A Skin For XBMC
find quote
ronie Offline
Team-XBMC Member
Posts: 8,985
Joined: Jan 2009
Reputation: 147
Post: #3
i only tested it briefly a while ago and had the same issue.
furthermore, random episodes did not work for me...they all returned empty.

random songs worked fine though.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not PM or e-mail Team-XBMC members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,255
Joined: Aug 2007
Reputation: 80
Location: Eastleigh, UK
Post: #4
Sorry guys, I forgot to mention you need &amp;random=True because I couldn't work out how to set it to 'true' as default - I know next to nothing about Python.

If anyone knows how to fix this then please let me know and I'll get it updated.
(This post was last modified: 2010-09-15 10:16 by Hitcher.)
find quote
igotdvds Offline
Skilled Skinner
Posts: 1,616
Joined: Jul 2009
Reputation: 11
Post: #5
For systems that run all the time, is there a way to make this run every 24 hours?
find quote
ppic Offline
Skilled Python Coder
Posts: 2,711
Joined: Feb 2009
Reputation: 11
Location: France idf
Post: #6
i don't understand what the problem is ?
can you explain, if i catch it, i'll take a look Wink

[Image: widget]
Passion-XBMC Repository Download your SVN skins and addons
TvTunes Addon Download Play your theme while browsing library
TVshow Next Aired display next aired infos from tvrage.com
Logo Downloader Script download Logo/clearart/show thumbs/poster/banner
Bande-Annonce Allociné plugin watch trailers in french and vo
SportLive Script Live score match info in XBMC (not compatible dharma)
find quote
igotdvds Offline
Skilled Skinner
Posts: 1,616
Joined: Jul 2009
Reputation: 11
Post: #7
ppic Wrote:i don't understand what the problem is ?
can you explain, if i catch it, i'll take a look Wink

I must be retarded or something, did I ask a dumb question. lol

I was just wondering since some people leave their HTPC on all the time, was it possible to make the script run every 24 hours without them having to shutdown xbmc. I have it running in startup.xml.
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,255
Joined: Aug 2007
Reputation: 80
Location: Eastleigh, UK
Post: #8
I think he was talking about my problem with making it default to true so we don't have to add 'random=True' to the parameters.

For your problem you could use the 'AlarmClock' function.
find quote
igotdvds Offline
Skilled Skinner
Posts: 1,616
Joined: Jul 2009
Reputation: 11
Post: #9
Hitcher Wrote:I think he was talking about my problem with making it default to true so we don't have to add 'random=True' to the parameters.

For your problem you could use the 'AlarmClock' function.

Such as:

<onfocus>AlarmClock(Random,XBMC.RunScript(script.randomitems,limit=10&amp;unplayed=True&amp;random=True),24:00[,silent])</onfocus>
find quote
ppic Offline
Skilled Python Coder
Posts: 2,711
Joined: Feb 2009
Reputation: 11
Location: France idf
Post: #10
ho ok !!!

so hitcher, you want random=True if not specified in parameter ?
so still allow to pass random=False if you don't want random

[Image: widget]
Passion-XBMC Repository Download your SVN skins and addons
TvTunes Addon Download Play your theme while browsing library
TVshow Next Aired display next aired infos from tvrage.com
Logo Downloader Script download Logo/clearart/show thumbs/poster/banner
Bande-Annonce Allociné plugin watch trailers in french and vo
SportLive Script Live score match info in XBMC (not compatible dharma)
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,255
Joined: Aug 2007
Reputation: 80
Location: Eastleigh, UK
Post: #11
ppic Wrote:ho ok !!!

so hitcher, you want random=True if not specified in parameter ?
so still allow to pass random=False if you don't want random
As it's for random items only I'd like to remove the need to add anything.

Thanks.
find quote
ppic Offline
Skilled Python Coder
Posts: 2,711
Joined: Feb 2009
Reputation: 11
Location: France idf
Post: #12
ha !!!
ok !!!

should be easy so far, i'll check that and keep you in touch Wink

[Image: widget]
Passion-XBMC Repository Download your SVN skins and addons
TvTunes Addon Download Play your theme while browsing library
TVshow Next Aired display next aired infos from tvrage.com
Logo Downloader Script download Logo/clearart/show thumbs/poster/banner
Bande-Annonce Allociné plugin watch trailers in french and vo
SportLive Script Live score match info in XBMC (not compatible dharma)
find quote
ppic Offline
Skilled Python Coder
Posts: 2,711
Joined: Feb 2009
Reputation: 11
Location: France idf
Post: #13
http://pastebin.com/nQMESKKM

try this

[Image: widget]
Passion-XBMC Repository Download your SVN skins and addons
TvTunes Addon Download Play your theme while browsing library
TVshow Next Aired display next aired infos from tvrage.com
Logo Downloader Script download Logo/clearart/show thumbs/poster/banner
Bande-Annonce Allociné plugin watch trailers in french and vo
SportLive Script Live score match info in XBMC (not compatible dharma)
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,255
Joined: Aug 2007
Reputation: 80
Location: Eastleigh, UK
Post: #14
Works perfectly, thanks.

If you have the time do you think you could implement the alarm function that was used in the RecentlyAdded script that would help igotdvds to set a 24 hour check?

Cheers.
find quote
ppic Offline
Skilled Python Coder
Posts: 2,711
Joined: Feb 2009
Reputation: 11
Location: France idf
Post: #15
well i don't know this function, i'll try and see

[Image: widget]
Passion-XBMC Repository Download your SVN skins and addons
TvTunes Addon Download Play your theme while browsing library
TVshow Next Aired display next aired infos from tvrage.com
Logo Downloader Script download Logo/clearart/show thumbs/poster/banner
Bande-Annonce Allociné plugin watch trailers in french and vo
SportLive Script Live score match info in XBMC (not compatible dharma)
find quote
Post Reply