Added a check for problematic titles, with txt files and fixed typos

This commit is contained in:
CronyAkatsuki 2021-07-03 16:04:48 +02:00
parent d94ab5b7b1
commit 5446fe32d6
3 changed files with 19 additions and 5 deletions

18
adl.py
View File

@ -7,7 +7,9 @@ account = "0" # trackma account
retrieve = True # retrieve new list retrieve = True # retrieve new list
player = "mpv" # specific player player = "mpv" # specific player
download = False # specify whether to download or not download = False # specify whether to download or not
msg = "watching" msg = "watching" # msg for the watch prompt
good_title = open("good_title.txt").readlines() # the list of good titles
problematic_titles = open("problem_title.txt").readlines() # list of problematic titles
ap = argparse.ArgumentParser() ap = argparse.ArgumentParser()
@ -85,11 +87,19 @@ def exit_ask():
elif choice == "Y" or choice == "y": elif choice == "Y" or choice == "y":
return return
# check for problematic title
def check_title(title):
for problem in problematic_titles:
if problem.__contains__(title):
title = good_title[problematic_titles.index(problem)]
return title
# get your title # get your title
def get_title(full_choice): def get_title(full_choice):
full_choice = full_choice[9:55] full_choice = full_choice[9:55]
full_choice = full_choice.rstrip(".") full_choice = full_choice.rstrip(".")
return full_choice title = check_title(full_choice)
return title
# get episode # get episode
def get_episode(full_choice): def get_episode(full_choice):
@ -184,7 +194,7 @@ def update_title(title, episode):
custom = color_prommpt("Enter updated episode number: ") custom = color_prommpt("Enter updated episode number: ")
if custom != "": if custom != "":
os.system('trackma -a ' + account + ' update "' + title + '" ' + custom) os.system('trackma -a ' + account + ' update "' + title + '" ' + custom)
os.system('trackma -a' + account + 'send') os.system('trackma -a' + account + ' send')
retrieve_list_update(account) retrieve_list_update(account)
else: else:
color_print("Skipping updating...") color_print("Skipping updating...")
@ -195,7 +205,7 @@ def update_score(title, score):
custom = color_prommpt("Enter updated score: ") custom = color_prommpt("Enter updated score: ")
if custom != "": if custom != "":
os.system('trackma -a ' + account + ' score "' + title + '" ' + custom) os.system('trackma -a ' + account + ' score "' + title + '" ' + custom)
os.system('trackma -a' + account + 'send') os.system('trackma -a' + account + ' send')
retrieve_list_update(account) retrieve_list_update(account)
else: else:
color_print("Skipping updating...") color_print("Skipping updating...")

2
good_title.txt Normal file
View File

@ -0,0 +1,2 @@
That Time I Got Reincarnated as a Slime Season 2
Komi-san wa, Komyushou desu.

2
problem_title.txt Normal file
View File

@ -0,0 +1,2 @@
That Time I Got Reincarnated as a Slime Season
Komi-san wa, Komyushou desu