# Path: gogdb/core/normalization.py
# def normalize_system(system_name):
#     system_name = system_name.lower()
#     if system_name == "mac":
#         return "osx"
#     else:
#         return system_name


import dateutil.parser
import collections
import re
import gogdb.core.model as model
from gogdb.core.normalization import normalize_system


def parse_datetime(date_str):
    if date_str is None:
        return None
    else:
        return dateutil.parser.isoparse(date_str)


IMAGE_RE = re.compile(r"\w{64}")
def extract_imageid(image_url):
    if image_url is None:
        return None
    m = IMAGE_RE.search(image_url)
    if m is None:
        return None
    else:
        return m.group(0)

def extract_properties_v0(prod, v0_cont):
    prod.id = v0_cont["id"]
    prod.access = 1

    prod.title = v0_cont["title"]
    prod.type = v0_cont["game_type"]
    prod.slug = v0_cont["slug"]

    prod.cs_systems = []
    for cs_name in ["windows", "osx", "linux"]:
        if v0_cont["content_system_compatibility"][cs_name]:

# Path: gogdb/core/normalization.py
# def normalize_system(system_name):
#     system_name = system_name.lower()
#     if system_name == "mac":
#         return "osx"
#     else:
#         return system_name


# Path: gogdb/updater/dataextractors.py
import dateutil.parser
import collections
import re
import gogdb.core.model as model
from gogdb.core.normalization import normalize_system



def parse_datetime(date_str):
    if date_str is None:
        return None
    else:
        return dateutil.parser.isoparse(date_str)


IMAGE_RE = re.compile(r"\w{64}")
def extract_imageid(image_url):
    if image_url is None:
        return None
    m = IMAGE_RE.search(image_url)
    if m is None:
        return None
    else:
        return m.group(0)

def extract_properties_v0(prod, v0_cont):
    prod.id = v0_cont["id"]
    prod.access = 1

    prod.title = v0_cont["title"]
    prod.type = v0_cont["game_type"]
    prod.slug = v0_cont["slug"]

    prod.cs_systems = []
    for cs_name in ["windows", "osx", "linux"]:
        if v0_cont["content_system_compatibility"][cs_name]:

            prod.cs_systems.append(normalize_system(cs_name))