Advertisement
kenmills69

Untitled

May 17th, 2021
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. # Build SQL query
  2. if not no_sources: # this is SQL for no sources
  3. sql = """DELETE FROM files WHERE idPath IN ( SELECT idPath FROM path WHERE ((""" + my_command + """)));"""
  4. # 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);"""
  5. else:
  6. 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 + """)));"""
  7. # 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);"""
  8. if my_command == "":
  9. sql=sql.replace('((strPath','(strPath').replace(' AND ()))',')')
  10. dbglog('SQL command is %s' % sql)
  11. if not specificpath and not replacepath:
  12. dbglog (our_source_list)
  13. our_select = sql.replace('DELETE FROM files','SELECT strPath FROM path',1)
  14. if bookmarks: # have to delete from paths table rather than files as there is a conflicting trigger on the files table
  15. our_select = sql.replace('DELETE FROM files', 'SELECT strPath FROM path WHERE idPath in (SELECT idPath FROM files', 1)
  16. our_select = our_select.replace('bookmark)', 'bookmark))',1)
  17. sql = sql.replace('DELETE FROM files','DELETE FROM path',1)
  18. dbglog('Select Command is %s' % our_select)
  19. elif not replacepath and specificpath: # cleaning a specific path
  20. if specific_path_to_remove != '':
  21. sql = """delete from path where idPath in(select * from (SELECT idPath FROM path WHERE (strPath LIKE '""" + specific_path_to_remove +"""%')) as temptable)"""
  22. our_select = "SELECT strPath FROM path WHERE idPath IN (SELECT idPath FROM path WHERE (strPath LIKE'" + specific_path_to_remove + "%'))"
  23. dbglog('Select Command is %s' % our_select)
  24. else:
  25. xbmcgui.Dialog().ok(addonname,'Error - Specific path selected but no path defined. Script aborted')
  26. dbglog("Error - Specific path selected with no path defined")
  27. exit_on_error()
  28. else: # must be replacing a path at this point
  29. if old_path != '' and new_path != '':
  30. our_select = "SELECT strPath from path WHERE strPath Like '" + old_path + "%'"
  31. else:
  32. xbmcgui.Dialog().ok(addonname,'Error - Replace path selected but one or more paths are not defined. Script aborted')
  33. dbglog('Error - Missing path for replacement')
  34. exit_on_error()
  35. xbmc.sleep(500)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement