Skip to content

Instantly share code, notes, and snippets.

View glamrock's full-sized avatar
🐝
hacking on things at Berkman <3

Griffin Boyce glamrock

🐝
hacking on things at Berkman <3
View GitHub Profile
@lambdan
lambdan / itsfuckingraw.py
Created August 19, 2018 13:36
extract snippets of video containing a certain phrase for instance
import os, sys, re, subprocess
tsfile = 'raws.txt'
# create the Timestamps (tsfile) using grep and Sublime Text or whatever you want
# it should contain the episode name/video file + the timestamp, for example:
#
# Seinfeld.S03E15.The.Suicide.720p.HULU.WEBRip.AAC2.0.H.264-NTb.srt-00:14:25,242 --> 00:14:27,775
# Seinfeld.S03E17.The.Boyfriend.720p.HULU.WEBRip.AAC2.0.H.264-NTb.srt-00:12:34,738 --> 00:12:36,639
# S03E18-00:12:34,768 --> 00:12:36,639
# ...
def insert_comma(mystring, position):
mystring[:position] + ',' + mystring[position:]
offset = 0
for magic_number in magic_numbers:
position = magic_number + offset
mystring = insert_comma(mystring, position)
offset += 1