JellyPlex-Watched/test/validate_ci_marklog.py

46 lines
1.4 KiB
Python

# Check the mark.log file that is generated by the CI to make sure it contains the expected values
import os
def read_marklog():
marklog = os.path.join(os.getcwd(), "mark.log")
with open(marklog, "r") as f:
lines = f.readlines()
return lines
def check_marklog(lines, expected_values):
for line in lines:
# Remove the newline character
line = line.strip()
if line not in expected_values:
print("Line not found in marklog: " + line)
return False
return True
def main():
expected_values = [
"jellyplex_watched/Movies/Five Nights at Freddy's",
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/300670",
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/300741",
"JellyUser/Movies/Big Buck Bunny",
"JellyUser/Shows/Doctor Who/The Unquiet Dead",
"JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies",
]
lines = read_marklog()
if not check_marklog(lines, expected_values):
print("Marklog did not contain the expected values")
exit(1)
else:
print("Marklog contained the expected values")
if __name__ == "__main__":
main()