• 1
  • 2
  • 3(current)
  • 4
  • 5
  • 61
Release LazyTV - an unwatched TV Show playlist generator
#31
There seems to be a problem with special characters as i can't seem to remove "Carnivàle" from the programs to exclude.
Reply
#32
(2013-10-01, 03:53)mtoddster Wrote: There seems to be a problem with special characters as i can't seem to remove "Carnivàle" from the programs to exclude.

Is it giving an error message or is it just failing to exclude?
Reply
#33
(2013-09-28, 00:26)Karnagious Wrote: Yep, the change is all made. I have found the json-rpc is slower but it isnt 30 times slower.

Are you doing lots of queries or just one for all the data and then having the script crunch the numbers?

Care to share the code?

In JSON-RPC I had multiple requests while in SQL I was able to roll all into one. Maybe I missed something and JSON-RPC could return everything in a single request as well?

Anyway here is the JSON code:
PHP Code:
def show_root_menu():
    
''' Show the plugin root menu. '''
    
json_query xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "properties": ["file","fanart","thumbnail","art","season"], "sort": { "order": "ascending", "method": "label" } }, "id": "libTvShows"}')
    
json_query unicode(json_query'utf-8'errors='ignore')
    
jsonobject simplejson.loads(json_query)
    if 
jsonobject.has_key('result') and jsonobject['result'].has_key('tvshows'):
        
tvshows jsonobject['result']['tvshows']
        for 
tvshow in tvshows:
            
#addDirectoryItem(name="Show "+tvshow['label'], url='videodb://2/2/'+str(tvshow['tvshowid']), isFolder=True,icon=tvshow['thumbnail'])
            # Search for season information
            
json_query_season xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetSeasons", "params": {"properties": ["season", "watchedepisodes","episode","showtitle","thumbnail","fanart"], "sort": { "method": "label" }, "tvshowid":%s }, "id": 1}' %tvshow['tvshowid'])
            
jsonobject_season simplejson.loads(json_query_season)
            if 
jsonobject_season['result'].has_key('seasons'):
                
seasons jsonobject_season['result']['seasons']
                for 
season in seasons:
                    
string='??'
                    
if season['episode']!=season['watchedepisodes'] and season['watchedepisodes']!=0:
                        
string='['+str(season['watchedepisodes'])+'/'+str(season['episode'])+']'
                        
addDirectoryItem(name=season['showtitle']+' - '+xbmc.getLocalizedString(20358)%season['season']+' '+string,
                            
url='videodb://2/2/'+str(tvshow['tvshowid'])+'/'+str(season['season']),isFolder=True,
                            
icon=season['thumbnail'],fanart=season['fanart'])

    
xbmcplugin.addSortMethodhandle=handlesortMethod=xbmcplugin.SORT_METHOD_TITLE,label2Mask="X%s" )
    
xbmcplugin.endOfDirectory(handle=handlesucceeded=True
And here the (much faster) SQL version:
PHP Code:
def show_root_menu():
    
''' Show the plugin root menu. '''
    
    
conn=sqlite.connect(xbmc.translatePath('special://database/MyVideos75.db'))
    
c=conn.cursor()
    
c.execute("SELECT   tvshow.c00 as name,tvshow.[idShow] as idshow, episode.c12 as season,"+
        
" NULLIF(COUNT(episode.c12), 0) AS totalCount,  COUNT(nullif(files.playCount,0)) AS watchedcount, ifnull(poster.url,''), ifnull(fanart.url,'')"+
        
" FROM tvshow"+
        
" LEFT JOIN episode ON    episode.idShow=tvshow.idShow"+
        
" LEFT JOIN files ON    files.idFile=episode.idFile"+
        
" left join seasons on seasons.[idShow]=tvshow.idShow and seasons.season=episode.c12"+
        
" left join art poster on seasons.idSeason=poster.media_id   and poster.media_type='season'"+
        
" left join art as fanart on tvshow.idShow=fanart.media_id and fanart.type='fanart'"+
        
" group by name,tvshow.idshow,episode.c12"+
        
" having (totalcount<>watchedcount and watchedcount<>0)")
    
row=c.fetchone()
    while 
row is not None:
        
addDirectoryItem(name=row[0]+' - '+xbmc.getLocalizedString(20358)%int(row[2])+' '+'['+str(row[4])+'/'+str(row[3])+']',
            
url='videodb://2/2/'+str(row[1])+'/'+str(row[2]),isFolder=True,icon=row[5],fanart=row[6])
        
row=c.fetchone()
    
conn.close()

    
xbmcplugin.endOfDirectory(handle=handlesucceeded=True
Reply
#34
Ah, I see. You are bound to the GetSeason method because you need the season thumbnail and fanart.

I cant see how you can get those in a single request. But I think you CAN create a batch request, which might be faster.

I think you can do that by creating all your request strings or dicts, putting them all in a list [ ... ]. http://forum.xbmc.org/showthread.php?tid=166567

That might help speed things up a bit. As one guy said in that thread, it might not be faster in processing, but it would skip the back and forth overhead.

Then you could add them to the dictionary of all TV shows that you already have. That might make things cleaner, but wouldnt necessarily save any time.
Reply
#35
(2013-10-01, 04:29)Karnagious Wrote:
(2013-10-01, 03:53)mtoddster Wrote: There seems to be a problem with special characters as i can't seem to remove "Carnivàle" from the programs to exclude.

Is it giving an error message or is it just failing to exclude?

Just failing to exclude.
Reply
#36
I have a new version in the pipeline but I need it tested, so if you can help out that would be great.

The new version is in the master-working branch of repo on github.

https://github.com/KODeKarnage/script.la...er-working

Changes:
- the 'next episode' list is now a Select window, so I was able to add the show name to the front of the episode name (also added percent watched and days since last episode was watched)
- changed the addon.xml so LazyTV will show up in Video Addons
- changed the way the ignore_show list is handled so spanish characters wont cause problems, this will mean that previous ignore show settings wont work and will need to be re-entered
- launching the shows in the player with the episode ID, which will hopefully mean that watched streams will be changed to 'watched' in the database
- lots of empty list fixes, this doesnt add any new functionality, it just means people who run it on empty libraries or with no unwatched shows available stop getting script errors and triggering Buggalo reports
Reply
#37
Just changed the select video window to one using dialogselect.xml rather than the built it function. So have been able to add in the thumbnails and generally make it look a bit better.

Now I need to figure out how to toggle items in the list to enabled/disabled and I can use the same thing on the ignore_shows window. If anyone can point me in the right direction with that I would appreciate it.

EDIT: Nevermind. I found the solution. Now I will finally get the 'ignore' screens working as I originally wanted!
Reply
#38
(2013-10-02, 15:31)Karnagious Wrote: - changed the addon.xml so LazyTV will show up in Video Addons
- launching the shows in the player with the episode ID, which will hopefully mean that watched streams will be changed to 'watched' in the database
I will test this out and let you know how it works for me.
Reply
#39
And the new ignore selection screens are available in the addon Settings. Phew! Finally got there. It looks and behaves the way I originally wanted.

Well, except for one thing. Opening the Exclude screens forces the settings window to close. This has to occur as the new window opens behind the settings. I'd prefer for it to open above the settings window. Anyone know how to set THAT up?
Reply
#40
This is a dream plugin for me!
I currently use in progress and favourites to navigate my media, but this (if I have read it correctly) will essentially return all my shows in progress, and will display the latest episode of these shows for me to choose from.

Much like a pseudo tv, plus "in progress" rolled in to 1 Smile

Fantastic!
Reply
#41
Thanks Patrick. Let me know how you get on with using the addon.

I will be releasing the new version to the official repo in a couple days. Before that you can get it at the Github link. I have updated the Master Branch there so it has all my recent changes.

Someone has told me that they added LazyTV to autoexec.py so that it runs when XBMC is started. I have started looking at having that as an option in the Settings.
Reply
#42
(2013-10-08, 23:34)Karnagious Wrote: Thanks Patrick. Let me know how you get on with using the addon.

I will be releasing the new version to the official repo in a couple days. Before that you can get it at the Github link. I have updated the Master Branch there so it has all my recent changes.

Someone has told me that they added LazyTV to autoexec.py so that it runs when XBMC is started. I have started looking at having that as an option in the Settings.

That's exactly what I was going to ask next Laugh
The option to set some boxes to Launch xbmc, runs script automagically = very happy wife Smile

Looking forward to further development, and I'll post feedback, bugs etc if I find any Smile

Thanks for creating this and sharing it.
Reply
#43
How long does the plugin take to start? It's been sat "initialising" for around 15 minutes. Is this normal/expected behaviour.
Reply
#44
It ran for another 35 minutes but just sat on "initialising" and never did anything Sad I have now cancelled it as the wife was moaning that nothing was on Smile

I'll try again another time, but I like this idea a lot! Smile
Reply
#45
Nah it should complete in a few seconds, so your version failed very early on.

When you first ran it, did it take you to the Addon Settings?

Did you use the version currently in the XBMC repo, or the one from Github?
Reply
  • 1
  • 2
  • 3(current)
  • 4
  • 5
  • 61

Logout Mark Read Team Forum Stats Members Help
LazyTV - an unwatched TV Show playlist generator4