<commit_before>import os
import re
import logging

import requests
from bs4 import BeautifulSoup
from PIL import Image
from django.conf import settings

from games.models import Company
from platforms.models import Platform


LOGGER = logging.getLogger(__name__)
API_URL = "http://thegamesdb.net/api/"
UNSUPPORTED_PLATFORMS = (
    'Microsoft Xbox',
    'Microsoft Xbox 360',
    'Microsoft Xbox One',
    'Sony Playstation 3',
    'Sony Playstation 4',
    'Sony Playstation Vita',
    'Android',
    'iOS',
    'Nintendo 3DS',
    'N-Gage',
)

PLATFORM_MAP = {
    'Arcade': 'arcade',
    'PC': 'windows',
    'Sega Genesis': 'sega-genesis',
    'Sega Mega Drive': 'sega-genesis',
    'Nintendo Entertainment System (NES)': 'nes',
    'Super Nintendo (SNES)': 'super-nintendo',
    'Nintendo 64': 'nintendo-64',
    'Atari Jaguar': 'atari-jaguar',
    'Sony Playstation': 'sony-playstation',
    'Sony Playstation 2': 'sony-playstation-2',
}


def download_image(media_type, url):
    """Download an image from TheGamesDB (is necessary) and return its local path"""
    media_type_map = {
        'clearlogo': settings.TGD_CLEAR_LOGO_PATH,
        'banner': settings.TGD_BANNER_PATH,
        'screenshot': settings.TGD_SCREENSHOT_PATH,
        'fanart': settings.TGD_FANART_PATH
    }
    dest_path = os.path.join(media_type_map[media_type], os.path.basename(url))
    if not os.path.exists(dest_path):
        response = requests.get(url)
        with open(dest_path, 'w') as dest_file:
            dest_file.write(response.content)
    return dest_path

<commit_msg>Add some missing TGDB mappings<commit_after>import os
import re
import logging

import requests
from bs4 import BeautifulSoup
from PIL import Image
from django.conf import settings

from games.models import Company
from platforms.models import Platform


LOGGER = logging.getLogger(__name__)
API_URL = "http://thegamesdb.net/api/"
UNSUPPORTED_PLATFORMS = (
    'Microsoft Xbox',
    'Microsoft Xbox 360',
    'Microsoft Xbox One',
    'Sony Playstation 3',
    'Sony Playstation 4',
    'Sony Playstation Vita',
    'Android',
    'iOS',
    'Nintendo 3DS',
    'N-Gage',
)

PLATFORM_MAP = {
    'Arcade': 'arcade',
    'Atari ST': 'atari-st',
    'PC': 'windows',
    'Sega Genesis': 'sega-genesis',
    'Sega Mega Drive': 'sega-genesis',
    'Sega Master System': 'sega-master-system',
    'Nintendo Entertainment System (NES)': 'nes',
    'Super Nintendo (SNES)': 'super-nintendo',
    'Nintendo 64': 'nintendo-64',
    'Atari Jaguar': 'atari-jaguar',
    'Sony Playstation': 'sony-playstation',
    'Sony Playstation 2': 'sony-playstation-2',
    'Sony PSP': 'sony-psp',
}


def download_image(media_type, url):
    """Download an image from TheGamesDB (is necessary) and return its local path"""
    media_type_map = {
        'clearlogo': settings.TGD_CLEAR_LOGO_PATH,
        'banner': settings.TGD_BANNER_PATH,
        'screenshot': settings.TGD_SCREENSHOT_PATH,
        'fanart': settings.TGD_FANART_PATH
    }
    dest_path = os.path.join(media_type_map[media_type], os.path.basename(url))
    if not os.path.exists(dest_path):
        response = requests.get(url)
        with open(dest_path, 'w') as dest_file:
            dest_file.write(response.content)
    return dest_path


{'fraction_non_alphanumeric': 0.125114995400184, 'fraction_numerical': 0.007973014412756822, 'mean_word_length': 3.5242718446601944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '761666', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1110, 'n_words': 272}