Kodi Community Forum

Full Version: LazyTV - an unwatched TV Show playlist generator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The Pitch:
You have a huge library of TV shows and you havent viewed half of it. So why does it feel like such a chore to sit down and watch something?
You know you want to watch TV, so why do you also have to decide what specifically to watch?
LazyTV is here to free you from your battles with indecision, letting you sit back and soak up content.
With one click you can be channel-surfing your own library, or have what you probably want to watch pop up in a single window.


Description:
Unlike a smart playlist or skin widget, LazyTV doesnt just provide the first unwatched episode of a TV show. It provides the first unwatched episode AFTER the last watched one in your library. A small, but important, distinction.

LazyTV offers two main functions:
The first is to create and launch a randomised playlist of the TV episodes. And not just any episodes, but the next episode it thinks you would want to watch. You also have the option to blend in your movies (both the watched and the unwatched) to complete the channel-surfing experience.

The second main function is to populate a window with every "next available" episode for your TV Shows. One click and your viewing menu is there, immediately.


Other features:
Smart playlist filtering: Combine either of the main functions with a playlist of preselected shows to customise your experience even further. Alternatively, you can select specific shows in the Addon Settings.

Set out of order shows: Some TV shows, like cartoons or skit shows, can be viewed out of episodic order. So LazyTV gives you the ability to identify these shows and treat them differently. Those shows will be played in a random order.

Clones: Create duplicate copies of the LazyTV front end. This allows multiple integration in the Home screen. Each clone can have different main functions, settings, show lists, smart playlist filters.

LazyTV also offers two minor functions that extend beyond the addon itself:
Episode notification: an option to be notified if you are about to watch an episode that has an unwatched episode before it. This function excludes the TV shows identified as able to be watched out of order.

Play next episode: posts a notification when you finish watching a TV episode telling you that the next show is available and asks if you want to view it now.

Even more!
- LazyTV can create and maintain a smart playlist for use in other addons and even other smart playlists.
- a new Setting (page 4) can instruct LazyTV to copy the next-to-watch episode from the last 10 watched TV Shows to a folder you specify.

Known issues:
- Streams may work with the List function, but can be problematic with the Random Player.
- Updates of the previously released version may require a restart to take effect.


Wiki page:
http://wiki.xbmc.org/index.php?title=Add-on:LazyTV

Github:
https://github.com/KODeKarnage/script.lazytv


Raspberry Pi users:
LazyTV contains a service that stores the next episodes' information and monitors your player to pre-empt database changes. This is my attempt to make the addon more responsive on my Raspberry Pi. The Pi still takes a while to "warm-up"; a full refresh of the episode data (which occurs at start-up and on a library update) takes about 30 seconds for my ~100 show library*. However, the show list window opens and the random player starts in less than 3 seconds.

*The same update takes 2 seconds on my laptop with its i5 processor


SHOUT OUT!
The addon download statistics dont update very often (as I am writing this, they are 3 months out of date), so I added something into the Addon Settings to provide some basic feedback. It sends a one-time email to me to say "hello! someone is actually using your addon!" Once clicked, the option wont appear again.


Latest Release Changelog
0.9.94
Changed name of skin files so skinners can have their own versions. (Mimic is the first skin on board, thanks braz!)
Addon window now automatically refreshes when a show has been watched.

0.9.9
Added context menu
The context menu allows you to:
- select more than one show at a time
- play the selection
- play from "here" option
- export shows to any folder
- mark an episode as watched
- update the library
- refresh the list
Add skinned list view (you can switch back to the default list view in the Settings.)


The icons below are some alternatives I have come up with. Let me know which one you like the best.


watch gallery
This looks very interesting. I'll test it sometime this week.
Thanks MeMeMe,

It has been rejected from the official Repo because it accesses the database directly. The line in the wiki that says there is a restriction on EDITing the databases, is meant to mean that all access is restricted, so not just writing but reading as well.

I am looking at a work-around, but would still love to hear any functionality suggestions.
It's weird that it doesn't allow you to read the database.
I did try to download your repo but I am getting an error message. 500: Internal Server Error.
Is this because it has been rejected from the official Repo?
The GitHub link works for me. Not sure why you couldnt get to it.
I am currently reworking the addon to use the JSON-RPC API instead of querying the database directly.

Hope to have that done in the next few days.
On the moment I am testing your script.
It's very nice that it can also play streamed TV shows.

But if I want to make use of streamed TV shows, I have to set the next option on:
Include episodes from unwatched tvseries, although I have seen some of the episode.
Sometimes I do see a problem when it's trying to play a dead stream, somehow it doesn't find the next stream.
Thanks hstegeman, thats very helpful.

I will look to put in an explicit "Include .strm" option, and have them handled better.

I have never had any .strm in my library, are you able to provide some details on them? Are they single episodes or multiple episodes in a full TV series? I mean, do they each have a different TVShowID? Also, can you 'resume' a stream? Maybe there is a few sample .strm files that I could use?

On the last issue, I suppose I could have the addon request the header to see if the link is dead before adding to the playlist. That might solve it. Though I am concerned it a check like that may slow things down.
I did send you a pm.
Karnagious ,

You have no idea how long i have been searching for this addon!, well maybe you do, because if i recall correctly, you were one of the guys that helped me to change some code on my own script, that does a similar job. Mine works atm, but yours seems to have alot more options, so i am definitely going to install and use it.

One thing, I dont see it in your "feature list", so im not sure, if it is not listed, or maybe not implemented, of the latter, can you maybe think of adding this: If i have lets say 6 random episodes playing, my brain takes a few seconds to realize which show it is that is playing, so you can make a popup that will be there for like 5 or 10 secs, which shows the Show Name, SxxExx, and the title of the episode?

Thanks
Been playing around with this for the past 20minutes or so, loks promising.

One thing, I have chosen the smart playlist way, so when i open the addon, it pops ups, and asks me for my smar playlists, and i choose one, then it gives an error, lazyTV script failed. sometimes nothing happens, sometimes the error, and then the episode starts to play, I have set to open 5 episodes, but everytime, it is error, and then only one, sometimes maybe two episodes populate. I can confirm that I have more than 5 unwatched episodes.

Dont know if you will need full debug, but here is the snippet so long

Code:
13:36:12 T:1524   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IndexError'>
                                            Error Contents: list index out of range
                                            Traceback (most recent call last):
                                              File "C:\Users\Shaun\AppData\Roaming\XBMC\addons\script.lazytv-master\default.py", line 406, in <module>
                                                create_playlist()
                                              File "C:\Users\Shaun\AppData\Roaming\XBMC\addons\script.lazytv-master\default.py", line 242, in create_playlist
                                                this_show = [x for x in all_shows if x['tvshowid'] == SHOWID][0]
                                            IndexError: list index out of range
                                            -->End of Python script error report<--
Thanks endlesslyonline, I havent had that error reported before. It would occur if the SHOWID was an empty string. I have added a filter to eliminate empty strings for playlists and updated github, if you want to try again.

PS Actually, thinking about it some more, I dont think that was it. The filter was already being applied.

Do you have Exclude Partials set to True? And if so, is it possible that a lot of episodes are partially watched?

PPS I have tried for about an hour to replicate the problem, but no luck.
Are you able to send me your playlist file? And maybe the database too?
Will do. Newbie question though, how do I send you my database? and it is a SQL database, does that make a difference?

EDIT: I will check on exclude partials, but im almost sure I have them excluded. I do have a few partials, but not sure how much is a lot, if i have to take a wild guess, I would so about 30 episodes?
Thanks, SQL db is fine. I will PM you my email address.

The problem occurred in testing when the list was empty, so I put in something that should exit the script when the list is empty. I dont see how an empty list can get there.