z_dropbox (zotonic_core v1.0.0-rc.17)
Simple drop folder handler, monitors a directory and signals new files.
Flow: 1. a user uploads/moves a file to the drop folder directory 2. Drop folder handler sees the file, moves it so a safe place, and notifies the file handler of it existance.
Summary
Functions
Convert process state when code is changed
Directory used by dropbox to scan for new files. Drop a files here to let the dropbox pick it up.
After a file is processed a module can move it to the handled directory.
Directory used by dropbox to contain files to be processed.
If a file could not be process it is moved to the unhandled directory.
Trap unknown calls
Scan the drop folder, broadcast found files.
Handling all non call/cast messages
Initiates the server. Options are: dropbox_dir, processing_dir, unhandled_dir, interval, max_age and min_age
Perform a scan of the drop folder, periodically called by a timer and by mod_admin after a file has been uploaded to the dropbox.
Starts the drop folder server
This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.
Functions
Convert process state when code is changed
Directory used by dropbox to scan for new files. Drop a files here to let the dropbox pick it up.
After a file is processed a module can move it to the handled directory.
Directory used by dropbox to contain files to be processed.
If a file could not be process it is moved to the unhandled directory.
Trap unknown calls
-spec handle_cast(term(), term()) -> {noreply, term()} | {noreply, term(), timeout() | hibernate} | {stop, term(), term()}.
Scan the drop folder, broadcast found files.
-spec handle_info(term(), term()) -> {noreply, term()} | {noreply, term(), timeout() | hibernate} | {stop, term(), term()}.
Handling all non call/cast messages
Initiates the server. Options are: dropbox_dir, processing_dir, unhandled_dir, interval, max_age and min_age
-spec scan(Context) -> ok when Context :: z:context().
Perform a scan of the drop folder, periodically called by a timer and by mod_admin after a file has been uploaded to the dropbox.
Starts the drop folder server
This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.