<commit_before>require 'rss'

class RSSCreator
  def initialize(channel, baseURL)
    @channel = channel
    @baseURL = baseURL
  end

  def run!
    rss = RSS::Maker.make("2.0") do |maker|
      rssChannel = make_channel(maker)

      @channel.videos.each do |vid|
        item = make_item(vid, maker)
      end

    end

    write_rss(rss)
  end

  private
  def make_channel(maker)
    maker.channel.title = @channel.title
    maker.channel.description = @channel.description
    maker.channel.link = @channel.url
    maker.channel.updated = Time.now.to_s
    maker.channel.author = @channel.author
    maker.channel.id = @channel.url

    #maker.channel.image = RSS:Rss::Channel::Image.new
    #maker.channel.image.url = @channel.preview_url
    #maker.channel.image.title = channel.title
    #maker.channel.image.link = channel.link
  end

  def make_item(video, maker)
    link = build_public_filename(video)

    maker.items.new_item do |item|
      item.title = video.title
      item.link = link
      item.description = video.description
      item.updated = video.published_at

      item.enclosure.url = item.link
      item.enclosure.length = File.size(video.output_filename)<commit_msg>channel picture<commit_after>require 'rss'

class RSSCreator
  def initialize(channel, baseURL)
    @channel = channel
    @baseURL = baseURL
  end

  def run!
    rss = RSS::Maker.make("2.0") do |maker|
      rssChannel = make_channel(maker)

      @channel.videos.each do |vid|
        item = make_item(vid, maker)
      end

    end

    write_rss(rss)
  end

  private
  def make_channel(maker)
    maker.channel.title = @channel.title
    maker.channel.description = @channel.description
    maker.channel.link = @channel.url
    maker.channel.updated = Time.now.to_s
    maker.channel.author = @channel.author
    maker.channel.id = @channel.url

    maker.channel.logo = @channel.thumbnail_url
  end

  def make_item(video, maker)
    link = build_public_filename(video)

    maker.items.new_item do |item|
      item.title = video.title
      item.link = link
      item.description = video.description
      item.updated = video.published_at

      item.enclosure.url = item.link
      item.enclosure.length = File.size(video.output_filename)
{'fraction_non_alphanumeric': 0.10573078631719236, 'fraction_numerical': 0.001776988005330964, 'mean_word_length': 2.8894645941278068, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2317946', 'n_tokens_mistral': 740, 'n_tokens_neox': 709, 'n_words': 142}