blob: f05ccf49018a8ea2512e88a6f65c23084f7279a5 [file] [log] [blame]
smugfs \- file system access to SmugMug photo sharing
.B smugfs
.B -k
.I keypattern
.B -m
.I mtpt
.B -s
.I srvname
.I Smugfs
is a user-level file system that provides access to images
stored on the SmugMug photo sharing service.
It logs in after
obtaining a password from
.IR factotum (4)
.I keypattern
(if any)
as key criteria
.IR auth (3)).
.I smugfs
serves a virtual directory tree mounted at
.I mtpt
.BR /n/smug )
and posted at
.I srvname ,
if the
.B -s
option is given.
The directory tree is arranged in five levels:
root, user, category, album, and image.
For example,
.B /n/smug/cmac/
is a user directory,
.B /n/smug/cmac/People/
is a category directory,
.B /n/smug/cmac/People/Friends/
is an album directory,
.B /n/smug/cmac/albums/Friends/2631/
is an image directory.
SmugMug allows fine-grained classification
via subcategories, but subcategories are not yet implemented.
Subcategories are inserted as
an additional directory level between category
and album.
[Subcategories are not yet implemented.]
All directories contain a special control file named
.BR ctl ;
text commands written to
.B ctl
.IR smugfs 's
behavior or implement functionality
that does not fit nicely into the file system
.I Smugfs
caches information about users, categories, albums,
and images. If changes are made outside of
.I smugfs
(for example, using a web browser),
the cache may need to be discarded.
Writing the string
.B sync
to a directory's
.B ctl
file causes
.I smugfs
to discard all cached information used to
present that directory and its children.
Thus, writing
.B sync
to the root
.B ctl
file discards all of
.I smugfs 's
cached information.
.SS "Root directory"
The root directory contains directories
named after users.
By default, it contains only a directory for
the logged-in user, but other directories will
be created as needed to satisfy directory lookups.
In addition to user directories, the root directory
contains three special files:
.BR ctl ,
.BR rpclog ,
.BR uploads .
.B rpclog
returns a list of recent RPCs issued to the SmugMug API server.
Reads at the end of the file block until a new RPC is issued.
.B uploads
file lists the file upload queue (q.v.).
.SS "User directories"
User directories contain category directories
named after the categories.
SmugMug pre-defines a variety of categories,
so it is common to have many categories that
do not contain albums.
In a user directory, creating a new directory
creates a new category on SmugMug.
Similarly, renaming or removing a category
directory renames or removes the category on SmugMug.
Categories cannot be removed if they contain albums.
User directories also contain a directory
.B albums
that itself contains all of that user's albums.
.SS "Category directories"
Each category directory contains album directories
named using the album's title.
In a category directory, creating a new directory
creates a new album on SmugMug.
Similarly, renaming or removing an album directory
renames or removes the album on SmugMug.
Albums cannot be removed if they contain images.
Category directories might also contain subcategory directories.
Like albums, subcategories can be renamed and removed (when empty).
Unlike albums, subcategories cannot be created via ordinary
file system operations.
Instead, write the command
.B subcategory
.I name
to the category's
.B ctl
Subcategories are identical to categories
except that they cannot themselves contain subcategories.
.SS "Album directories"
Each album directory contains image directories
named using the image's decimal SmugMug ID.
Image directories cannot be created or renamed,
but they can be removed. Removing an image directory
removes the image from the album on SmugMug.
Album directories also contain three special files,
.BR ctl ,
.BR settings ,
.BR url .
.B settings
file contains the album settings in textual form,
one setting per line.
Each line represents a single setting and is formatted
as an alphabetic setting name followed by a single tab
followed by the value.
Many settings can be changed by writing new setting lines,
in the same format, to the
.B settings
Copying a file into the album directory queues it for
uploading to SmugMug to be added to the album.
Files disappear from the album directory once they
have finished uploading, replaced by new image directories.
.B uploads
file in the root directory lists all pending uploads,
which are stored temporarily
.BR /var/tmp .
.SS "Image directories"
Each image directory contains an image file, named
with its original name, if available.
If the image belongs to another user, SmugMug does not
expose the original name, so the file is named
.RB \fInnnn\fP .jpg ,
.I nnnn
is the SmugMug image ID number.
The file content is the original image
or else the largest image available.
The directory contains a
.B settings
file holding per-image settings, similar to the
file in the album directory;
and a
.B url
file, containing URLs to the various sized images
on the SmugMug server.
.I smugfs
.BR /n/smug ;
the current user must have write access to
.B /n/smug
.BR /dev/fuse .
% smugfs
Watch API calls as they execute:
% cat /n/smug/rpclog &
Create a new album in the Vacation category
and fill it with photos:
% mkdir /n/smug/you/Vacation/Summer
% cp *.jpg /n/smug/you/Vacation/Summer
The photos are now uploading in the background.
Wait for the uploads to finish:
% while(test -s /n/smug/uploads) sleep 60
Make the album publicly viewable and share it.
% echo public 1 >/n/smug/you/Vacation/Summer/settings
% cat /n/smug/you/Vacation/Summer/url | mail friends
.B \*9/src/cmd/smugfs
If multiple categories or albums have the same name,
only one will be accessible via the file system interface.
Renaming the accessible one via
.IR mv (1)
will resolve the problem.
Boolean values appear as
.B true
.B false
in settings files but must be changed using
.B 1
.BR 0 .