aiContact for Broadcasting
Purpose
Using aiContact to control the automatic uploading and presentation of content to the web as podcasts.
Steps
- Program Producer uploads mp3 file to the local server.
- The name of the file IS important and is of the format:[name][date].mp3
- No spaces and date is fo the format [yy-mm-dd] with leading zeros as needed.
- The directory structure on the local server is:
- [ROOTDIR] this is predetermined by aiContact.
- In [ROOTDIR] there will generally be no MP3 files, rather sub directories. [Names with no spaces]
- Inside these sub directories there can be MP3 files and sub directories, Ad infinitum.
- The local Server, via aiContact cron job, checks this directory (structure) every 15 minutes.
- When a new MP3 file is found it is uploaded (rsync) to the podcasting server.
- The programs take the following form: nameyy-mm-dd.mp3
- No spaces and the name can be as many letters as you like
- The Directory Structure can take any form but relates to the final name as follows:
- Samoa_News/December_2010 (we are separating by month)
- Samoa_News (no date separation)
- Heath Care/PHO
- Health Care/Dental (Parent program with sub programs)
- 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.
- Each directory represents a broadcast and a spereate article in Joomla.
- Each directory will have a record in the aiContact database as a means of allowing the automatic updates to happen.
- See NOTE 1 for how this happens.
- New program found
- 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.
- Once a valid program entry is made in aiContact a file is created in the directory in the form of nameyyyymmdd.cfg.
- The first piece of information in this file is the date of creation.
- The second piece of information is the time the rsync is first attempted
- The third piece of information is the time the rsync completed (or failed)
- When completed successfully an email is sent to the program owner
- If there has not been a successful completion in 4 hours an email is sent to the program owner
- Once a good upload is confirmed the web page needs to be generated.
- There needs to already exist on the Joomla site a page for this podcast
- Eveything up to the first table will be reproduced
- Everything else is automatically generated.
- The first table is used as the template.
- The first row of this table is set as the header
- As many tables are created as the number of weeks this page should show podcasts for.
- Generally the first colum is the name of the day of the week
- The second column is the date in format dd-mm-yyyy
- The third column is the actual podcast that can be clicked on and played
- NOTE 1: information stored in aiContact for creation of automatic web pages.
- Administrator Email: who gets error emails
- Producer Email: who gets info emails
- Publish Period: how may weeks to have on the podcast article
- Archive Period: how many weeks to store before deletion
- directory: where this MP3 came from and will go to, is a "dir path"
- Joomla Page ID: a number which is the ID for the article, this is how we will know what article to edit
- Joomla Page Position: how big is the table, what are the columns
- 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.
- 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
- This sould happen on the same server as the upload went to, but not totally necessary.
Setting up a Broadcast
- A broadcast has a name: Samoa_News
- This name must be the same as the directory name in the root directory of the server podcast directory.
- This is done for each program
Rsync Transferes
A very useful page to actions this: http://troy.jdmz.net/rsync/index.html- We will be using ssl in our rsync broadcasts.
- We will assume that the user already exists on the RX server
- We need to create the .ssh keys
- On the server that will be SENDING the files
- Create the .ssh dir in the correct user:
- mkdir /home/a_user/.ssh
- Create the key
- ssh-keygen t dsa -b 1024 -f /home/a_user/.ssh/sender-rsync-key
- 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 ''
- /home/a_user/.ssh now has two files: sender-rsync-key.pub and sender-rsync-key with an owner of root.
- We need to change these to:
- chmod 600 /home/a_user/.ssh/sender-rsync-key
- chmod 644 /home/a_user/.ssh/sender-rsync-key.pub
- chmod 700 /home/a_user/.ssh
- chmod 755 /home/a_user
- On the RECEIVING server we need a file called authorised_keys in the .ssh dir of the user we will be sending as
- /home/b_user/.ssh/authorised_keys
- Get the contents exactly of the file: /home/a_user/.ssh/sender-rsync-key from the Sending Server
- Put it in to as the contents of the file: /home/b_user/.ssh/authorised_keys on the Receiving Server
- Change the owner of these files and direcotry to the user
- chown -R b_user.b_user /home/a_user
- chmod 600 /home/b_user/.ssh/authorised_keys
- chmod 700 /home/b_user/.ssh
- chmod 711 /home/b_user
Let's Test
- rsync -avz /local/path/ -e "ssh -p 2022" a_user@remoteip:/full/path/to/files/
- This command unfortunitly asks to confirm if we want to login and then askes for the login password for the user.
- We want to go for a seemless transfer, having set up the keys as above we should be able to do this:
- 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)
- Since the server hosting the podcast is running cPanel and Joomla, the following is hoe to make this port of the procedure automatic.
- Logon to cPanel as the web users
- Select the cPanel option of Remote MySQL
- Add the IP address of the server where the Podcast MP3s are coming from.