Permalink
Browse files

Add readme, license, and psftag script.

  • Loading branch information...
0 parents commit b19153831cda5657470702c63fc4e137c7da5fb9 @Osmose committed Aug 6, 2011
Showing with 47 additions and 0 deletions.
  1. +13 −0 LICENSE
  2. +3 −0 README.md
  3. +31 −0 psftag.py
@@ -0,0 +1,13 @@
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
+
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
@@ -0,0 +1,3 @@
+# Scripts
+
+Here lie scripts that are not necessarily well written or complete, but they do something useful and might be helpful to you.
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# WTFPL 2.0. See LICENSE for more info.
+"""
+Tiny script that iterates through a bunch of PSF files and strips the length
+and fade tags. This is mainly so that I could convert my PSF files to loop
+continuously in Audio Overload.
+"""
+from argparse import ArgumentParser
+from glob import glob
+
+def main():
+ parser = ArgumentParser(description='Remove length and fade tags from '
+ 'PSF files.')
+ parser.add_argument('pattern', help='glob-compatible pattern of files to '
+ 'parse')
+ pattern = parser.parse_args().pattern
+
+ # Yay for nasty code
+ for f in glob(pattern):
+ with open(f, 'r') as file:
+ contents = file.read().splitlines(True)
+ with open(f, 'w') as file:
+ for line in contents:
+ if line.startswith('length') or line.startswith('fade'):
+ line = ''
+ file.write(line)
+
+
+
+if __name__ == '__main__':
+ main()

0 comments on commit b191538

Please sign in to comment.