Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Build SQL query
- if not no_sources: # this is SQL for no sources
- sql = """DELETE FROM files WHERE idPath IN ( SELECT idPath FROM path WHERE ((""" + my_command + """)));"""
- # sql2="""DELETE FROM path WHERE idPath IN (SELECT * FROM( SELECT idPath FROM path WHERE ((strPath LIKE 'rtmp://%' OR strPath Like 'rtmpe:%' OR strPath LIKE 'plugin:%' OR strPath LIKE 'http://%') AND (""" + my_command +"""))) as pathsub);"""
- else:
- sql = """DELETE FROM files WHERE idPath IN (SELECT idPath FROM path WHERE ((strPath LIKE 'rtmp://%' OR strPath LIKE 'rtmpe:%' OR strPath LIKE 'plugin:%' OR strPath LIKE 'http://%' OR strPath LIKE 'https://%') AND (""" + my_command + """)));"""
- # sql2= """DELETE FROM path WHERE idPath IN (SELECT * FROM( SELECT idPath FROM path WHERE (strPath LIKE 'rtmp://%' OR strPath Like 'rtmpe:%' OR strPath LIKE 'plugin:%' OR strPath LIKE 'http://%') as pathsub);"""
- if my_command == "":
- sql=sql.replace('((strPath','(strPath').replace(' AND ()))',')')
- dbglog('SQL command is %s' % sql)
- if not specificpath and not replacepath:
- dbglog (our_source_list)
- our_select = sql.replace('DELETE FROM files','SELECT strPath FROM path',1)
- if bookmarks: # have to delete from paths table rather than files as there is a conflicting trigger on the files table
- our_select = sql.replace('DELETE FROM files', 'SELECT strPath FROM path WHERE idPath in (SELECT idPath FROM files', 1)
- our_select = our_select.replace('bookmark)', 'bookmark))',1)
- sql = sql.replace('DELETE FROM files','DELETE FROM path',1)
- dbglog('Select Command is %s' % our_select)
- elif not replacepath and specificpath: # cleaning a specific path
- if specific_path_to_remove != '':
- sql = """delete from path where idPath in(select * from (SELECT idPath FROM path WHERE (strPath LIKE '""" + specific_path_to_remove +"""%')) as temptable)"""
- our_select = "SELECT strPath FROM path WHERE idPath IN (SELECT idPath FROM path WHERE (strPath LIKE'" + specific_path_to_remove + "%'))"
- dbglog('Select Command is %s' % our_select)
- else:
- xbmcgui.Dialog().ok(addonname,'Error - Specific path selected but no path defined. Script aborted')
- dbglog("Error - Specific path selected with no path defined")
- exit_on_error()
- else: # must be replacing a path at this point
- if old_path != '' and new_path != '':
- our_select = "SELECT strPath from path WHERE strPath Like '" + old_path + "%'"
- else:
- xbmcgui.Dialog().ok(addonname,'Error - Replace path selected but one or more paths are not defined. Script aborted')
- dbglog('Error - Missing path for replacement')
- exit_on_error()
- xbmc.sleep(500)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement