Skip to main content

Ampache CLI

Explaining the Ampache CLI

The Ampache bin folder has been cleaned up into a 2 files. bin/cli and bin/installer

Generally you should only be interested in the cli program; all the old scripts have been migrated into cli commands.

-h|--help can be used to display help for commands and cli itself.

For a full reference of every available command grouped by prefix, see Ampache CLI Commands.

Migrated actions

In general, simply updating the command should work as expected with 2 exceptions.

  • ./bin/install/add_user.inc => ./bin/cli admin:addUser
  • ./bin/install/install_db.inc => ./bin/installer
  • ./bin/install/update_db.inc => ./bin/cli admin:updateDatabase
  • ./bin/broadcast.inc => ./bin/cli run:broadcast
  • ./bin/calculate_art_size.inc => ./bin/cli run:calculateArtSize
  • ./bin/catalog_update.inc => ./bin/cli run:updateCatalog
  • ./bin/channel_run.inc => ./bin/cli run:channel
  • ./bin/clean_art_table.inc => ./bin/cli cleanup:art
  • ./bin/compute_cache.inc => ./bin/cli run:computeCache
  • ./bin/cron.inc => ./bin/cli run:cronProcess
  • ./bin/delete_disabled.inc => ./bin/cli cleanup:songs
  • ./bin/dump_album_art.inc => ./bin/cli export:albumArt
  • ./bin/fix_filenames.inc => ./bin/cli run:convertFilenames
  • ./bin/print_tags.inc => ./bin/cli print:tags
  • ./bin/sort_files.inc => ./bin/cli cleanup:sortSongs
  • ./bin/update_db.inc => ./bin/cli run:updateDb
  • ./bin/update_file.inc => ./bin/cli run:updateCatalogFile
  • ./bin/websocket_run.inc => ./bin/cli run:websocket
  • ./bin/write_playlists.inc => ./bin/cli export:playlist

Command changes

There are 2 files that have had switches change between versions.

When migrating catalog_update.inc and update_file.inc commands take note that if you used the shorthand switch -v it has changed to -e

So the Ampache 4 command:

./bin/catalog_update.inc music -cagv

Becomes:

./bin/cli run:updateCatalog music -cage

New CLI actions

There are some new features that were never part of Ampache 4.

export:databaseArt

If you have a large image table and would like to export your art, this command will export art to the local_metadata_dir from your config.

run:cacheProcess

Command to start Transcode Caching.

run:moveCatalogPath

When you have changed mount points you can update the database locations to match this new location.

Full command reference

This is the full list of ./bin/cli commands. Every command supports -h|--help for its own argument/option list. Arguments in <angle brackets> are required; arguments in [square brackets] are optional and may have a default value.

admin

CommandDescriptionArguments / Options
admin:addUserAdd a User<username>; -p|--password, -e|--email, -w|--website, -n|--name, -l|--level
admin:clearCacheClear a cache. Only perpetual_api_session persists; object caches live for one process[type] (perpetual_api_session, song, artist, album), default perpetual_api_session
admin:deleteUserDelete a User[username]; -u|--user (User ID)
admin:disableUserDisable a User[username]; -u|--user (User ID)
admin:enableUserEnable a User[username]; -u|--user (User ID)
admin:exportSchemaRegenerate the ampache.sql seed dump from this database-e|--execute (write the file), -f|--file (output file)
admin:installCatalogTypeInstall a catalog type<type> (local, remote, subsonic, beets, beetsremote, Seafile, dropbox)
admin:installLocalplayInstall a localplay controller<type> (mpd, upnp, httpq, ...); -u|--user (user to receive the localplay preferences, -1 = all)
admin:installPluginInstall a plugin<name>
admin:listModulesList plugins, catalog types and localplay controllersnone
admin:listUsersUsers List[username]; -a|--apikey, -u|--user
admin:mailUsersSend an e-mail to a group of users[group] (all, users, admins, inactive), default all; -s|--subject, -m|--message
admin:resetPreferencesReset preference values for users<username>; -e|--execute, -p|--preset (system, default, minimalist, community)
admin:uninstallCatalogTypeUninstall a catalog type<type>
admin:uninstallLocalplayUninstall a localplay controller<type>
admin:uninstallPluginUninstall a plugin<name>
admin:updateConfigFileUpdate the Ampache config file-e|--execute
admin:updateDatabaseUpdate the database to the latest version-e|--execute
admin:updatePluginsUpdate Plugins automatically-e|--execute
admin:updatePreferenceAccessLevelUpdate Preference Access Level-e|--execute, -l|--level (default, guest, user, content_manager, manager, admin)
admin:updateUserUpdate User[username]; -a|--apikey, -s|--streamtoken, -r|--rsstoken, -p|--subsonic, -l|--level
admin:upgradePluginUpgrade a plugin<name>

cleanup

CommandDescriptionArguments / Options
cleanup:artRemove art which does not fit to the settings-c|--cleanup (remove missing files from the database), -t|--thumbnails (delete all thumbnails), -x|--execute (disables dry-run)
cleanup:consolidateStatsConsolidate old play history into summary counts-c|--count-type (stream, skip, download), -e|--execute (disables dry-run)
cleanup:enableDisabledRe-enable all disabled songsnone
cleanup:restoreStatsRestore consolidated play history from the archive-e|--execute (disables dry-run)
cleanup:songsDelete disabled songs-d|--delete (disables dry-run)
cleanup:sortSongsSort songs files[catalogName]; -x|--execute (disables dry-run), -f|--files (rename in place instead of moving), -l|--limit, -w|--windows (replace Windows-incompatible characters), -n|--name (Various Artists name), -p|--path (sort a single file/folder)

export

CommandDescriptionArguments / Options
export:albumArtExport album art[type] (linux or windows), default linux
export:catalogExport catalog metadata to a file<file>, [format] (csv, itunes), default csv; -c|--catalog (Catalog ID, 0 = all)
export:databaseArtExport all database art to local_metadata_dir-c|--clear (clear the database image when the local file exists)
export:playlistExport Playlists<directory>, [type] (albums, artists, playlists, smartlists), default playlists, [extension] (m3u, xspf, pls), default m3u, [playlistId], default -1; -u|--user, -w|--web (return remote play URLs instead of the local file)

print

CommandDescriptionArguments / Options
print:duplicatesFind possible duplicate objects-t|--type (object type), default album
print:tagsPrint file tags<filename>

run

CommandDescriptionArguments / Options
run:addCatalogCreate a local media catalog[catalogName], [catalogPath], [mediaType] (music, video, podcast), default music, [filePattern], default %T - %t, [folderPattern], default %a/%A
run:broadcastRun a UPnP broadcastnone
run:cacheProcessRun the Transcode Caching processnone
run:calculateArtSizeRun art size calculation-f|--fix (fix database issues)
run:computeCacheUpdate the object cache tablesnone
run:convertFilenamesConvert filenames using a charset-f|--fire (fire-and-forget, disables the rename prompt), -c|--charset, default the output charset
run:cronProcessRun the cron processnone
run:deleteCatalogDelete a media catalog<catalogId>
run:disableCatalogDisable a media catalog<catalogId>
run:enableCatalogEnable a media catalog<catalogId>
run:moveCatalogPathChange a Catalog path, e.g. after moving a mount point[catalogName], [catalogType], default local, [path]
run:updateCatalogPerform catalog actions for all files of a catalog. If no options are given, -ceagt is assumed[catalogName], [catalogType], default local; -c|--cleanup, -a|--add, -g|--art, -e|--verify, -f|--find, -u|--update, -i|--import, -o|--optimize, -t|--garbage, -s|--scan, -l|--limit, -m|--memorylimit
run:updateCatalogFilePerform catalog actions for a single file<catalogName>, <filePath>; -c|--cleanup, -e|--verify, -a|--add, -g|--art, -m|--move, -r|--rename
run:updateCatalogFolderPerform catalog actions for a single folder<catalogName>, <folderPath>; -c|--cleanup, -e|--verify, -a|--add, -g|--art, -m|--move, -s|--scan
run:updateDbUpdate the database collation and charset-x|--execute (disables dry-run)
run:websocketRun a Websocket-p|--port, default 8100

show

CommandDescriptionArguments / Options
show:debugShow a system status and environment report-u|--check-updates (query the remote version, needs network access)
show:versionShow the current Ampache versionnone

bin/installer commands

./bin/installer is a separate, smaller binary used before Ampache has a working config/database — it does not share commands with ./bin/cli, so install and htaccess only exist here.

CommandDescriptionArguments / Options
installInstall the database (see Installation)-U|--dbuser, -P|--dbpassword, -H|--dbhost, -o|--dbport, -d|--dbname, -u|--ampachedbuser, -p|--ampachedbpassword, -w|--webpath, -f|--force
htaccessCreate .htaccess files-e|--execute

Usage examples:

./bin/installer install -U root -P mypassword -H localhost -d ampache -u ampache -p ampachepassword -w /ampache -f
./bin/installer htaccess -e