Project

seamus

0.0
No commit activity in last 3 years
No release in over 3 years
Seamus is not an Irish monk. Instead, it inspects a file and returns whatever metadata it can determine.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
>= 0
 Project Readme

Seamus¶ ↑

Seamus is not an Irish monk. Instead, it inspects a file and returns whatever metadata it can determine.

Usage¶ ↑

Seamus inspects your file and discovers useful attributes. It is at its best with rich digital media - video, audio and image files - but is suitable for use with any file type. Just provide a path to Seamus::Builder.new for an enhanced File object that knows about your file.

movie = Seamus::Builder.new("/path/to/my/movie.mov")

movie.width
# => 720

movie.video_codec
# => 'h264'

Or if you prefer, include Seamus in a class and use the has_file :file_attribute class method for attachments.

class Upload
  include Seamus
  has_file :file
end

u = Upload.new
u.file = "/path/to/image.jpg"
u.file.width
# => 3284

Seamus supports thumbnail creation for visual media types. The #thumbnail method returns an IO instance.

u.file.thumbnail
# => #<IO:0x357898>

Extending Seamus¶ ↑

Seamus dynamically generates classes for file types as it encounters them. Seamus::Builder will, for example, generate a Seamus::File::Mp4 class and instance when given a path to an MPEG-4 file with .mp4 extension, which subclasses Seamus::File::Video.

You can build custom behavior around a file type by defining a class Seamus::File::<extname> that either subclasses File, subclasses one of Seamus::File’s template classes, or implements a path handler of some kind.

Note on Patches/Pull Requests¶ ↑

  • I’d be very surprised if anyone wanted to do such a thing. But if you really do, contact me and we’ll work something out.

Copyright © 2010 Scott Burton. See LICENSE for details.