[Encore] Modified $recorder to show date and time in listings

Lennie Irvin llirvin at gmail.com
Tue Sep 4 05:22:24 MDT 2007


This looks great Kevin. I'll have to give it a go in TTU MOO.  Thanks!

Lennie

On 9/3/07, Kevin Jepson <kevijeps at telusplanet.net> wrote:
>
>  Good Afternoon
> I hope everyone is enjoying their Labour Day weekend :-)
> The following code is a quick modification to the $recorder object in an
> enCore V4 moo that shows the date and time when a recording was made.  It
> makes use of the .date property on the note objects that the recorder uses.
> The changes are mostly in the display verbs :tell_contents and :_html plus
> one line in the :start_recorder verb to record the time on the .date
> property.
> In case this email doesn't format in a useable way I have posted the code
> at the Barn so you can download it from here:
> http://www.encore-consortium.org/Barn/news.html
> I make no claims for elegance or efficiency here (or lack of errors for
> that matter) and it seems to work but...
>  caveat emptor. :-)
> Enjoy
> Ciao
> KJ
> =============
> Modified verbs for the $recorder to display date and time recording was
> started.
> Always make sure you have a backup before making changes to base objects
> like this.
> --------------------------------------------
> $recorder:start_recorder
>
> "Routine that assigns a note to a recorder and turns the recorder on";
> "Added record of the start date for each note in log.date";
> "Used to list date and time in record listing. KRJ Sept 2, 2007";
> if (caller != this)
>   return E_PERM;
> endif
> log = this:create_note();
> if (log != $nothing)
>   string = ">> A red light on the " + this.name + " flashes to indicate
> that it has been turned on and is now recording everything that is being
> said in " + this.location.name + " <<";
>   this.location:announce_all(string);
>   this.log = log;
>   this.recording = 1;
>   this.log.text = {@this.log.text <%7B at this.log.text>, "-- Start log: " +
> $time_utils:time_sub("$D, $N $t, $Y $o:$M:$S $p ") + $network.MOO_name + "
> time --"};
>   this.log.text = {@this.log.text <%7B at this.log.text>, ""};
>   "record the time this recording started in the note's .date property";
>   this.log.date = time();
> else
>   player:tell(">>> RECORDER NOT STARTED <<<");
> endif
> ------------------------------------------------
> $recorder:tell_contents
>
> "Fixed spelling of Length :-)";
> "Added listing of recording date and time. KRJ Sept 2,2007";
> if (this.contents)
>   su = $string_utils;
>   n = 0;
>   channel = this;
>   player:tell("Contents:");
>   player:tell("--- Title ---------------------- Length ---- Owner
> ---------- Date --- Time --");
>   for thing in (channel.contents)
>     $command_utils:suspend_if_needed(0);
>     n = n + 1;
>     timecode = thing.date;
>     if (thing.date)
>       timestring = $time_utils:time_sub("$2/$3/$y $H:$M$P", timecode);
>     else
>       timestring = "";
>     endif
>     size = tostr(length(thing.text));
>     size = size + " lines";
>     if (length(thing.name) > 30)
>       title = thing.name[1..29];
>       title = title;
>     else
>       title = thing.name;
>     endif
>     if (length(thing.owner.name) > 18)
>       owner = thing.owner.name[1..17];
>     else
>       owner = thing.owner.name;
>     endif
>     player:tell(su:left(n, 4), su:left(title, 29), su:left(size, 12),
> su:left(owner, 17), su:right(timestring, 15));
>   endfor
>
> player:tell("------------------------------------------------------------------------------");
> endif
> ------------------------------------------------
> $recorder:_html
>
> "===========================================================";
> "Copyright (C) 1995-2004, Jan Rune Holmevik and Mark Blanchard";
> "Modified to include Date and Time of each recording, KRJ Sept 2,2007";
> "===========================================================";
> html = pass(@args);
> user = args[1];
> contents = {};
> if (this.contents)
>   titles = this.contents;
>   titletxt = {};
>   lengths = {};
>   owners = {};
>   for n in (titles)
>     lengths = {@lengths <%7B at lengths>, tostr(length(n.text), " lines")};
>     owners = {@owners <%7B at owners>, n.owner.name};
>     timecode = n.date;
>     if (n.date)
>       timestring = $time_utils:time_sub("$2/$3/$y $H:$M$P", timecode);
>     else
>       timestring = "";
>     endif
>     titletxt = {@titletxt <%7B at titletxt>, timestring};
>   endfor
>   titles = $encore_web_utils:generate_links(user, titles);
>   titles = {$encore_web_utils:div("Title", "header"), @titles};
>   lengths = {$encore_web_utils:div("Length", "header"), @lengths};
>   owners = {$encore_web_utils:div("Owner", "header"), @owners};
>   titletxt = {$encore_web_utils:div("Recorded", "header"), @titletxt};
>   titles = $encore_web_utils:insert_line_breaks(titles);
>   lengths = $encore_web_utils:insert_line_breaks(lengths);
>   owners = $encore_web_utils:insert_line_breaks(owners);
>   titletxt = $encore_web_utils:insert_line_breaks(titletxt);
>   contents = $encore_web_utils:generate_table(user, {titles, lengths,
> owners, titletxt}, this, "1");
> endif
> html = $list_utils:append(html, contents);
> return html;
> ------------------------------------------------
>
>
>
> =======================================================
> Kevin Jepson R.E.T.
> President
> 4K Consulting Inc.
> An't nanum hearm deth, doth hwaet ye willath.
>
> PHONE: (403) 875-8372
> Email: 4Kconsulting at gmail.com
>             kevijeps at telusplanet.net
> =======================================================
>
>
> _______________________________________________
> Encore mailing list
> Encore at encore-consortium.org
> http://encore-consortium.org/mailman/listinfo/encore_encore-consortium.org
>
>


-- 
Lennie Irvin
Assistant Professor, Dept. of English
San Antonio College
PhD student in Tech Comm and Rhetoric, Texas Tech Univ.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://encore-consortium.org/pipermail/encore_encore-consortium.org/attachments/20070904/4611e955/attachment-0001.html 


More information about the Encore mailing list