Using the import script
If you have a large number of files in your media library, importing these files one at a time into a broadcast automation system would be time-consuming and tedious. That's why Airtime includes a script that can import an entire directory of files in one go.
The airtime-import script automatically imports any metadata that is in the files' ID3 tags. If these tags are incorrect or are missing information, you will have to either edit the metadata before importing them, or suffer the consequences. For example, if the tags have creator or genre metadata missing, it will be impossible to search for, playlist or schedule the media according to these criteria.
The program Audio Tag Tool can be useful for batch setting and editing ID3 tags before importing files into your Airtime server. On an Ubuntu desktop machine, you can install Audio Tag Tool with the command:
$ sudo apt-get install tagtool
After installation, you can run the program with the command:
The Tag Multiple Files feature of the Audio Tag Tool program is a particularly useful time saver if you have a large archive of untagged files. Sometimes there is useful track or title information in the file name, which can be converted into an ID3 tag automatically.
Copying versus linking
You must specify one of two options for using the import script: Either to copy files into Airtime's storage server, or to link to files elsewhere. Each option has advantages and disadvantages, so you will have to think about how the files will be used in your station long-term.
- For files that are copied, you may run into problems with hard disk space if you do not remove files from the storage server periodically.
- For files that are linked, you must make sure that the files are actually going to be there at playout time, otherwise they will be skipped. For this reason, it is not recommended to use the link option for easily-removable storage (like MP3 players or USB memory sticks). There's a strong likelihood that the storage might be unplugged and taken away before playout time. It is also important to make sure that any external hard disk with linked files is powered on, and stays on.
The import script works from the command line, so you must first log into a console on the Airtime server. You need to specify the full file system path to the media files that you wish to import. Copying is specified by including the -c switch in the command:
$ sudo airtime-import -c /<path>/<to>/<your>/<files>
Linking is specified by using the -l switch instead:
$ sudo airtime-import -l /<path>/<to>/<your>/<files>
If the import is successful, the script will report the names of the files imported.
If you do not have write access to the filesystem, or the files are duplicates of files that have already been imported, the script will warn you with an error message.
Automated remote import over SFTP
The airtime-import script can be combined with the standard SFTP (secure FTP) program and cron daemon on a GNU/Linux server to enable automated file import from multiple remote desktop computers.
Traditional FTP servers use plain text passwords (without encryption) and are therefore not recommended for upload accounts on Airtime servers accessible from the public Internet. SFTP is a cross-platform protocol which works with many desktop programs including gFTP for GNU/Linux (http://www.gftp.org/), which can be installed on Debian or Ubuntu desktop computers with the command:
$ sudo apt-get install gftp
To enable SFTP uploads, first invoke the adduser command to create the uploads account on the server. For security reasons this user account is restricted to using SFTP only; it cannot be used for executing general commands in a login shell.
$ sudo adduser --home /srv/airtime/uploads --shell /usr/lib/sftp-server uploads
The server will then invite you to type in the password for the new uploads user, and again for confirmation. The security of your Airtime server depends on the strength of the password that you set, so be sure to use a long and complex password with upper case, lower case and numerical characters. It is not necessary to set a full name or other details for this account.
Adding user `uploads' ... Adding new group `uploads' (1003) ... Adding new user `uploads' (1002) with group `uploads' ... Creating home directory `/srv/airtime/uploads' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for uploads Enter the new value, or press ENTER for the default Full Name : Room Number : Work Phone : Home Phone : Other : Is the information correct? [Y/n] Y
Next, create a directory to contain the incoming files:
$ sudo mkdir /srv/airtime/uploads/incoming/
Then create a script to run once per hour:
$ sudo nano /etc/cron.hourly/airtime-upload
The script should import the newly uploaded files from the incoming directory specified, using the -c (copy) option, and then remove the original uploaded files. This step, rather than simply using the -l option to link the uploaded files, ensures that the uploads SFTP account does not have direct write access to the Airtime storage path. That would be a security risk if the password was compromised.
#!/bin/sh # Run the import script on fresh uploads airtime-import -c /srv/airtime/uploads/incoming/ # Clean the incoming directory to save disk space rm -r /srv/airtime/uploads/incoming/*.mp3 rm -r /srv/airtime/uploads/incoming/*.ogg
Finally, the script should be made executable so that the cron daemon can run it.
$ sudo chmod +x /etc/cron.hourly/airtime-upload
By default, Debian and Ubuntu GNU/Linux run cron.hourly tasks at 17 minutes past each hour. This value can be adjusted in the file /etc/crontab on the server, if required.
Remote users should connect to the Airtime server using their client software of choice, making sure that they specify an SFTP rather than FTP connection. The remote directory for the clients to use would be /srv/airtime/uploads/incoming/ as configured above.