Skip to content

Instantly share code, notes, and snippets.

@eth-p
Last active March 2, 2020 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eth-p/427a78b7aca4416161d5b8d07d2a73c7 to your computer and use it in GitHub Desktop.
Save eth-p/427a78b7aca4416161d5b8d07d2a73c7 to your computer and use it in GitHub Desktop.
A script to rebrand "Google Play Music Desktop Player" to "YouTube Music"

gpmdp-to-ydp

This is a simple shell script that rebrands Google Play Music Desktop Player to "YouTube Music".

The following changes are made:

  • The application is renamed.
  • The application name is changed.
  • The application icon is changed.

Usage:

  1. Install GPMDP to /Applications.
  2. Run `bash gpmdp-to-ydp.sh'
#!/usr/bin/env bash
# ------------------------------------------------------------------------------
# gpmdp-to-ydp.sh | Copyright (C) 2020 eth-p
# https://gist.github.com/eth-p/427a78b7aca4416161d5b8d07d2a73c7
#
# This script will convert and rebrand Google Play Music Desktop Player
# to Youtube Music. This is purely a sylistic change.
# ------------------------------------------------------------------------------
HERE="$(cd "$(dirname "$0")" && pwd)"
set -e
shopt -s nullglob
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "This script is only designed to run on MacOS."
exit 1
fi
# ------------------------------------------------------------------------------
GPMDP_APP="/Applications/Google Play Music Desktop Player.app"
YTM_APP="/Applications/YouTube Music.app"
YTM_APP_FRAMEWORKS="${YTM_APP}/Contents/Frameworks"
YTM_APP_PLIST="${YTM_APP}/Contents/Info.plist"
# ------------------------------------------------------------------------------
rename_package() {
local before="$1"
local after="$2"
local filename="$(basename "$after" | sed 's/\..*$//')"
local info_plist="${after}/Contents/Info.plist"
# Rename the package.
if [[ -d "$before" ]]; then
echo "Renaming: ${before}"
mv "$before" "$after"
fi
# Rename the executable.
local executable="${after}/Contents/MacOS/$(defaults read "$info_plist" CFBundleExecutable)"
mv "$executable" "$(dirname "$executable")/${filename}"
plutil -replace CFBundleExecutable -string "$filename" "${info_plist}"
}
# ------------------------------------------------------------------------------
# Change the icon.
cp "${HERE}/icon.icns" "${GPMDP_APP}/Contents/Resources/icon.icns"
plutil -replace CFBundleIconFile -string "icon.icns" "${GPMDP_APP}/Contents/Info.plist"
# Rename the application package and frameworks.
rename_package "$GPMDP_APP" "$YTM_APP"
for framework in "${YTM_APP_FRAMEWORKS}/Google Play Music Desktop Player"*; do
dir="$(dirname "$framework")"
name="$(basename "$framework" | sed 's/^Google Play Music Desktop Player//')"
rename_package "$framework" "${dir}/Youtube Music${name}"
done
# Update the plist.
plutil -replace CFBundleDisplayName -string "YouTube Music" "$YTM_APP_PLIST"
plutil -replace CFBundleName -string "YouTube Music" "$YTM_APP_PLIST"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment