# Path: sigal/signals.py



import logging
import os
from datetime import datetime
from markupsafe import Markup
from sigal import signals
    from feedgenerator import Atom1Feed, Rss201rev2Feed
    nb_items = min(nb_items, nb_medias) if nb_items > 0 else nb_medias
    base_url = feed_url.rsplit('/', maxsplit=1)[0]

    for item in medias[:nb_items]:
        if theme == 'galleria':
            link = f'{base_url}/{item.path}/#{item.url}'
        else:
            link = f'{base_url}/{item.path}/'

        feed.add_item(
            title=Markup.escape(item.title or item.url),
            link=link,
            # unique_id='tag:%s,%s:%s' % (urlparse(link).netloc,
            #                             item.date.date(),
            #                             urlparse(link).path.lstrip('/')),
            description='<img src="{}/{}/{}" />'.format(
                base_url, item.path, item.thumbnail
            ),
            # categories=item.tags if hasattr(item, 'tags') else None,
            author_name=getattr(item, 'author', ''),
            pubdate=item.date or datetime.now(),
        )

    output_file = os.path.join(root_album.dst_path, feed_url.split('/')[-1])
    logger.info('Generate %s feeds: %s', feed_type.upper(), output_file)
    with open(output_file, 'w', encoding='utf8') as f:
        feed.write(f, 'utf-8')


def register(settings):

# Path: sigal/signals.py



# Path: sigal/plugins/feeds.py
import logging
import os
from datetime import datetime
from markupsafe import Markup
from sigal import signals
    from feedgenerator import Atom1Feed, Rss201rev2Feed

    nb_items = min(nb_items, nb_medias) if nb_items > 0 else nb_medias
    base_url = feed_url.rsplit('/', maxsplit=1)[0]

    for item in medias[:nb_items]:
        if theme == 'galleria':
            link = f'{base_url}/{item.path}/#{item.url}'
        else:
            link = f'{base_url}/{item.path}/'

        feed.add_item(
            title=Markup.escape(item.title or item.url),
            link=link,
            # unique_id='tag:%s,%s:%s' % (urlparse(link).netloc,
            #                             item.date.date(),
            #                             urlparse(link).path.lstrip('/')),
            description='<img src="{}/{}/{}" />'.format(
                base_url, item.path, item.thumbnail
            ),
            # categories=item.tags if hasattr(item, 'tags') else None,
            author_name=getattr(item, 'author', ''),
            pubdate=item.date or datetime.now(),
        )

    output_file = os.path.join(root_album.dst_path, feed_url.split('/')[-1])
    logger.info('Generate %s feeds: %s', feed_type.upper(), output_file)
    with open(output_file, 'w', encoding='utf8') as f:
        feed.write(f, 'utf-8')


def register(settings):

    signals.gallery_build.connect(generate_feeds)