aboutsummaryrefslogtreecommitdiffstats
path: root/bin/common/srtool_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/common/srtool_utils.py')
-rwxr-xr-xbin/common/srtool_utils.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/common/srtool_utils.py b/bin/common/srtool_utils.py
index b48582dc..8c13f3a1 100755
--- a/bin/common/srtool_utils.py
+++ b/bin/common/srtool_utils.py
@@ -112,6 +112,30 @@ def settings():
#################################
+# remove_app_sources
+#
+
+def remove_app_sources(master_app):
+ conn = sqlite3.connect(srtDbName)
+ cur = conn.cursor()
+ cur_write = conn.cursor()
+
+ # Scan the SRTool Settings
+ cur.execute("SELECT * FROM orm_datasource")
+
+ is_change = False
+ for setting in cur:
+ if master_app == setting[ORM.DATASOURCE_SOURCE]:
+ print("Deleting [%s] = '%s','%s'" % (setting[ORM.DATASOURCE_ID], setting[ORM.DATASOURCE_SOURCE], setting[ORM.SRTSETTING_VALUE]))
+ sql = 'DELETE FROM orm_datasource WHERE id=?'
+ cur_write.execute(sql, (setting[ORM.DATASOURCE_ID],))
+ is_change = True
+
+ if is_change:
+ conn.commit()
+ conn.close()
+
+#################################
# fix_new_reserved
#
@@ -168,6 +192,7 @@ def main(argv):
parser.add_argument('--sources', '-s', nargs='?', const='display', help='SRTool Sources')
parser.add_argument('--reset-sources', '-r', action='store_const', const='reset_sources', dest='command', help='Reset SRTool Sources')
parser.add_argument('--settings', '-S', action='store_const', const='settings', dest='command', help='Show the SRT Settings')
+ parser.add_argument('--remove-app-sources', dest='remove_app_sources', help='Remove data sources for a previous app')
parser.add_argument('--force', '-f', action='store_true', dest='force', help='Force the update')
parser.add_argument('--verbose', '-v', action='store_true', dest='verbose', help='Debugging: verbose output')
@@ -203,6 +228,8 @@ def main(argv):
settings()
elif 'fix_new_reserved' == args.command:
fix_new_reserved()
+ elif args.remove_app_sources:
+ remove_app_sources(args.remove_app_sources)
else:
print("Command not found")
master_log.close()