Sha256: 893d529b1d93088949fa4dc11882209ca65d42f769b4f75274727ff95eb8986e

Contents?: true

Size: 679 Bytes

Versions: 2

Compression:

Stored size: 679 Bytes

Contents

# frozen_string_literal: true

# Browse photos by camera.
class Piccle::Streams::CameraStream < Piccle::Streams::BaseStream
  def namespace
    "by-camera"
  end

  def data_for(photo)
    {
      namespace => {
        :friendly_name => "By Camera",
        :interesting => false,
        slugify(camera_name(photo)) => {
          friendly_name: camera_name(photo),
          photos: [photo.md5]
        },
      }
    }
  end

  def metadata_for(photo)
    [{
      friendly_name: camera_name(photo),
      type: :camera,
      selector: [namespace, slugify(camera_name(photo))]
    }]
  end

  protected

  def camera_name(photo)
    photo.camera_name || "unknown"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
piccle-0.1.1.pre lib/piccle/streams/camera_stream.rb
piccle-0.1.0.rc1 lib/piccle/streams/camera_stream.rb