1 reserve_cnews
Dave Morriss edited this page 2024-06-04 16:48:09 +01:00

NAME

reserve_cnews - reserve Community News shows in the HPR database

VERSION

This documentation refers to reserve_cnews version 0.0.14

USAGE

./reserve_cnews [-help] [-from[=DATE]] [-count=COUNT]
    [-[no]dry-run] [-[no]silent] [-config=FILE] [-debug=N]

Examples:

    ./reserve_cnews -help
    ./reserve_cnews
    ./reserve_cnews -from=1-June-2014 -dry-run
    ./reserve_cnews -from=15-Aug-2015 -count=6
    ./reserve_cnews -from=2015-12-06 -count=1 -silent
    ./reserve_cnews -from -count=1
    ./reserve_cnews -from -count=2 -debug=4
    ./reserve_cnews -config=.hpr_livedb.cfg -from=1-March-2019 -dry-run

OPTIONS

  • -help

    Prints a brief help message describing the usage of the program, and then exits.

  • -from=DATE or -from

    This option defines the starting date from which reservations are to be created. The program ignores the day part, though it must be provided, and replaces it with the first day of the month.

    The date format should be DD-Mon-YYYY (e.g. 12-Jun-2014), DD-MM-YYYY (e.g. 12-06-2014) or YYYY-MM-DD (e.g. 2014-06-12).

    If this option is omitted the current date is used.

    If the DATE part is omitted the script will search the database for the reservation with the latest date and will use it as the starting point to generate -count=COUNT (or the default 12) reservations.

  • -count=COUNT

    This option defines the number of slots to reserve.

    If this option is omitted then 12 slots are reserved.

  • -[no]dry-run

    This option in the form -dry-run causes the program omit the step of adding reservations to the database. In the form -nodry-run or if omitted, the program will perform the update(s).

  • -[no]silent

    This option in the form -silent causes the program omit the reporting of what it has done. In the form -nosilent or if omitted, the program will report what it is doing.

  • -config=FILE

    This option defines a configuration file other than the default .hpr_db.cfg. The file must be formatted as described below in the section CONFIGURATION AND ENVIRONMENT.

  • -debug=N

    Sets the level of debugging. The default is 0: no debugging.

    Values are:

    1. Produces details of some of the built-in values used.
    2. Produces any output defined for lower levels as well as details of the values taken from the database for use when reserving the show(s).
    3. Produces any output defined for lower levels as well as:
      • .

        Details of how the `-from` date is being interpreted: default, computed from the database or explicit. The actual date being used is reported.

      • .

        Details of all dates chosen and their associated sho numbers using the algorithm "first Monday of the month".

      • .

        The show title chosen for each reservation is displayed as well as the summary.

DESCRIPTION

Hacker Public Radio produces a Community News show every month. The show is recorded on the Saturday before the first Monday of the month, and should be released as soon as possible afterwards.

This program reserves future slots in the database for upcoming shows. It computes the date of the first Monday of all of the months in the requested sequence then determines which show number matches that date. It writes rows into the reservations table containing the episode number, the host identifier ('HPR Admins') and the reason for the reservation.

It is possible that an HPR host has already requested the slot that this program determines it should reserve. When this happens the program increments the episode number and checks again, and repeats this process until a free slot is discovered.

It is also possible that a reservation has previously been made in the reservations table. When this case occurs the program ignores this particular reservation.

DIAGNOSTICS

  • Invalid date ...

    The date element of the -from=DATE option is not valid. See the description of this option for details of what formats are acceptable.

  • Various database messages

    The program can generate warning messages from the database.

  • Unable to find host '...' - cannot continue

    The script needs to find the id number relating to the host that will be used for Community News episodes. It does this by looking in the hosts table for the name "HPR Volunteers". If this cannot be found, perhaps because it has been changed, then the script cannot continue. The remedy is to change the variable $hostname to match the new name.

  • Unable to find series '...' - cannot continue

    The script needs to find the id number relating to the series that will be used for Community News episodes. It does this by looking in the miniseries table for the name "HPR Community News". If this cannot be found, perhaps because it has been changed, then the script cannot continue. The remedy is to change the variable $seriesname to match the new name.

CONFIGURATION AND ENVIRONMENT

The program obtains the credentials it requires for connecting to the HPR database by loading them from a configuration file. The file is called .hpr_db.cfg and should contain the following data:

<database>
    host = 127.0.0.1
    port = PORT
    name = DBNAME
    user = USER
    password = PASSWORD
</database>

DEPENDENCIES

Config::General
Data::Dumper
Date::Calc
Date::Parse
DBI
Getopt::Long
Pod::Usage

BUGS AND LIMITATIONS

There are no known bugs in this module. Please report problems to Dave Morriss (Dave.Morriss@gmail.com) Patches are welcome.

AUTHOR

Dave Morriss (Dave.Morriss@gmail.com)

LICENCE AND COPYRIGHT

Copyright (c) 2014 - 2023 Dave Morriss (Dave.Morriss@gmail.com). All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perldoc perlartistic.


Back to Community_News page