Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python script to restore the metadata for a Deckset file after it is in version control, via xattr. Set your preferred Theme name and Colorscheme in top of file.
!/usr/bin/env python
#
# Quick Script to Fix the Local Settings of Deckset Themes
#
# Deckset uses `xattr` metadata which isn't preserved
# by version control.
#
# Note that Vim will also overwrite your metadata unless you `set backupcopy=yes`
#
# Brendan McAdams <brendan@boldradius.com>
#
import xattr
import glob
StandardTheme = "next"
StandardColors = "scheme9" # black with white text
print "\n For all Presentations in Filetree, setting Theme '%s' with Color Scheme '%s'..." % (StandardTheme, StandardColors)
for f in glob.glob('*/*.md'):
print "\t *** Fixing '%s'" % f
xattr.setxattr(f, 'com.decksetapp.Theme', StandardTheme)
xattr.setxattr(f, 'com.decksetapp.ColorScheme', StandardColors)
print " Done."
@bwmcadams
Copy link
Author

bwmcadams commented Sep 7, 2015

xattr should ship with OS X's default Python. It was on my freshly installed machine with no extra install.

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