Skip to content

Instantly share code, notes, and snippets.

@lasconic
Created March 20, 2014 16:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lasconic/9668440 to your computer and use it in GitHub Desktop.
Python script to find all SMuFL symbols used in MuseScore source
import os
import re
def grep(path, regex, regexcontent):
regObj = re.compile(regex)
res = set()
for root, dirs, fnames in os.walk(path):
for fname in fnames:
if regObj.match(fname) and not "sym.cpp" in fname:
datafile = file(os.path.join(root, fname))
for line in datafile:
matches = re.findall(regexcontent, line)
if len(matches) > 0:
for m in matches:
res.add(m)
return res
symbols = grep('/Users/lasconic/MuseScore', r'.*\.cpp', r'SymId\:\:(\w*)')
for s in sorted(symbols):
if s != "noSym":
print s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment