pdr Configuration
pdr is configured in .pdrxrc
together with pdx.
General options
The file .pdrxrc can contain the following
general options:
verbose = true |
produce readable
messages to see what's going on, otherwise both programs will show
only error messages
|
interactive = true
|
start pdr always in interactive mode, not recommended
|
encoding = UTF-8 |
tells pdr the encoding of the
console where pdr runs, this encoding is also used if we don't
have any better specification. This option is responsible for
handling text correctly (for instance comments, especially text
with german umlauts) in all inputs and outputs. On a modern system
you will use UTF-8 or
ISO-8859-1, depending
on what your shell is using. pdr allows ASCII, UTF-8, UTF-16, ISO-8859-1, ISO-8859-15, Windows1252, ASCII/CP437 and ASCII/CP850.
|
Database options
Here we define everything related to the
database.
SQLite
database.type =
sqlite
database.connect =
~/local/share/my_data.db
The first line defines the database to be a SQLite database. The second
line contains the complete connection string to the database. In the
case of SQLite this is just the name of the database file. Because of
the applications are personal applications the database is intended to
be placed somewhere in the users home directory. The physical creation
of the database is not a task of pdr or pdx.
MySQL
database.type =
mysql
database.connect = user=my_db_user_name;password=my_db_user_password;db=my_db_name;compress=true;auto-reconnect=true
The first line defines the database to be a MySQL database. The second
line contains the complete connection string to the database containing
key-value-pairs (the keys are bold). There are two preconditions:
- The database must exist, this means it has to be created by a
database administrator. He also gives it a name which is unique at the
database server, in example pdrx. On servers used by several
users it would be wise to create several user specific databases
distinctable by name.
- The user (a user of the database server, not of the operating
system) must exist and must have the right to create, delete, select
and manipulate tables.
Specific options
The file .pdrxrc can contain the following pdr
specific settings:
inputs = e-mail-mailbox, file1, file2,
file3 |
This line defines
input identifiers for pdr, namely e-mail-mailbox, file1, file2 and file3, and the order in which
they are processed. |
If you want to
query the same data sources again and again it will be useful to
configure them in the configuration file.
Configuration of a POP3-mailbox
To configure a POP3-mailbox
(named e-mail-mailbox here)
you need the following settings:
e-mail-mailbox.type =
pop3
e-mail-mailbox.server =
pop.gmx.net
e-mail-mailbox.account =
MyAccount@gmx.net
e-mail-mailbox.password = MyPassword
e-mail-mailbox.subject = Q
e-mail-mailbox.keep =
yes
The first line defines that e-mail-mailbox is a POP3 mailbox. The next
three lines are self explaining. The fourth line names the e-mail
subject which is used by pdr to identify the relevant e-mails on the
server. Only mails containing this subject are processed, all others
will just be ignored. This way you don't have to allocate a special new
mailbox for pdr, you can use an existing one. Note: you must enter this subject in every
mail. If you send a lot of data mails you have to enter this very often.
You should use a short subject, one letter, but it has to be unique. The
last line determines whether a processed e-mail should be deleted or
not. The option accepts true, false, yes and no. In the case of true or yes the e-mail is not deleted on the
server. If you don't use this option processed mails will be deleted.
Configuration of an IMAP-mailbox
The configuration of an IMAP
mailbox is based on a POP3 mailbox but extends it by some IMAP specific
lines:
e-mail-mailbox.type
= imap
e-mail-mailbox.server =
mail.messagingengine.com
e-mail-mailbox.port =
143
e-mail-mailbox.account =
MyAccount@fastmail.fm
e-mail-mailbox.password = MyPassword
e-mail-mailbox.folder =
INBOX.pdr
e-mail-mailbox.subject = Z
e-mail-mailbox.keep = yes
e-mail-mailbox.expunge = false
The first line declares the identifier e-mail-mailbox as an IMAP mailbox.
server must be an IMAP
server, port is normally
143 (IMAP access). It is intended to allow SSL access here just by
specifying 993. account and
password speak for
themselves. folder extends
POP3 by concept: you can configure directories on an IMAP server which
are automatically filled up with incoming mails by server rules. It is
clever to use this to separate pdr mails from other incoming mails. The
top most folder on an IMAP server is normally called INBOX. subject is like on POP3. With
keep and expunge you can control what is to be
done with the mails after processing. If keep is yes or true processed mails are marked as read
and remain on the server. If keep is no or false they are marked as deleted but
remain also on the server. If in this case expunge is yes or true they will truely be deleted on the
server.
Configuration of a Twitter feed
The configuration of a Twitter
feed is more simple than the one of a mailbox:
my_twitter.type = twitter/rss
my_twitter.proxy = www.proxy.com:port
The first line declares the identifier my_twitter as a data source which is a
Twitter account. That's all, you don't need to configure more,
especially no concrete Twitter-user account, this is made elsewhere (see
here). The second line names a
HTTP-proxy if a proxy should be used.
Configuration of a text file
If you want to use a text file
for input you need the following configuration:
file1.type =
txt
file1.filename =
~/my_file.txt
file1.encoding = ISO-8859-1
file1.keep = true
The first line defines file1 to be a text file input. The
second line names the file, the third one the encoding of the file. If
you do not name an encoding here the default encoding from the general options will
be used. The last line determines whether a processed text file should
be deleted or not. The option accepts true, false, yes and no. In the case of true or yes the file is not deleted. If you
don't use this option processed files will be deleted.
filename allows the use of
wildcards (* and
?) to process a file with a
not completely known or frequently changing name or even an entire group
of files. The path must be complete but the file name can include
something like *.txt to
process all files of a directory at once.
Configuration of a CSV file
If you want to use a CSV file for
input you need the following configuration:
file2.type =
csv
file2.filename =
~/my_file.csv
file2.encoding =
ISO-8859-1
file2.ctrl_line = datetime, x, y, z
file2.keep =
false
The first line defines file2 to be a CSV file input. The
second line names the file, the third one the encoding of the file. If
you do not name an encoding here the default encoding from the general options will
be used. The option ctrl_line specifies if needed a control
line for the entire CSV file. Then the CSV file itself doesn't have to
contain a control line. The last line determines whether a processed CSV
file should be deleted or not. The option accepts true, false, yes and no. In the case of true or yes the file is not deleted. If you
don't use this option processed files will be deleted.
filename allows the use of
wildcards (* and
?) to process a file with a
not completely known or frequently changing name or even an entire group
of files. The path must be complete but the file name can include
something like *.csv to
process all files of a directory at once.
Configuration of a XML file
If you want to use a XML file for
input you need the following configuration:
file3.type =
xml
file3.filename =
~/my_file.xml
file3.keep = no
The first line defines file3 to be a XML file input. The
second line names the file. we don't need an encoding here, the XML file
has it's own encoding specification. The last line determines whether a
processed XML file should be deleted or not. The option accepts
true, false, yes and no. In the case of true or yes the file is not deleted. If you
don't use this option processed files will be deleted.
filename allows the use of
wildcards (* and
?) to process a file with a
not completely known or frequently changing name or even an entire group
of files. The path must be complete but the file name can include
something like *.xml to
process all files of a directory at once.