# Path: foos/ui/ui.py
# def registerMenu(f):
#     menuGenerators.append(f)


import time
import logging
import json
import random
import os
import glob
import shutil
import foos.config as config
from foos.ui.ui import registerMenu
#!/usr/bin/python3



logger = logging.getLogger(__name__)

league_results_dir = os.path.join(config.league_dir, 'results')
league_file = os.path.join(config.league_dir, 'league.json')
processed_dir = os.path.join(config.league_dir, 'processed')


class DiskBackend:
    def __init__(self):
        os.makedirs(league_results_dir, exist_ok=True)
        os.makedirs(processed_dir, exist_ok=True)

    def get_games(self):
        with open(league_file) as f:
            competition = json.load(f)
            return self.filter_played_games(competition)

    def write_games(self, competition):
        # avoid rewriting the same content

# Path: foos/ui/ui.py
# def registerMenu(f):
#     menuGenerators.append(f)


# Path: plugins/league.py
import time
import logging
import json
import random
import os
import glob
import shutil
import foos.config as config
from foos.ui.ui import registerMenu

#!/usr/bin/python3



logger = logging.getLogger(__name__)

league_results_dir = os.path.join(config.league_dir, 'results')
league_file = os.path.join(config.league_dir, 'league.json')
processed_dir = os.path.join(config.league_dir, 'processed')


class DiskBackend:
    def __init__(self):
        os.makedirs(league_results_dir, exist_ok=True)
        os.makedirs(processed_dir, exist_ok=True)

    def get_games(self):
        with open(league_file) as f:
            competition = json.load(f)
            return self.filter_played_games(competition)

    def write_games(self, competition):
        # avoid rewriting the same content

        if os.path.exists(league_file):