Sha256: e82222c8fcec5ae06726709e7963393c483593e5d5a7beab73950def736ebb04

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

#!/usr/bin/env ruby

require 'tryphon-pige-client'

Pige::Client.box_url = "http://#{ENV.fetch('PIGEBOX_HOST', 'pigebox.local')}"
include Pige::Client

ChunkScheduler.define do |schedule|
  # Schedule Chunks for yesterday by default
  day_back = ARGV.first ? ARGV.first.to_i : 1
  schedule.day = Date.today - day_back

# Doesn't really Chunks, only log orders
  schedule.dry_run = ENV.fetch('DRY_RUN',"true") != "false"

  # Default Attributes
  # can be overridden in each create
  schedule.default_attributes[:margin] = 5.minutes
  # schedule.default_attributes[:format] = "vorbis"

  # Daily Chunks
  schedule.create :title => "Flash 13h %d_%m_%Y", :begin => "13:00", :begin_label => "Generique Flash", :duration => 15.minutes, :end_label => "Fin Direct", :margin => 0

  # Only monday Chunks
  schedule.on(:monday) do
    create :title => "Emission Cinema lundi %d_%m_%Y", :begin => "17:00", :duration => 1.hour
    create :title => "Chronique 'A Table'", :begin => "13:00", :duration => 5.minutes
  end

  # Only tuesday Chunks
  schedule.on(:tuesday) do
    # ...
  end

  schedule.on(:wednesday) do
    # ...
  end

  schedule.on(:thursday) do
    # ...
  end

  schedule.on(:friday) do
    # ...
  end

  schedule.on(:saturday) do
    # ...
  end

  schedule.on(:sunday) do
    # ...
  end
end.download("/tmp")

# Remove oldest Chunks
#Pige::Client::Chunk.destroy_all(:older_than => 1.days.ago)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tryphon-pige-client-1.0.1 examples/scheduler_chunks_daily.rb
tryphon-pige-client-1.0 examples/scheduler_chunks_daily.rb