Ampache includes a number of command line only tools that can be used to automate different aspects of your ampache install and perform write operations on your collection. All of the scripts included are PHP scripts and as such will require the command line PHP package.
You can automate the update of all, or some of your local catalogs by using the bin/catalog_update.inc file. By default this will run a full update (clean, verify and add) on all of your local catalogs.
You can optionally specify the name of the catalog and it will only update the specified catalog.
php bin/catalog_update.inc [catalog_name] [-c] [-v] [-a]
catalog_update.inc allows some additional arguments at execution time to allow only adds, verifies, or cleans instead of forcing a full verify every time. Optionally, you can also clean a single catalog instead of your entire database if you specify a catalog name.
-c - checks that all music in the database still exists on the filesystem and removes songs from the catalog(s) if it cannot find the file. -v - checks existing music for changes in metadata. -a - scans directory for new music not yet in the catalog(s).
catalog_name - when you specify the full name of a catalog, only that catalog will be maintained instead of the entire database.
Not specifying one of the above 3 arguments results in a full update being performed. If you've only added a small handful of albums to your database without modifying any existing one, using -a will reduce the catalog update time dramatically.
This should be used when you have directories or songs with permissions removed so apache2 cannot view them. This prevents them from showing up in your catalog. Executing bin/catalog_update.inc script as your user will add them to the catalog, but apache will not have permissions to access the files when a user tries to play it. Replace 'username' in the below line with the user that apache gets executed as.
sudo -u username php bin/catalog_update.inc
Below is a sample cron job that will execute as the apache2 user in Debian/Ubuntu every morning at 3:00 am.
00 03 * * * sudo -u www-data php /usr/share/ampache/bin/catalog_update.inc 2>&1 > /var/log/ampache/catalog_update.log
C:\xampp\php\php.exe c:\xampp\htdocs\ampache\bin\catalog_update.inc
If you installed xampp and ampache to default locations you can run this to update your catalog in Windows.
Add this line as a Scheduled Job to run whenever you set the trigger. Perhaps every morning at 5 AM.
using the bin/dump_album_art.inc file you can output all of the album art stored in ampache to the filesystem. It will output the image stored in the database to the directory of the first file in the album. This can cause problems f your files are not in their own directories. You can specify the filename to be written by modifying the config file options relating to album_art_preferred_filename. Ampache will by default output meta data directory files for linux, you can open the file and change it to “windows” if you are running windows.
If you would like to delete all of the disabled songs in Ampache you can run the bin/delete_disabled.inc to delete all of the songs that are disabled in Ampache. Naturally this requires the user you run the script as to have permissions to delete the files in question. By default this script will not work if you run it. You must open it and delete or comment out the line that says $debug=true for it to actually work.
You can have Ampache automatically rename and move all of your files based on the meta data in Ampache using the bin/sort_files.inc script. This requires write access to the files in question. The files will be renamed and moved based on their respective File and Folder patterns as defined by the catalog. Ampache will also by default sort your files into A-Z sub-folders to reduce the number of folders at the top level. You can turn this off by editing the file and setting the $alphabet_prefix to false, or commenting it out.