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.

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, -p|--public

Usage examples:

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

htaccess -e writes public/play/.htaccess and public/rest/.htaccess, the two Ampache needs to stream and to serve the APIs.

-p adds public/.htaccess, which is optional hardening rather than a requirement: a user art redirect, blocking for private paths such as config/ and .git, and the commented-out bot filter.

./bin/installer htaccess -e -p

NOTE -p overwrites public/.htaccess, so back it up first if you edited it. See Rewrite Rules for what the file blocks.