Motion - Extend Replace Conversion Specifiers Discussion

Extend and Replace Conversion Specifiers Discussion

Note: The original proposal is now implemented in Motion 3.2.1. This topic is now used to track new specifiers before they are released and go onto the real Motion Guide

Proposal

Todays advanced text feature is based on the C strftime() function. By replacing some redundant specifiers by motion variables we can use this feature for many smart ideas.

Table below shows the idea.

The table below shows all the supported Conversion Specifiers you can use in the options text_left, text_right, snapshot_filename, jpeg_filename, ffmpeg_filename, and timelapse_filename.

Same should also be used on all onxxxx options.

In text_left and text_right you can additionally use '\n' for new line.

This is the list of variables that we would like conversion specifiers for.

  • diffs: number of pixels detected as motion pixels
  • noise level
  • labels: number of labeled areas
  • locate center X and Y
  • locate size X and Y
  • parameter given to onxxxx function. Normally a filename. Returns nothing if used to specify a filename.
  • "SETUP MODE" if setup mode enabled
  • thread number

Conversion Specifier Description Before Description After
%a The abbreviated weekday name according to the current locale. Keep as is
%A The full weekday name according to the current locale. Keep as is
%b The abbreviated month name according to the current locale. Keep as is
%B The full month name according to the current locale. Keep as is
%c The preferred date and time representation for the current locale. Camera name from the config section label [camera name] which will be introduced in Motion 4
%C The century number (year/100) as a 2-digit integer. New text_event feature in 3.2.4
%d The day of the month as a decimal number (range 01 to 31). Keep as is
%D Equivalent to %m/%d/%y. (Yecch - for Americans only. Americans should note that in other countries %d/%m/%y is rather common. This means that in international context this format is ambiguous and should not be used.) diffs (number of pixels detected as motion)
%e Like %d, the day of the month as a decimal number, but a leading zero is replaced by a space. Replacement Candidate
%E Modifier: use alternative format, see below. Keep as is
%f - filename will be in 3.2.4
%F Equivalent to %Y-%m-%d (the ISO 8601 date format). Keep as is
%g Like %G, but without century, i.e., with a 2-digit year (00-99). Replacement candidate
%G The ISO 8601 year with century as a decimal number. The 4-digit year corresponding to the ISO week number (see %V). This has the same format and value as %y, except that if the ISO week number belongs to the previous or next year, that year is used instead. Replacement candidate
%h Equivalent to %b. Replacement candidate
%H The hour as a decimal number using a 24-hour clock (range 00 to 23). Keep as is
%i - Width of the rectangle containing the motion pixels (same as locate)
%I The hour as a decimal number using a 12-hour clock (range 01 to 12). Keep as is
%j The day of the year as a decimal number (range 001 to 366). Keep as is
%J - Height of the rectangle containing the motion pixels (same as locate)
%k The hour (24-hour clock) as a decimal number (range 0 to 23); single digits are preceded by a blank. (See also %H.) Keep as is
%K - X Center coordinate of motion in pixels as 4 digits with leading zero.
%l The hour (12-hour clock) as a decimal number (range 1 to 12); single digits are preceded by a blank. (See also %I.) Keep as is
%L - Y Center coordinate of motion in pixels as 4 digits with leading zero.
%m The month as a decimal number (range 01 to 12). Keep as is
%M The minute as a decimal number (range 00 to 59). Keep as is
%n A newline character. Does not work as such! filetype used in SQL will be in 3.2.4
%N - Noise level
%o - threshold added in 3.2.2
%O Modifier: use alternative format Keep as is
%p Either 'AM' or 'PM' according to the given time value, or the corresponding strings for the current locale. Noon is treated as `pm' and midnight as `am'. Keep as is
%P Like %p but in lowercase: `am' or `pm' or a corresponding string for the current locale. Keep as is
%q Picture frame number within current second. For jpeg filenames this should always be included in the filename if you save more then 1 picture per second to ensure unique filenames. It is not needed in filenames for mpegs. Keep as is
%Q - labels added in 3.2.2
%r The time in a.m. or p.m. notation. Replacement candidate
%R The time in 24-hour notation (%H:%M). Replacement candidate
%s The number of seconds since the Epoch, i.e., since 1970-01-01 00:00:00 UTC. Replacement candidate
%S The second as a decimal number (range 00 to 61). Keep as is
%t A tab character. thread number will be in 3.2.4
%T The time in 24-hour notation (%H:%M:%S). Keep as is
%u The day of the week as a decimal, range 1 to 7, Monday being 1. See also %w. Replacement candidate
%U The week number of the current year as a decimal number, range 00 to 53, starting with the first Sunday as the first day of week 01. See also %V and %W. Keep as is
%v Event number. An event is a series of motion detections happening with less than 'gap' seconds between them. Keep as is
%V The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. See also %U and %W. Keep as is
%w The day of the week as a decimal, range 0 to 6, Sunday being 0. See also %u. Replacement candidate
%W The week number of the current year as a decimal number, range 00 to 53, starting with the first Monday as the first day of week 01. Keep as is
%x The preferred date representation for the current locale without the time. Replacement candidate
%X The preferred time representation for the current locale without the date. Replacement candidate
%y The year as a decimal number without a century (range 00 to 99). Keep as is
%Y The year as a decimal number including the century. Keep as is
%z The time-zone as hour offset from GMT. Keep as is
%Z The time zone or name or abbreviation. Keep as is
\n New line Keep as is

-- KennethLavrsen - 28 Mar 2005


"%m/%d/%y. (Yecch - for Americans only." Hey! I resemble that remark, lol. Seriously though, I agree. I prefer ISO format (YYYY-MM-DD). It can be confusing when you see 10/09/04... is it October 09, 2004 or 10 September, 2004?

-- AndrewHamilton - 30 Mar 2005

I cannot take the honour for the "yecch" remark. It is a copy paste from "man strftime".

Seen in the context of the proposal, the poor Americans and their confusing date format is still possible simply by using %m/%d/%y and that is why it is a "Replace me!" candidate. I also laughed when I read the strftime man page the first time and somehow I did not feel a need to remove it when I used it for the Motion Guide.

-- KennethLavrsen - 31 Mar 2005
Topic revision: r15 - 29 Oct 2005, KennethLavrsen
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.