1190.bicyclesonthemoon.info

time after Time

This is the interface for viewing and ONGing time after Time stories. It consists of the following parts:

Previous versions

how to ONG?

If you want to make a time after Time story and have it ONGed from here contact me via PM or e-mail (bicyclesonthemoon @ chirping mustard). You'll get an username and password. Then you can get access via SFTP to a directory where you can upload frames. In that directory there are also configuration files which you can use to change some things, like the ONG time, the alt text, etc. Together we determine what to put in those files.

configuration files explanation

The behavior of the viewer and the bots can be defined for each story by configuration files in the directory of a story:

settings

This is the file that defines settings for the whole story. The filename is settings. Each line contains one setting. The line format is:
name=value
The beginning of each line is the name of the option. The equal sign character is the separator. Everything after the separator is the the value of that setting. If one name appears in multiple lines the newer line replaces the older one.

ongstate

This is the file that stores the current state of an ongoing story. The filename is ongstate. First line contains 4 integers separated by a space:

To start a story change the state from 0 to 4. After story starts the values will be automatically modified by the system when needed.

ongtime

This is the file that stores the times whern each frame was uploaded to the viewer. The filename is ongtime. It consists of lines with the following format
nnnn YYYY-MM-DD hh:mm
where nnnn is the frame number, YYYY is the year, MM the month, DD the day, hh the hour and mm the minute. Example:
0001 2013-08-07 22:00
0002 2013-08-07 23:00
0003 2013-08-08 00:00
0004 2013-08-08 01:00
0005 2013-08-08 02:00
0006 2013-08-08 21:00
0007 2013-08-08 22:00
0008 2013-08-08 23:00

The bot will automatically generate new lines in this file after uploading frames to the viewer.

schedule

This is the file used to define the times to upload new frames to the viewer. It consists of lines which are unix timestamps

If a timestamp from the future is found it will be used instead of the value calculated from the ongtime setting. Timestamps from the past are ignored. The first found value will be used. Because of this the timestamps should be in ascending order

update

This is the file used to force an update of frames which are already available on the viewer. Each line is a number of a frame to update. Instead of a number a "c" character can be used to update the cfrt frame. After the bot successfully updates all the listed frames the file is automatically cleared.

ongbot and pleaseongbot

These store the login information for the bot that posts to the OTT. The filenames are set by the ongbot and pleaseongbot settings.

The files consist of 3 lines:

The bot name is used in the --posted by ... signature. The login and password are needed to log in to the forums and send the post. Because the files contain login information they are separated from the main settings file to allow using different file access permissions.

When a new frame is uploaded to the viewer the bot will check if the previous one was posted to the OTT. If it wasn't the bot will post it. The ongbot file is used for this. If the file does not exist the feature will be disabled.

In the viewer, for the most recent frame there is an [ONG this for me] link available. If clicked the bot will post the frame to the OTT after checking if it isn't already there. The pleaseongbot file is used for this. If the file doesn't exist the feature will be disabled.

special files for individual frames

There is a possibility to create files with settings that apply to just one specific frame. The filenames are determined by the special setting. The settings defined in this file will replace those set in the settings file. The file has the same format as the settings file with one exception. After the lines with names and values there can be one empty line. All next lines will be assumed to be part of the text setting. Example:
title=Take the wheelstick
frame=bsta-000229.png
BBHTML=[quote][color=#FF8800]KXA: Wasn't it heavier before?[/color][/quote]<br><br>Suddenly, you realise something.<br>
HTML=<div class="tq"><span class="ni">KXA: Wasn't it heavier before?</span></div><br><br>Suddenly, you realise something.<br>

[tq][ni]KXA: Wasn't it heavier before?[/ni][/tq]

Suddenly, you realise something.
This is kind of similar to a HTTP header.

These files will be read after the viewer determines which frame should be displayed. This requires checking if the frame is out of limits, if cfrt is defined and in case frame is not specified if first or last frame shoud be shown. All these checks are done using only the general settings. These are the first things the viewer does. As soon as this is done the special settings are loaded.

While all the settings can be overwritten with these files not all settings make sense in these files. Similarly not all settings make sense outside these files.

configuration settings explanation

These are the settings which are defined in the settings file and can be redefined for individual frames in the special files. Some of the values are used directly and some are used as the format string for the AWK sprintf function.

Not all settings have to be specified. Unspecified settings will take a default value which usually is 0 or an empty string.

sprintf

Some settings should have an individual value for each frame. These are not taken directly but are generated by the AWK sprintf function:
sprintf(setting,f)
where "setting" is the value of the setting taken from the file and "f" is the frame number. If the story uses subframes this will be used instead:
sprintf(setting,f,s)
where "s" is the subframe character.

It is OK to ignore the sprintf and use a static value. The sprintf function has no problem taking more arguments taken in the format string. This is OK:
sprintf("bftf-%04u",1)
This is also OK:
sprintf("bftf",1)
This is not OK:
sprintf("%04u: bftf-%04u",1)

If this sprintf mechanism is not enough to customize some setting for each frame in the desired way the special files can be used to overwrite the settings for individual frames

basic configuration

story

String.
The ID of the story. It should be identical to the ID used by the viewer (/aftertime/viewer?story=) and to the directory name on the server.

title

Sprintf format string.
The title displayed on top of the page, above the frame. Example: title=t-1_%04u

frame

Sprintf format string.
The filename of the frame. Example: frame=t-1_%04u.png

number

Sprintf format string.
The format of the frame numbers (on the links to next and previous frames). Example: number=%02x

width

Integer. The width in pixels of the frame. Used by the viewer to determine the width of the viewer table. If left unspecified the html table width will also be unspecified

border

Integer. The width in pixels of the border around the frame.

first

Integer.
Defines what is the number of the first frame.

last

Integer.
For not ongoing stories defines what is the number of the last frame.
For ongoing stories defines after which frame the bot should automatically finish the story. If left unspecified the bot will not automatically finish the story.

alt text (mouseover text)

Stories can have text appearing when moving the mouse cursor over the frame. Even if the text is not identical for all frames the number of different texts is usually much smaller than the number of all frames. Because of this a special mechanism was created.

[0-9]+

String.
The alt text change. The name defines the frame number after which the alt text changes. The value defines the alt text after change. For example:
1=Wait for it.
6=Don't wait for it.

means that for frames 1 to 5 the alt text will be "Wait for it." And for frames 6 and above it will be "Don't wait for it.".

alt

String.
Alt text replacement for current frame. It has priority over the normal alt text sequence. Should be used in the special file.

Sub-frame numbers (meteor frames)

In the Time story there were so called "meteor frames". In the mscha numbering system there are 5 frames between 2440 and 2441. This mechanism was made to support such frame numbers

sf-[0-9]+

Character.
Defines the number ID of the highest "meteor frame" for a frame number. For example sf-2440=e means that between frame 2440 and 2441 there will be 2440a, 2440b, 2440c, 2440d and 2440e.

[a-z]

String.
Alternative format of "meteor frame" number. For example
sf-353=a
a=½

means that after frame 353 there will be frame 353a but the "a" is replaced by "½" and because of this the frame number will be 353½. Of course, in the viewer URL it will still be ?story=t1i&f=353a. This was implemented especially to support the 353½ frame of t1i.

Enhancements / alternative frames

For some stories there is a possibility to see alternative / enhanced versions of some or all the frames. This mechanism is implemented to support such enhancements.

enhance

Integer.
The number of alternative versions. Not counting the original.

enhance-[0-9]+

String.
The name of the alternative version appearing in the selection under the frame. enhance-0 is the name of the original. Example:
enhance-0=original
enhance-1=blue
enhance-2=very blue
enhance-3=no fading

title-[0-9]+

Sprintf format string.
The same as title but for the alternative versions. Example:
title-1=blue t1i-%04u%s
title-2=very blue t1i-%04u%s
title-3=no fading t1i-%04u%s

frame-[0-9]+

Sprintf format string.
The same as frame but for the alternative versions. Example:
frame-1=bluet1i-%04u%s.png
frame-2=hyperblue-%04u%s.png
frame-3=nofading-%04u%s.png

inframe-[0-9]+

Sprintf format string.
The same as inframe but for the alternative versions. Example:
inframe-1=enhphys-%04u%s.png

match-[0-9]+

Sprintf format string.
The same as match but for the alternative versions. Example:
match-1=(\/(npb)?remapt-1_%04u\.png)|(_2F(npb)?remapt_2D1_5F%04u_2Epng)

Other viewers

Some stories come from other sources. It is possible to include a link to their original viewers

otherviewertext

String.
The text of the link to the other viewer. Example: otherviewertext=this frame in mscha's viewer

otherviewerurl

Sprintf format string.
The URL of the link to the other viewer. Example: otherviewerurl=http://xkcd.mscha.org/vieweraftertime/t-1_%04u

othervieweroffset

Integer.
Number to be added to the frame number before generating otherviewerurl in case the other viewer uses a different numbering system. For example frame 1 of t-1 can be accessed by https://xkcd.mscha.org/vieweraftertime/t-1_0001 or https://xkcd.mscha.org/vieweraftertime/1732.

ID

Integer
ID of the post on the OTT. (Usseful if the post was originally posted on the OTT, like in The Advent. If this value is defined and under the frame there is the post time displayed then the time text will be a hyperlink to a post on the OTT.

Special files

special

Sprintf format string.
Filename of the special file containing special settings for individual frames. Example: special=advent-%02u

Undertext

Some stories have a special text message under each frame. These settings were implemented to support stories like The Advent or BSTA. These settings should be defined in the special file.

text

Multi-line string.
The original text for the frame. If text has multiple lines it must be located in the special file below the header. Example:
[tq][ni]KXA: Wasn't it heavier before?[/ni][/tq]

Suddenly, you realise something.

HTML

String (HTML).
The text for the frame converted to HTML to be displayed under the frame. Line breaks should be replaced with <br> tags. It can be generated from the original BBcode text by the undertext_bb2html.awk script. Example:
HTML=<div class="tq"><span class="ni">KXA: Wasn't it heavier before?</span></div><br><br>Suddenly, you realise something.<br>

BBHTML

String (HTML).
The text for the frame converted to BBcode and encoded escaped as HTML to be displayed after expanding the [bbcode] link. Line breaks should be replaced with <br> tags. If this setting is not specified it is assumed that the original text is already in BBcode format and the vbiewer will automatically escape it. For BSTA it was generated by the ong-bsta.awk script. Example:
BBHTML=[quote][color=#FF8800]KXA: Wasn't it heavier before?[/color][/quote]<br><br>Suddenly, you realise something.<br>

Ongoing stories

ongoing

Integer.
Defines the type of the story. 3 possible values:

ongtime

Integer.
Time in hours between frames.

inframe

Sprintf format string.
The filename of the frame in the upload directory. This file will be copied by the bot to the viewer and will become frame. Example: frame=%04u.png

last

See last.

cfrt

String.
The filename of a special frame shown if someone tries to see a frame which wan not posted yet. If left undefined the last available frame will be shown instead. Example: cfrt=phys-cfrt.png

onlyframe

Integer.
If the value is greater than zero and the story is ongoing and the frame number is not specified then a minimal version of the viewer will be shown, with just the most recent frame and nothing else.

showlatest

Integer.
If the value is greater than zero and the story is ongoing and the frame number is not specified then the most recent frame will be shown (instead of the first frame).

Final replacement

There is an emergency mechanism. For an ongoing story posted locally from the server there is a possibility to define special frame which will be posted instead of the next frame in a situation where the new frames to upload are missing for a long time.

To use this feature both finalreplaceframe and finalreplacetime have to be defined.

finalreplaceframe

String.
The filename of the final replacement frame.

finalreplacetime

Integer.
Number of hours to wait before performing the final replacement.

Posting to the OTT

Subject

Sprintf format string.
Subject of the post sent to the OTT bny the bot. Example: subject=Re: 1190: Time for Physics – phys-%04u

ongbot

String.
filename of the ongbot file. If left undefined the default value "ongbot" will be used. If the file doesn't exist the bot will not automatically post the frames to the OTT.

pleaseongbot

String.
filename of the pleaseongbot file. If left undefined the default value "pleaseongbot" will be used. If the file doesn't exist the [ONG this for me] link will not be available.

match

Sprintf format string.
The regular expression used by the bot to find out if the latest frame was already posted to the OTT. Unlike other settings, this format string can have an unlimited number of format specifiers. All of them will use the frame number as the argument. Example:
match=(phys-%04u\.png)|(/aftertime/frame\?(([a-zA-Z&;0-9=]*story=phys[a-zA-Z&;0-9=]*f=0*%u)|([a-zA-Z&;0-9=]*f=0*%u[a-zA-Z&;0-9=]*story=phys)))

NewpixbOTTification

When bot sends a post to the OTT there is a possibility to use a newpixbOTTification - to post the frame with a drawing of a newpixbot holding the frame.

npbframe

Sprintf format string.
The filename of the newpixbottified frame. If left undefined the feature will not be used. Example npbframe=npbftf-%04u.png

npbprob

Real number with decimal point
Value should be between 0 and 1. It defines the probability of a newpixbottification appearing in the post sent to the OTT.

the source

The source is released under the AGPL 3 license.

It may require some explanation which is not provided yet. It uses paths specific to my server. All paths are defined on the beginning of the files.

The following files are available: 1190.bicyclesonthemoon.info