# 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 sys
import datetime
import copy
import itertools
import sqlalchemy
import flask
import gogdb.legacy.model as legacy_model
import gogdb.core.storage
import gogdb.core.model as new_model
import gogdb.core.changelogger as changelogger
from gogdb.core.normalization import normalize_system
    exported_ids = set()

    l_products = l_session.query(legacy_model.Product)
    for l_prod in l_products:
        exported_ids.add(n_prod.id)

def convert_files(l_files, prod_id):
    return [
        new_model.File(
            id = l_file.slug,
            size = l_file.size,
            downlink = f"https://api.gog.com/products/{ prod_id }/downlink/installer/{ l_file.slug }"
        ) for l_file in l_files if not l_file.deleted
    ]

def convert_bonusdl(l_dl, prod_id):
    return new_model.BonusDownload(
        id = l_dl.slug,
        name = l_dl.name,
        total_size = l_dl.total_size,
        bonus_type = l_dl.bonus_type,
        count = l_dl.count,
        files = convert_files(l_dl.files, prod_id)
    )

def convert_softwaredl(l_dl, prod_id):
    return new_model.SoftwareDownload(
        id = l_dl.slug,
        name = l_dl.name,
        total_size = l_dl.total_size,

# 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/legacy/exporter.py
import sys
import datetime
import copy
import itertools
import sqlalchemy
import flask
import gogdb.legacy.model as legacy_model
import gogdb.core.storage
import gogdb.core.model as new_model
import gogdb.core.changelogger as changelogger
from gogdb.core.normalization import normalize_system

    exported_ids = set()

    l_products = l_session.query(legacy_model.Product)
    for l_prod in l_products:
        exported_ids.add(n_prod.id)

def convert_files(l_files, prod_id):
    return [
        new_model.File(
            id = l_file.slug,
            size = l_file.size,
            downlink = f"https://api.gog.com/products/{ prod_id }/downlink/installer/{ l_file.slug }"
        ) for l_file in l_files if not l_file.deleted
    ]

def convert_bonusdl(l_dl, prod_id):
    return new_model.BonusDownload(
        id = l_dl.slug,
        name = l_dl.name,
        total_size = l_dl.total_size,
        bonus_type = l_dl.bonus_type,
        count = l_dl.count,
        files = convert_files(l_dl.files, prod_id)
    )

def convert_softwaredl(l_dl, prod_id):
    return new_model.SoftwareDownload(
        id = l_dl.slug,
        name = l_dl.name,
        total_size = l_dl.total_size,

        os = normalize_system(l_dl.os),