from hircine.plugins import transformer
from hircine.scraper.types import Artist, Tag


@transformer
def transform(generator, info):
    for item in generator:
        # Ignore the "Drama" tag when scraping from mangadex
        if info.source == "mangadex":
            match item:
                case Tag(tag="Drama"):
                    continue

        # convert all Artist names to lowercase
        match item:
            case Artist(name):
                yield Artist(name.lower())
                continue

        # other items are not modified
        yield item