[9] fix time to run

This commit is contained in:
meisnate12 2023-01-19 11:44:55 -05:00
parent 0916a7340e
commit a656221f7f
2 changed files with 15 additions and 6 deletions

View file

@ -1 +1 @@
1.18.3-develop8 1.18.3-develop9

View file

@ -50,11 +50,15 @@ parser.add_argument("-d", "--divider", dest="divider", help="Character that divi
parser.add_argument("-w", "--width", dest="width", help="Screen Width (Default: 100)", default=100, type=int) parser.add_argument("-w", "--width", dest="width", help="Screen Width (Default: 100)", default=100, type=int)
args = parser.parse_args() args = parser.parse_args()
test_value = None
def get_arg(env_str, default, arg_bool=False, arg_int=False): def get_arg(env_str, default, arg_bool=False, arg_int=False):
global test_value
env_vars = [env_str] if not isinstance(env_str, list) else env_str env_vars = [env_str] if not isinstance(env_str, list) else env_str
final_value = None final_value = None
for env_var in env_vars: for env_var in env_vars:
env_value = os.environ.get(env_var) env_value = os.environ.get(env_var)
if env_var == "BRANCH_NAME":
test_value = env_value
if env_value is not None: if env_value is not None:
final_value = env_value final_value = env_value
break break
@ -193,6 +197,8 @@ def start(attrs):
logger.info_center(" |___/ ") logger.info_center(" |___/ ")
system_ver = "Docker" if is_docker else "Linuxserver" if is_linuxserver else f"Python {platform.python_version()}" system_ver = "Docker" if is_docker else "Linuxserver" if is_linuxserver else f"Python {platform.python_version()}"
logger.info(f" Version: {version[0]} ({system_ver})") logger.info(f" Version: {version[0]} ({system_ver})")
logger.trace(f"BRANCH_NAME: {test_value}")
logger.trace(f"env_version: {env_version}")
latest_version = util.current_version(version, env_version=env_version) latest_version = util.current_version(version, env_version=env_version)
new_version = latest_version[0] if latest_version and (version[1] != latest_version[1] or (version[2] and version[2] < latest_version[2])) else None new_version = latest_version[0] if latest_version and (version[1] != latest_version[1] or (version[2] and version[2] < latest_version[2])) else None
if new_version: if new_version:
@ -967,11 +973,14 @@ def run_playlists(config):
if __name__ == "__main__": if __name__ == "__main__":
try: try:
params = {"config_file": config_file, "ignore_schedules": ignore_schedules}
if run or test or collections or libraries or metadata_files or resume: if run or test or collections or libraries or metadata_files or resume:
params["collections"] = collections params = {
params["libraries"] = libraries "config_file": config_file,
params["metadata_files"] = metadata_files "ignore_schedules": ignore_schedules,
"collections": collections,
"libraries": libraries,
"metadata_files": metadata_files
}
process(params) process(params)
else: else:
times_to_run = util.get_list(times) times_to_run = util.get_list(times)
@ -985,7 +994,7 @@ if __name__ == "__main__":
else: else:
raise Failed(f"Argument Error: blank time argument") raise Failed(f"Argument Error: blank time argument")
for time_to_run in valid_times: for time_to_run in valid_times:
params["time"] = time_to_run params = {"config_file": config_file, "ignore_schedules": ignore_schedules, "time": time_to_run}
schedule.every().day.at(time_to_run).do(process, params) schedule.every().day.at(time_to_run).do(process, params)
while True: while True:
schedule.run_pending() schedule.run_pending()