aiContact for Broadcasting

Purpose

Using aiContact to control the automatic uploading and presentation of content to the web as podcasts.

Steps

  1. Program Producer uploads mp3 file to the local server.
    1. The name of the file IS important and is of the format:[name][date].mp3
    2. No spaces and date is fo the format [yy-mm-dd] with leading zeros as needed.
  2. The directory structure on the local server is:
    1. [ROOTDIR] this is predetermined by aiContact.
    2. In [ROOTDIR] there will generally be no MP3 files, rather sub directories. [Names with no spaces]
    3. Inside these sub directories there can be MP3 files and sub directories, Ad infinitum.
  3. The local Server, via aiContact cron job, checks this directory (structure) every 15 minutes.
  4. When a new MP3 file is found it is uploaded (rsync) to the podcasting server.
    1. The programs take the following form: nameyy-mm-dd.mp3
    2. No spaces and the name can be as many letters as you like
    3. The Directory Structure can take any form but relates to the final name as follows:
      1. Samoa_News/December_2010 (we are separating by month)
      2. Samoa_News (no date separation)
      3. Heath Care/PHO
      4. Health Care/Dental (Parent program with sub programs)
      5. in aiContact there is a file called broadcast.cfg, this hold information about who is the administrator and their email address for final fall back of errors emails.
      6. Each directory represents a broadcast and a spereate article in Joomla.
      7. Each directory will have a record in the aiContact database as a means of allowing the automatic updates to happen.
      8. See NOTE 1 for how this happens.
  5. New program found
  6. Entry record made in aiContact using the directory structure and program name to confirm that validity of the program. If the program name does not relate to a known structure an error message is sent to the program directory owner.
  7. Once a valid program entry is made in aiContact a file is created in the directory in the form of nameyyyymmdd.cfg.
  8. The first piece of information in this file is the date of creation.
  9. The second piece of information is the time the rsync is first attempted
  10. The third piece of information is the time the rsync completed (or failed)
  11. When completed successfully an email is sent to the program owner
  12. If there has not been a successful completion in 4 hours an email is sent to the program owner
  13. Once a good upload is confirmed the web page needs to be generated.
    1. There needs to already exist on the Joomla site a page for this podcast
    2. Eveything up to the first table will be reproduced
    3. Everything else is automatically generated.
    4. The first table is used as the template.
    5. The first row of this table is set as the header
    6. As many tables are created as the number of weeks this page should show podcasts for.
    7. Generally the first colum is the name of the day of the week
    8. The second column is the date in format dd-mm-yyyy
    9. The third column is the actual podcast that can be clicked on and played
  14. NOTE 1: information stored in aiContact for creation of automatic web pages.
    1. Administrator Email: who gets error emails
    2. Producer Email: who gets info emails
    3. Publish Period: how may weeks to have on the podcast article
    4. Archive Period: how many weeks to store before deletion
    5. directory: where this MP3 came from and will go to, is a "dir path"
    6. Joomla Page ID: a number which is the ID for the article, this is how we will know what article to edit
    7. Joomla Page Position: how big is the table, what are the columns
    8. JoomlaDays: gives the days to have a podcast for and also gives the number of rows in the table. The formats fo this are: ftwtm, mtwtf, smtwtfs.
    9. Joomla Audio: this is the "1pixeloutplayer" code string, it already has the path to the MP3 file in the following format: /mp3/Talafou/tf[DATE].mp3, where [DATE] translates to what we have previously used yy-mm-dd
  15. This sould happen on the same server as the upload went to, but not totally necessary.

Setting up a Broadcast

  1. A broadcast has a name: Samoa_News
  2. This name must be the same as the directory name in the root directory of the server podcast directory.
  3. This is done for each program

Rsync Transferes

A very useful page to actions this: http://troy.jdmz.net/rsync/index.html
  1. We will be using ssl in our rsync broadcasts.
  2. We will assume that the user already exists on the RX server
  3. We need to create the .ssh keys
  4. On the server that will be SENDING the files
    1. Create the .ssh dir in the correct user: 
    2. mkdir /home/a_user/.ssh
    3. Create the key
    4. ssh-keygen t dsa -b 1024  -f /home/a_user/.ssh/sender-rsync-key
    5. I also want to try this to see if it will work ssh-keygen t dsa -b 1024  -f /home/a_user/.ssh/sender-rsync-key -N ''
    6. /home/a_user/.ssh now has two files: sender-rsync-key.pub and sender-rsync-key with an owner of root.
    7. We need to change these to:
      1. chmod 600 /home/a_user/.ssh/sender-rsync-key
      2. chmod 644 /home/a_user/.ssh/sender-rsync-key.pub
      3. chmod 700 /home/a_user/.ssh
      4. chmod 755 /home/a_user
    8. On the RECEIVING server we need a file called authorised_keys in the .ssh dir of the user we will be sending as
    9. /home/b_user/.ssh/authorised_keys
      1. Get the contents exactly of the file: /home/a_user/.ssh/sender-rsync-key from the Sending Server
      2. Put it in to as the contents of the file: /home/b_user/.ssh/authorised_keys on the Receiving Server
      3. Change the owner of these files and direcotry to the user
      4. chown -R b_user.b_user /home/a_user
      5. chmod 600 /home/b_user/.ssh/authorised_keys
      6. chmod 700 /home/b_user/.ssh
      7. chmod 711 /home/b_user

Let's Test

  1. rsync -avz /local/path/ -e "ssh -p 2022" a_user@remoteip:/full/path/to/files/
  2. This command unfortunitly asks to confirm if we want to login and then askes for the login password for the user.
  3. We want to go for a seemless transfer, having set up the keys as above we should be able to do this:
  4. rsync -avz /zone/public/news/ -e "ssh -p 2022 -i /home/a_user/.ssh/sender-rsync-key" b_user@remoteip:/home/b_user/public_html/mp3

Setting up mysql access (cPanel)

  1. Since the server hosting the podcast is running cPanel and Joomla, the following is hoe to make this port of the procedure automatic.
  2. Logon to cPanel as the web users
  3. Select the cPanel option of Remote MySQL
  4. Add the IP address of the server where the Podcast MP3s are coming from.