Sha256: a25037cb632b7615569f579928bafc5ec1a30ad1fe86305803e92b43261f5748

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby

require 'tryphon-pige-client'

Pige::Client.box_url = "http://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 = true

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

  # Daily Chunks
  schedule.create :title => "Flash 13h %d_%m_%Y", :begin => "13:00", :duration => 15.minutes, :margin => 2.minutes

  # 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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tryphon-pige-client-0.0.3 examples/scheduler_chunks_daily.rb