Request force scanfolder

k_zeon

New member
May 7, 2012
82
0
0
i am trying to create an addon that given a list of paths will scan for new tv episodes
the problem i am facing is the scan does not seem to be working properly.
I have it at the moment where it does scan each path, but think its not waiting for
previous path to finish scanning, hence i think its not working properely.

Code:
import sys
import os
import subprocess
import xbmc, xbmcaddon,xbmcgui



xaddon = xbmcaddon.Addon(id='script.runmyscan')
addonpath = xaddon.getAddonInfo('path')


if xbmc.getCondVisibility('Library.IsScanning'):
    dialog = xbmcgui.Dialog()
    dialog.ok('Scanning..', "Scan is already running. Stop Current Scan and try again")
else:

    
    text_file = open(addonpath + "/paths.txt", "r")
    #lines = text_file.readlines()
    lines = text_file.read().split('\n')
    print lines

    for path in lines:
        #print path

        xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": {"directory": "' + path + '" }, "id": 1 }}')
        xbmc.sleep(200)
        while xbmc.getCondVisibility('Library.IsScanning'):
            xbmc.sleep(200)

xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": 1 }}')
can anyone help.

Been advised to use Monitor.onDatabaseScanStarted and onDatabaseUpdated (called when scan starts/stops, don't mind the names) and create a locking mechanism of sort to make sure the scan has finished before executing next scan.

does anyone have any examples to help

thanks
 
Last edited:

k_zeon

New member
May 7, 2012
82
0
0
ok, thanks. I too seem to only get access in mornings to tvaddons.co , rest of the time server is too busy.
Really want to get my addon working properly since XBMC took away the scanNewContent from a TV Show Playlist.
 

k_zeon

New member
May 7, 2012
82
0
0
Hi Showgun. do you think its been long enough for another bump.
Still have not found an answer to my question.

tks