# Path: modules/get_banner.py
# def get_banner(game_name, url, banner_path, lib):
# 
#     banner_req = urllib_request(url)
# 
#     try:
# 
#         if not os.path.exists(banner_path):
#             os.makedirs(banner_path)
# 
#         banner_data = urllib_urlopen(banner_req).read()
#         banner_file = open(banner_path + '/' + game_name + '.jpg', 'wb')
#         banner_file.write(banner_data)
#         banner_file.close()
# 
#         pic_src = Image.open(banner_path + '/' + game_name + '.jpg')
#         pic = pic_src.resize((518, 240), PIL.Image.ANTIALIAS)
#         pic.save(banner_path + '/' + game_name + '.jpg')
# 
#         if lib == 'goglib':
# 
#             if not os.path.exists(banner_path + '/unavailable/'):
#                 os.makedirs(banner_path + '/unavailable/')
# 
#             new_pic = Image.open(banner_path + '/' + game_name + '.jpg')
#             pic_grey = new_pic.convert('L')
#             pic_grey.save(banner_path + '/unavailable/' + game_name + '.jpg')
# 
#     except urllib_urlerror as e:
#         print(e.reason)
#     except urllib_httperror as e:
#         print(e.code)
#         print(e.read())


import os, sys
    import sys
    from ConfigParser import ConfigParser as ConfigParser
    from configparser import ConfigParser as ConfigParser
from modules import get_banner
                additions_file.close()
                os.chmod(additions_file_path, 0o711)

        if parser.has_option(game_name, 'dos_iso'):
            dos_iso = parser.get(game_name, 'dos_iso')
        else:
            dos_iso = ''

        if parser.has_option(game_name, 'dos_exe'):
            dos_exe = parser.get(game_name, 'dos_exe')
            if dos_exe != '':
                print("Writing start.sh")

                start_lines = ['#!/bin/bash\n',
                'python "$NEBULA_DIR/launcher_dosbox.py" ' + game_name]

                exe_dir = ''
                if '\\' in dos_exe:
                    exe = dos_exe.split('\\')[-1]
                    exe_dir = '\\'.join(dos_exe.split('\\')[:-1])
                    dos_exe = exe

                start_file_path = install_dir + '/' + game_name + '/start.sh'
                start_file = open(start_file_path, 'w')
                for line in start_lines:
                    start_file.write(line)
                start_file.close()
                os.chmod(start_file_path, 0o711)

                game_conf_lines = ['[autoexec]\n',

# Path: modules/get_banner.py
# def get_banner(game_name, url, banner_path, lib):
# 
#     banner_req = urllib_request(url)
# 
#     try:
# 
#         if not os.path.exists(banner_path):
#             os.makedirs(banner_path)
# 
#         banner_data = urllib_urlopen(banner_req).read()
#         banner_file = open(banner_path + '/' + game_name + '.jpg', 'wb')
#         banner_file.write(banner_data)
#         banner_file.close()
# 
#         pic_src = Image.open(banner_path + '/' + game_name + '.jpg')
#         pic = pic_src.resize((518, 240), PIL.Image.ANTIALIAS)
#         pic.save(banner_path + '/' + game_name + '.jpg')
# 
#         if lib == 'goglib':
# 
#             if not os.path.exists(banner_path + '/unavailable/'):
#                 os.makedirs(banner_path + '/unavailable/')
# 
#             new_pic = Image.open(banner_path + '/' + game_name + '.jpg')
#             pic_grey = new_pic.convert('L')
#             pic_grey.save(banner_path + '/unavailable/' + game_name + '.jpg')
# 
#     except urllib_urlerror as e:
#         print(e.reason)
#     except urllib_httperror as e:
#         print(e.code)
#         print(e.read())


# Path: modules/autosetup.py
import os, sys
    import sys
    from ConfigParser import ConfigParser as ConfigParser
    from configparser import ConfigParser as ConfigParser
from modules import get_banner

                additions_file.close()
                os.chmod(additions_file_path, 0o711)

        if parser.has_option(game_name, 'dos_iso'):
            dos_iso = parser.get(game_name, 'dos_iso')
        else:
            dos_iso = ''

        if parser.has_option(game_name, 'dos_exe'):
            dos_exe = parser.get(game_name, 'dos_exe')
            if dos_exe != '':
                print("Writing start.sh")

                start_lines = ['#!/bin/bash\n',
                'python "$NEBULA_DIR/launcher_dosbox.py" ' + game_name]

                exe_dir = ''
                if '\\' in dos_exe:
                    exe = dos_exe.split('\\')[-1]
                    exe_dir = '\\'.join(dos_exe.split('\\')[:-1])
                    dos_exe = exe

                start_file_path = install_dir + '/' + game_name + '/start.sh'
                start_file = open(start_file_path, 'w')
                for line in start_lines:
                    start_file.write(line)
                start_file.close()
                os.chmod(start_file_path, 0o711)

                game_conf_lines = ['[autoexec]\n',

                '@echo off\n',