Untitled

mail@pastecode.io avatar
unknown
plain_text
4 years ago
1.4 kB
3
Indexable
Never
# TV Shows List
import json


command = int(input("Do You Want To Add, See Or Modify List? 1/2/3 "))
if command == 1:
    add_show = input("Type In Show Name: ")
    add_season = input("Type In Show Season That You Are Waiting For: ")
    add_episode = input(f"Type In Show Episode Of Season {add_season} That You Are Waiting For: ")

    with open('tv_shows.json', 'r+') as tv_shows:
        tvsh = json.load(tv_shows)
        new_tvsh = {add_show: [add_season, add_episode]}
        tvsh.update(new_tvsh)
        tv_shows.seek(0)
        json.dump(tvsh, tv_shows)
elif command == 2:
    with open('tv_shows.json', 'r+') as tv_shows:
        tvsh = json.load(tv_shows)
        for show in tvsh:
            print(f"You Are Waiting To {show}'s Season {tvsh[show][0]} Episode {tvsh[show][1]}")
        tv_shows.seek(0)
        json.dump(tvsh, tv_shows)
elif command == 3:
    with open('tv_shows.json', 'r+') as tv_shows:
        tvsh = json.load(tv_shows)
        for show in tvsh:
            print(f"You Are Waiting To {show}'s Season {tvsh[show][0]} Episode {tvsh[show][1]}")
        choosemodify = input("Choose Show To Modify: ")
        modify_season = input("Type In Show Season That You Are Waiting For: ")
        modify_episode = input(f"Type In Show Episode Of Season {modify_season} That You Are Waiting For: ")
        tvsh[choosemodify] = [modify_season, modify_episode]
        tv_shows.seek(0)
        json.dump(tvsh, tv_shows)