Kodi Community Forum

Full Version: [MOD] Randomized 'TV channel' playlists on home
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Sorry, but I don't have a nice, clean download for you guys. Since there has to be so much that you'd have to edit yourself, I may as well just explain the entire thing. I have no coding skills, this is a dirty hack.

Revol's 'randomized TV show playlist' guide

Ever since I've been using XBMC (first on my XBox years ago, then this year with my HTPC), I've always felt like there's been a huge feature missing. The TV library is really cool, but the way XBMC has you watch these episodes isn't the way people are used to. You have to choose the episode yourself, and when you have over a hundred South Park episodes to choose from, that can be daunting.

Well, you can watch random episodes of one TV show, but wouldn't it be cool if you could take it further, and watch random episodes of random SHOWS?

Before we begin, I'll explain what I did, and what I'm doing with it. Using the default skin of the new XBMC Dharma build, Confluence, I've replaced the default sub-menu items for 'TV Shows' with links to playlists of TV shows.

Image

Most of these playlists are 'smart' playlists. Using XML-powered 'smart' playlists over the usual formats like m3u, brings a few benefits. For one, smart lists pull the episodes dynamically by telling it the TV show name, and then pulling them from the library. This way, when you add this week's newest Family Guy episode, you don't have to add it manually to the playlist. Just add it to your TV library like usual, and it will find it. Because it's smart.

Also, you can ask it to only play episodes that haven't been watched in the past month.

The Adult Swim Channel is a smart playlist that filters in my favorite Adult Swim shows:
  • Aqua Teen Hunger Force
  • Check It Out! with Dr. Steve Brule
  • Harvey Birdman, Attorney at Law
  • Metalocalypse
  • Home Movies
  • Sealab 2021
  • Tim and Eric Awesome Show, Great Job!
  • The Venture Bros.

The CN Channel is a smart playlist of my favorite Cartoon Network (non-Adult Swim of course) shows. It's what I'm watching right now! Go Flapjack!
  • Adventure Time with Finn and Jake
  • Courage the Cowardly Dog
  • The Marvelous Misadventures of Flapjack

The Comedy Channel is a smart playlist of my favorite live-action comedy shows.
  • Arrested Development
  • Curb Your Enthusiasm
  • Seinfeld
  • Stella
  • It's Always Sunny in Philadelphia

The DC Animated Channel is a smart playlist of my favorite DC Comics cartoons.
  • Batman: The Animated Series
  • The New Batman Adventures
  • Superman: The Animated Series
  • Justice League

The FG/AD! Channel is a smart playlist of my favorite Seth MacFarland shows.
  • Family Guy
  • American Dad!

The Looney Tunes Channel is simply an .m3u playlist of my rip of the Looney Tunes DVD collections. That's because of the way my collection is ripped, I have no tags that could allow this to get into my library. Plus, I don't care to use the monthly watch rule here.

The Simpsons Channel is what got people here excited about the most, I guess. It's a smart playlist of just the Simpsons.

The South Park Channel is a smart playlist of the TV show I must watch the most of on my HTPC, South Park.



A FEW POINTS FIRST:

You need to be running the Dharma beta with the Confluence skin. I'm sure this could be done with just about any skin, and perhaps even older XBMC builds.. but it would take different changes, I'm sure.

The file paths are for Windows users. The paths inside the edited files I'm supplying shouldn't change, but the ones I mention in the guide itself (like where to extract the RAR file) will obviously be different.

I have no coding skills, so this is a true hack job. I figured out how to do it, but you're gonna end up playing inside the XML files just like I did. If you're reading this thread, you can surely handle this.
STEP ONE

First, we need to make a copy of the Confluence skin. You should never hack an original copy, especially here, considering that this is the default skin.

For Windows 7, the default skin is in the Program Files folder. In the addons folder in XBMC is 'skin.confluence'. Copy this. Next, go to your XBMC profile's settings. In Windows 7, they're at YourWinUserName/AppData/Roaming/XBMC/. (AppData is a hidden folder.) Drop skin.confluence into the addons folder, and rename it skin.confluence2.



STEP TWO

We're gonna start building the playlists. Let me first explain how the smart playlists are going to work. For multi-show playlists:
  • We have one master list that adds the functionality of filtering out any episodes we've watched recently.
  • The other half of the smart playlist compiles the list of the TV shows you want to combine into one 'channel'.
  • Finally, a third smart playlists combines the first two, and this is the one that we watch from.

For single show playlists, we combine the first two playlists into one file.

Let's make the master watched list. Go to the directory /AppData/Roaming/XBMC/userdata/playlist/video. Make a txt file and name it watched.xsp. Then throw this into it!

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Watched</name>
    <match>all</match>
    <rule field="lastplayed" operator="notinthelast">4 weeks</rule>
</smartplaylist>

You can tweak it how you want by changing '4 weeks'.



STEP THREE - SINGLE-SHOW PLAYLISTS

We’ll start with single-show playlists. It’s easier, and seems more popular of an idea here. We'll be doing the Simpsons.

Create a txt file named simpsons.xsp.

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>The Simpsons Channel</name>
    <match>all</match>
    <rule field="tvshow" operator="is">The Simpsons</rule>
    <rule field="playlist" operator="is">Watched</rule>
</smartplaylist>

The 'name' tag is the name that XBMC recognizes. It's how the playlist normally appears in the program. But we won't be seeing it 'normally'. This is important, though, so remember how you name your playlists.

The 'match' tag tells the playlist if something has to match everything, or only one thing. For this playlist, it matches both rules.

The first 'rule' is the 'tvshow' name match. The playlist includes any video that is in the XBMC library for 'The Simpsons'. So, you must exactly match the name as it appears in the XBMC library. NOTE: If the videos you want to use aren't in the library, check out how I made my Looney Tunes playlist later on.

The last rule includes another playlist, this being 'Watched'. (That's the tag name in the watched playlist, not the filename.) This includes the rule we made in the last step.

And we're done! We can actually ignore that last 'order' tag, but I still include it anyways.

REPEAT THIS STEP TO MAKE MORE SINGLE-SHOW PLAYLISTS



STEP FOUR - MULTI-SHOW PLAYLISTS

Multi-show playlists are more complicated, so we have to split up the playlists a little. It all has to do with the 'match' tag. We can't match 'all' when there are five different TV shows to consider. So we seperate the two rules.

First we make the collection of TV show names. For tutorial purposes, we're going to take a look at my Cartoon Network Channel. I made a txt file and named it cartoonnetwork-list.xsp.

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Cartoon Network shows list</name>
    <match>one</match>
    <rule field="tvshow" operator="is">Adventure Time with Finn and Jake</rule>
    <rule field="tvshow" operator="is">Courage the Cowardly Dog</rule>
    <rule field="tvshow" operator="is">The Marvelous Misadventures of Flapjack</rule>
</smartplaylist>

This time, we 'match' only one. This playlist will randomly play a video from three different cartoon shows. You can add more tags as you need. Remember, use the XBMC library's show name.



STEP FIVE

We now combine the two. Create another txt file and name it cartoonnetwork.xsp, or whatever channel you're making.

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Cartoon Network Channel</name>
    <match>all</match>
    <rule field="playlist" operator="is">Cartoon Network shows list</rule>
    <rule field="playlist" operator="is">Watched</rule>
</smartplaylist>

What is most important here is that you tag the 'rule field="playlist"' correctly. You need to make sure it's the same as the 'name' tags in the earlier playlists. You don't use the file name, but what you named the playlist in the xsp itself.

REPEAT STEPS FOUR AND FIVE TO MAKE MORE MULTI-SHOW PLAYLISTS
STEP SIX

We've got all the playlists we want now. It's time to add them to the home menu. Again, we're using the Confluence skin for the XBMC Dharma version. We've already made a copy called 'skin.confluence2'. Open that folder.

We need to edit the addon.xml file first. This skin has the same 'name' as the original, so it won't appear in XBMC right now. At line five is name="Confluence". I changed mine to:

name="Confluence (Revol's Channel Mod)"



STEP SEVEN

One more step of preparation. I decreased the default font size of the submenu so I can fit longer titles. As you can tell, I'm still somewhat limited. I was gonna name the 'FG/AD! Channel' the 'American Family Dad-Guy Channel' but it goes way over.

In the 720p folder, open 'includes.xml'. On line 233 (in the 'ButtonHomeSubCommonValues' tag), change 'font12_title' to 'font12'. This takes the bold out of the menu items.



STEP EIGHT

Here's the big finale. Open the home.xml file, and go to line 664. (Search for '<control type="grouplist" id="9017">'.

Change the 'height' number to 320. I'm not sure if this is necissary, but I think it is if you have a larger number of playlists like I do. If you do, you'd also want to change the 'posy' tag. This is the vertical positioning. Changing the number of items in this submenu will make it go off-center. With the eight playlist items I have, I found a posy of -50 recenters the list correctly.

Now we get to the real beef of the job, replacing the current menu items. See those 'control type="button"' tags? Replace them with this:

Code:
<control type="button" id="90171">
                        <include>ButtonHomeSubCommonValues</include>
                        <label>Adult Swim Channel</label>
                        <onclick>xbmc.PlayMedia(special://profile/playlists/video/adultswim.xsp)</onclick>
                    </control>
  • Make sure you increase the ID tag for every one that you add.
  • The include tag always stays the same.
  • 'label' is what the menu item is named in XBMC. The maximum length you can use, after the change we made in the last step, is about 20-22 characters.
  • 'onclick' tells XBMC what happens when you select the menu item. The pathing used here should be compatible with any OS. Remember to use the correct playlist here, you would want 'adultswim.xsp' instead of 'adultswim-list.xsp'.

You can replace as many of these 'button' menu items as you want. If there are some left over, delete them. If you need more, add more in.



STEP NINE

To ensure that the playlists are randomized every time, we need to enable shuffle. See, as it is now, the playlists are randomized once, as far as I am aware. What we want is for XBMC to play video files in a shuffle.

To do this, select any video file (from either file list or library), and select Queue Item from the context menu. Then, select Now Playing... from the context menu. This brings us to the list of currently queued items.

Press the left arrow button to bring up a menu, and select Shuffle.
Brilliant guide, was wondering if this was possible on XBMC. Thanks very much, it all works perfectly.
I tried this and got some odd results. (Dharma Beta2)

I did a multi show playlist, and it had all my shows, in random order.
I then tried to add the mutlishow playlist to a random playlist, and I got every TV show episode I have.

Here is my mutlishow playlist:
Quote:<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
<name>Shows</name>
<match>one</match>
<rule field="tvshow" operator="is">The Golden Girls</rule>
<rule field="tvshow" operator="is">Psych</rule>
<rule field="tvshow" operator="is">Frasier</rule>
<order direction="ascending">random</order>
</smartplaylist>

And my "Randomizer" playlist:
Quote:<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
<name>Random</name>
<match>all</match>
<rule field="playlist" operator="is">Shows.xsp</rule>
<order direction="ascending">random</order>
</smartplaylist>

Other than Watched, I don't know what could cause that reaction.
Err, what is the reaction you're seeing? I don't see where you explain what the outcome is. I do see a few odd things you've done, though.

One, you have the 'random order direction' command in your playlist that collects the shows you want to play from. That is, at best, redundant and unnecissary, and at worst, might actually break the playlist from working.

Two, I can tell that your 'Randomizer' playlist simply will not work. You missed the important note that I laid out in step 5:

Quote:What is most important here is that you tag the 'rule field="playlist"' correctly. You need to make sure it's the same as the 'name' tags in the earlier playlists. You don't use the file name, but what you named the playlist in the xsp itself.

You used the 'shows.xsp' filename. That is incorrect. You have to use what you put inside the 'name' tag in said playlist. For your example, it would need to be 'Shows'.

So your second playlist would look like this:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
<name>Random</name>
<match>all</match>
<rule field="playlist" operator="is">Shows.xsp</rule>
<order direction="ascending">random</order>
</smartplaylist>

Finally... I think your second playlist may be completely unnecessary. That's my fault, though. I am beginning to think that, to be able to achieve fully randomized playback, all you have to do is follow step nine.

I just tested this by removing the random playback line in my Simpsons playlist. I just used it, and it still randomly plays episodes. So, I need to go through my guide and remove those lines.

So.. as it stands now, the only playlist you need is the first one you posted. Remember, the only reason that many of my 'channels' are made up of two playlists is because they are multi-episode 'channels' that also calls the 'Watched' command as a filter. But you're don't seem to be using that command... so only your first playlist is needed.
I just upgraded to Beta 4, and my random playlist works perfectly.
I wonder if anyone can help me; I have set up the two scripts simpsons.xsp and watched.xsp, but whenever I open the simpsons playlist all items are in order.

How can I force shuffle this playlist? I m using Aeon MQ2 which has no shuffle option in the menus, but I can enable shuffle via xbmc remote on the iPhone. The only problem is it doesn't stick, whenever I reboot the playlist reverts back to being in order.

Somebody on the forums gave this advice for a related question, can this technique be adapted for video playlists?:

curtis-r Wrote:Personally, since I always want shuffle and random in effect, I have an advancedsettings.xml addition, which appears to make shuffle work regardless of the menu option being missing.

Code:
<mymusic>
        <playlist>
            <repeat>true</repeat>
            <shuffle>true</shuffle>
        </playlist>
    </mymusic>
ximon Wrote:I wonder if anyone can help me; I have set up the two scripts simpsons.xsp and watched.xsp, but whenever I open the simpsons playlist all items are in order.

How can I force shuffle this playlist? I m using Aeon MQ2 which has no shuffle option in the menus, but I can enable shuffle via xbmc remote on the iPhone. The only problem is it doesn't stick, whenever I reboot the playlist reverts back to being in order.

Somebody on the forums gave this advice for a related question, can this technique be adapted for video playlists?:

Perhaps if you turn on a skin that does have this option, turn it on, then go back to Aeon?

Also, maybe that code will work if instead of mymusic, you do myvideo?
I managed to achieve what I wanted by manually editing the homescreen entry for my playlist in GUIsettings.xml.

I swapped the 'ActivateWindow' command for a 'PlayMedia' command. This way it respects the shuffle option that I activated from XBMC Remote and goes straight into a random Simpsons episode. Yay!
I am having the same problem as sufreak, and have had this problem every time I've tried to do this in the past.

I have three playlists as follows:

Discovery-History.xsp which filters for the type of shows most of us think about with those networks, good background noise for a geek.
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Discovery/History type programming</name>
    <match>one</match>
    <rule field="tvshow" operator="is">Bad Universe</rule>
    <rule field="tvshow" operator="is">IRT Deadliest Roads</rule>
    <rule field="tvshow" operator="is">Modern Marvels</rule>
    <rule field="tvshow" operator="is">MythBusters</rule>
    <rule field="tvshow" operator="is">NOVA</rule>
    <rule field="tvshow" operator="is">Nova ScienceNOW</rule>
    <rule field="tvshow" operator="is">Pawn Stars</rule>
    <rule field="tvshow" operator="is">Storm Chasers</rule>
    <rule field="tvshow" operator="is">The Universe</rule>
    <rule field="tvshow" operator="is">Through the Wormhole</rule>
    <rule field="tvshow" operator="is">Wonders of the Solar System</rule>
</smartplaylist>

This one on its own works just fine and only shows those programs.

I also have Not Recently Watched.xsp, which is self explanatory.
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Not Recently Watched</name>
    <match>all</match>
    <rule field="lastplayed" operator="notinthelast">8 weeks</rule>
</smartplaylist>

Then both of these are combined with Channel Surf Discovery.xsp
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Channel Surf Discovery</name>
    <match>all</match>
    <rule field="playlist" operator="is">Discovery-History.xsp</rule>
    <rule field="playlist" operator="is">Not Recently Watched.xsp</rule>
</smartplaylist>

I had a random ordering bit in there, but I removed it. Unfortunately still when I select the Channel Surf playlist I get everything in my library.
Revol, This is just brilliant. Why didn't I think of that. I've always said that with 4 terabytes of storage there's nothing to watch. I always end up watching tv, which I Hate BTW, I hate commercials and not being able to fast forward or rewind. Although I do enjoy the randomness of television watching. being able to turn on the TV and not knowing whats on and just getting trap in an old episode of something. Thanks alot for this i can't wait to try it out.
wolrah Wrote:Then both of these are combined with Channel Surf Discovery.xsp
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Channel Surf Discovery</name>
    <match>all</match>
    <rule field="playlist" operator="is">Discovery-History.xsp</rule>
    <rule field="playlist" operator="is">Not Recently Watched.xsp</rule>
</smartplaylist>

I had a random ordering bit in there, but I removed it. Unfortunately still when I select the Channel Surf playlist I get everything in my library.

In the Channel Surf rules, use the name of the playlist, not the file name:

<rule field="playlist" operator="is">Discovery/History type programming</rule>
<rule field="playlist" operator="is">Not Recently Watched</rule>

The '/' in the first one might mess things up, too.
I figured out the trick was a single playlist, and just Sort by Playlist. it seems to work then
I kinda have this working. My biggest problem is I cannot get the button to show up in the home screen. My playlists show up under playlists but I don't have a button on the home screen.