Created
July 22, 2016 01:48
-
-
Save loadedsith/5add3a739777ee11aa20c8656d9b515e to your computer and use it in GitHub Desktop.
Strip YouTube Caption Timestamps with Textmate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>commands</key> | |
<array> | |
<dict> | |
<key>command</key> | |
<string>selectAll:</string> | |
</dict> | |
<dict> | |
<key>argument</key> | |
<dict> | |
<key>action</key> | |
<string>replaceAll</string> | |
<key>findString</key> | |
<string>\d+:\d+:\d+.\d+,\d+:\d+:\d+.\d+</string> | |
<key>ignoreCase</key> | |
<true/> | |
<key>regularExpression</key> | |
<true/> | |
<key>replaceAllScope</key> | |
<string>selection</string> | |
<key>replaceString</key> | |
<string></string> | |
<key>wrapAround</key> | |
<true/> | |
</dict> | |
<key>command</key> | |
<string>findWithOptions:</string> | |
</dict> | |
<dict> | |
<key>argument</key> | |
<dict> | |
<key>action</key> | |
<string>replaceAll</string> | |
<key>findString</key> | |
<string>\n{2,}</string> | |
<key>ignoreCase</key> | |
<true/> | |
<key>regularExpression</key> | |
<true/> | |
<key>replaceAllScope</key> | |
<string>selection</string> | |
<key>replaceString</key> | |
<string>\n</string> | |
<key>wrapAround</key> | |
<true/> | |
</dict> | |
<key>command</key> | |
<string>findWithOptions:</string> | |
</dict> | |
<dict> | |
<key>argument</key> | |
<dict> | |
<key>action</key> | |
<string>replaceAll</string> | |
<key>findString</key> | |
<string>,\s+</string> | |
<key>ignoreCase</key> | |
<true/> | |
<key>regularExpression</key> | |
<true/> | |
<key>replaceAllScope</key> | |
<string>selection</string> | |
<key>replaceString</key> | |
<string>,</string> | |
<key>wrapAround</key> | |
<true/> | |
</dict> | |
<key>command</key> | |
<string>findWithOptions:</string> | |
</dict> | |
</array> | |
<key>name</key> | |
<string>Strip Timecodes</string> | |
<key>uuid</key> | |
<string>455B3685-5BE8-4E6F-9EAF-B8EF7DB2F252</string> | |
</dict> | |
</plist> |
It doesn't insert spaces after commas because i thought you asked for your third step to be to remove these spaces. Probably should have asked before I made it that way, lol, as that's an insane thing to request.
You could probably do a simple find and replace for the brackets thing, same as you did for the commas (did you know you could replace with multiple lines? you can).
If you'll need this in the future I bet I could modify them, but I assume this is probably close enough?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One thing I found is that doing an Unwrap Paragraph command took care of the other line breaks. The I did a find and replace on "," to change it to ", ". After that it would just be adding 2 lines breaks before and after []. Boring, so if you don't want to do it, no big deal. This has already saved me heaps of time.
Cheers.
Xero