Skip to content

Instantly share code, notes, and snippets.

@mattmccray
Last active December 12, 2015 06:09
Show Gist options
  • Select an option

  • Save mattmccray/4727331 to your computer and use it in GitHub Desktop.

Select an option

Save mattmccray/4727331 to your computer and use it in GitHub Desktop.
Shell script to optimize MangaStudio 5 files.
# The MangaStudio 5 (ms5) file format is actually just sqlite3 database.
#
# When you save and re-save them, they tend to accumulate a bit of cruft.
# This script will loop through the specified .lip files and run the 'vacuum;'
# command on each one, removing the cruft!
#
# WARNING: Use at your own risk! I've not had any problems, but it has not
# been tested exhaustively.
#
# Installation:
#
# Add the following function to your .bash_profile, or save it as a separate
# file and 'source' it.
#
# Usage:
# $ optimize_lip *.lip
#
function optimize_lip {
echo "Optimizing MangaStudio 5 files..."
for var in "$@"
do
echo " ${var}:"
size=$(du -k "${var}" | sed 's/\([0-9]*\)\(.*\)/\1/')
echo " before: ${size} kB"
sqlite3 "$var" "vacuum;"
size=$(du -k "${var}" | sed 's/\([0-9]*\)\(.*\)/\1/')
echo " after: ${size} kB"
done
echo "Done."
}
@mattmccray
Copy link
Author

Glad to hear it. 2gb is quite a savings! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment