TV show list?
#1
Question 
Hi,

Im new in this scripting for XBMC and i was searching web and this forum and couldnt find answer to my problem.

Basically what i want to achieve is to read all folders in TV Show (virtual disk), get list of all tv shows titles. Than run the script to get all episodes from thetvdb.com and compare that list with the local file list.

I have already wrote script to get list from tvdb. Also if i hardcode folder name, compare is working also.
What i dont know is how to get virtual disk, filesystem, folder name .. Should i query the sql db for that via HTTP API or is there some other way to do that ?
Reply
#2
you just want the list of shows/eps? if so look into the json api.
Reply
#3
I cant test it right now ..

is this correct ?
Code:
url = 'http://localhost:8080'
jsonrpcurl = url + '/jsonrpc'

def getListXBMC ():
    tvshows = execJson(VideoLibrary.GetTVShows)
    for t_item in tvshows:
        params = [t_item]
        seasons = execJson(VideoLibrary.GetSeasons, params)
        for s_item in seasons:
            params2 = [t_item, s_item]
            episodes = execJson(VideoLibrary.GetEpisodes, params2)

def execJson (a_postdata, params):
    if len(params) == 1:
        postdata = json.dumps({'jsonrpc': "2.0", 'method': a_postdata, "params": {"tvshowid": [params[0]]}, "id":1})
    elif len(params) == 2:
        postdata = json.dumps({'jsonrpc': "2.0", 'method': a_postdata, "params": {"tvshowid": [params[0]], "season": [params[1]]}, "id":1})
    else
        postdata = json.dumps({'jsonrpc': "2.0", 'method': a_postdata, "id":1})
    retval = urllib.urlopen(jsonrpcurl, postdata).read()
    return retval
Reply
#4
Hi,

I cant check it right now, cause i dont have installed json RPC on current machine. Is this correct way to get all episodes ?

Code:
url = 'http://localhost:8080'
jsonrpcurl = url + '/jsonrpc'

def getListXBMC ():
    tvshows = execJson(0, '')
    for t_item in tvshows:
        params = [t_item]
        seasons = execJson(1, params)
        for s_item in seasons:
            params2 = [t_item, s_item]
            episodes = execJson(2, params2)

def execJson (argc, params):
    if argc== 1:
        postdata = json.dumps({'jsonrpc': "2.0", 'method': 'VideoLibrary.GetSeasons', "params": {"tvshowid": [params[0]]}, "id":1})
    elif argc== 2:
        postdata = json.dumps({'jsonrpc': "2.0", 'method': 'VideoLibrary.GetEpisodes', "params": {"tvshowid": [params[0]], "season": [params[1]]}, "id":1})
    else:
        postdata = json.dumps({'jsonrpc': "2.0", 'method': 'VideoLibrary.GetTVShows', "id":1})
        
    retval = urllib.urlopen(jsonrpcurl, postdata).read()
    return retval
Reply

Logout Mark Read Team Forum Stats Members Help
TV show list?0