Module dryos

DryOS operating system functions.

TODO: what about Penlight-like API for file I/O (see e.g. pl.path, pl.dir, pl.file, pl.utils)?

Or maybe even porting a subset of Penlight and/or LFS?

Functions

directory(path) Creates a directory object that is used to get information about a directory

This function does not actually create a directory on the file system, it just creates an object that represents a directory.

remove(filename) Deletes a file from the card.
rename(filename) Renames/moves a file on the card (or between cards).
call(function[, arg]) Calls an eventproc (a function from the camera firmware which can be called by name).

Fields

clock Get the number of the seconds since camera startup.
ms_clock Get the number of milliseconds since camera startup.
prefix Get/Set the image filename prefix (e.g. "IMG_").
dcim_dir Get the DCIM directory.
config_dir Get the ML config directory.
ml_card Get the card ML was started from.
shooting_card Get the shooting card (the one selected in Canon menu for taking pictures / recording videos).
date Gets a table representing the current date/time.

Class date

date.sec Second
date.min Minute
date.hour Hour
date.day Day
date.month Month
date.year Year
date.wday Day of week
date.yday Day of year
date.isdst Daylight Savings

Class directory

directory:create() Creates a directory.
directory:children() Get a table (of directory objects) containing this directory's child directories.
directory:files() Get a table (of strings) that are the file names of this directory's files.
directory.path Get the full path of the directory.
directory.exists Get whether or not the directory exists.
directory.parent Get a directory object that represents the current directory's parent

Class card

card.cluster_size Get the cluster size of the filesystem.
card.drive_letter Get the drive letter (A or B).
card.file_number Get the current Canon file number (e.g.
card.folder_number Get the current Canon folder number (e.g.
card.free_space Get the current free space (in MiB).
card.type Get the type of card (SD or CF).


Functions

directory(path)
Creates a directory object that is used to get information about a directory

This function does not actually create a directory on the file system, it just creates an object that represents a directory. To actually create the directory in the file system call directory:create().

Parameters:

Returns:

    directory

Usage:

     local mydir = dryos.directory("mydir")
     if mydir.exists == false then
        mydir:create()
     end
     for i,v in ipairs(mydir:files()) do
        print("filename: "..v)
     end
remove(filename)
Deletes a file from the card.

Parameters:

Returns:

    bool success
rename(filename)
Renames/moves a file on the card (or between cards).

Parameters:

Returns:

    bool success
call(function[, arg])
Calls an eventproc (a function from the camera firmware which can be called by name). See Eventprocs.

Dangerous - you need to compile Lua yourself in order to enable it.

Parameters:

  • function string the name of the function to call
  • arg argument to pass to the call (optional)

Fields

clock
Get the number of the seconds since camera startup.
  • clock int
ms_clock
Get the number of milliseconds since camera startup.
  • ms_clock int
prefix
Get/Set the image filename prefix (e.g. "IMG_").
dcim_dir
Get the DCIM directory.
config_dir
Get the ML config directory.
ml_card
Get the card ML was started from.
shooting_card
Get the shooting card (the one selected in Canon menu for taking pictures / recording videos).
  • shooting_card card
date
Gets a table representing the current date/time.

Class date

Represents a date/time
date.sec
Second
  • sec int
date.min
Minute
  • min int
date.hour
Hour
  • hour int
date.day
Day
  • day int
date.month
Month
  • month int
date.year
Year
  • year int
date.wday
Day of week
  • wday int
date.yday
Day of year
  • yday int
date.isdst
Daylight Savings
  • isdst bool

Class directory

Represents a directory
directory:create()
Creates a directory.

Returns:

    bool whether or not the directory was sucessfully created
directory:children()
Get a table (of directory objects) containing this directory's child directories.

Returns:

    {directory,...}
directory:files()
Get a table (of strings) that are the file names of this directory's files.

Returns:

    {string,...}
directory.path
Get the full path of the directory.
directory.exists
Get whether or not the directory exists.
  • exists bool
directory.parent
Get a directory object that represents the current directory's parent

Class card

Represents a card (storage media). Inherits from directory
card.cluster_size
Get the cluster size of the filesystem.
  • cluster_size int
card.drive_letter
Get the drive letter (A or B).
card.file_number
Get the current Canon file number (e.g. IMG_1234.CR2 -> 1234).
  • file_number int
card.folder_number
Get the current Canon folder number (e.g. DCIM/101CANON => 101).
  • folder_number int
card.free_space
Get the current free space (in MiB).

FIXME: does not update after writing files from ML code.

  • free_space int
card.type
Get the type of card (SD or CF).
generated by LDoc 1.4.3 Last updated 2017-03-26 09:33:46