From cac54b093e91d9ffe10ca014018c14c5280f2de9 Mon Sep 17 00:00:00 2001 From: mutto233 <39921339+mutto233@users.noreply.github.com> Date: Thu, 5 Jul 2018 00:12:25 -0400 Subject: [PATCH] Global_DatabaseUpdate selective update To follow the changes made for the individual PseudoChannel.py file, now the global database update can be done for only certain sections. This is accomplished with -um, -utv, and -uc. --- main-dir/Global_DatabaseUpdate.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/main-dir/Global_DatabaseUpdate.py b/main-dir/Global_DatabaseUpdate.py index 0c53074..1e25db8 100644 --- a/main-dir/Global_DatabaseUpdate.py +++ b/main-dir/Global_DatabaseUpdate.py @@ -4,6 +4,7 @@ Created on Thu Jun 28 17:33:59 2018 @author: Matt """ +import argparse import sqlite3 import os from shutil import copy2 @@ -13,9 +14,34 @@ channel_dir_increment_symbol = "_" +parser = argparse.ArgumentParser(description="Global Database Update Script") + + +parser.add_argument('-u','--update_all',action='store_true',help='update ALL elements (default)') +parser.add_argument('-um','--update_movies',action='store_true',help='update MOVIE elements') +parser.add_argument('-utv','--update_tv',action='store_true',help='update TV elements') +parser.add_argument('-uc','--update_comm',action='store_true',help='update COMMERCIAL elements') +args = parser.parse_args() + +update_flags = '-u' +if args.update_all: + update_flags = '-u' +else: + update_flags='' + if args.update_movies: + update_flags+=' -um' + if args.update_tv: + update_flags+=' -utv' + if args.update_comm: + update_flags+=' -uc' + + +update_call = "sudo python PseudoChannel.py %s" % update_flags + + # Step ONE: Global database update -print("+++++ Doing global update from PLEX") -os.system('sudo python PseudoChannel.py -u') +print("+++++ Doing global update from PLEX: %s" % update_flags) +os.system(update_call) base_dirA = os.path.dirname(os.path.abspath(__file__))