Thursday, January 28, 2016

Extending a hentai to the limits

Not sure if this is the appropriate place for this but, hell who cares.

Have you ever wondered how much would a gangbang scene last in a hentai without the cuts? Well maybe you have not, anyway I did. So during this month I've developed and tested a Python script that does exactly that.

The script takes VLC Player and controls it via HTTP requests on the localhost so that you can repeat once and again the same scenes (like a GIF) and therefore extend them to what would be approximately the duration of the scene in real life (though it's still a drawing about a non existing girl in a fantasy story, it can't be more fake).


As an example I coded a sequence for one of my favourite hentai (Kuroinu):
#First Gangbang
7:21    repeat(12, 12, False)
7:33    repeat(25, 12, False)
7:45    repeat(6, 32)
8:22    repeat(18, 12)
9:05    repeat(25, 12)
9:45    repeat(8, 12)

#Second Gangbang
19:14    pause(30)
19:34    repeat(10, 15)
21:17    repeat(15, 15)
21:36    repeat(5, 8)
21:48    repeat(4, 6)
22:00    repeat(7, 25)
22:06    pause(20)
22:07    repeat(2, 80)
22:11    pause(20); repeat(2, 50)
22:14    pause(20)
22:15    repeat(2, 50)
22:18    pause(5); repeat(2, 80)
22:21    pause(5); repeat(2, 40)
22:30    repeat(1, 120)
22:33    pause(5)
22:34    repeat(2, 60)
22:37    pause(5)
22:38    repeat(1, 60)
22:41    pause(2); repeat(1, 120)
22:44    pause(5) #1860s
#Second round
24:53    pause(20)
24:54    repeat(23, 15)
25:43    pause(20)
26:00    repeat(20, 6) #Enema


So this sequence basically waits until the time us up and executes a Python instruction, for example the instruction repeat(duration, times, mute). This makes the second scene last about 40 minutes instead of 5 (though I'm not sure how much time is supossed to be needed to break an elf). Anyway here you have the script:

import os, subprocess, time, atexit
FNULL = open(os.devnull, 'w')
atexit.register(lambda: subprocess.call('echo shutdown | netcat localhost 11337', shell=True))
start_time = time.time()
last_seek = start_time
diff = 0
data = {}

def getCurrentPosition():
    return diff + time.time()-last_seek

_last_printed_time = ""
def print_time():
    global _last_printed_time
    h = subprocess.check_output('echo get_time | netcat localhost 11337', shell=True).decode('ascii').splitlines()[2][2:]
    h = str(int(int(h)/60)) + ":" + str(int(h)%60)
    if h != _last_printed_time: print(h)
    _last_printed_time = h

def load(path, txt, fullscreen = True):
    if fullscreen: f = ' -f'
    else: f = ''
    subprocess.call('vlc --control rc --rc-host localhost:11337 ' + path + ' -d' + f, shell=True, stdout = FNULL)

    global data
    with open(txt, 'r') as f:
        for line in f.read().splitlines():
            if line == "" or line.startswith("#") or line.find(":") < 0 or line.find("\t") < 0: continue
            t, val = line.split("\t")
            m, s = t.split(':')
            data[int(int(m)*60+int(s))] = val.split('#')[0]

    time.sleep(0.1)
    volume(100)

def pause(t):
    global last_seek
    subprocess.call('echo pause | netcat localhost 11337', shell=True, stdout = FNULL)
    time.sleep(t)
    last_seek += t
    subprocess.call('echo play | netcat localhost 11337', shell=True, stdout = FNULL)

def volume(v): subprocess.call('echo volume ' + str(int(v*2.52)) + ' | netcat localhost 11337', shell=True, stdout = FNULL)

def seek(val):
    global diff, last_seek
    subprocess.call('echo seek ' + str(val) + ' | netcat localhost 11337', shell=True, stdout=FNULL)
    diff = val
    print_time()
    last_seek = time.time()

def repeat(freq, times, mute = True):
    global _done
    it = time.time()
    ct = it
    rp = getCurrentPosition()
    if mute: volume(0)
    for i in range(times):
        ct = time.time()
        time.sleep(freq)
        seek(int(rp))
    if mute: volume(100)
################################################################################

load("Kuroinu_Kedakaki_Seijo_wa_Hakudaku_ni_Somaru_02_ES_www.UnderHentai.net.mp4", "KK2.txt", False)

seek(0*60+20)
done = []
while True:
    print_time()
    ct = int(getCurrentPosition())
    if ct not in done:
        if ct in data.keys(): exec(data[ct])
        done.append(ct)
    time.sleep(0.5)
 


To make it work you have to indicate the filepath of the video and the filepath of the secuence on the load function (just some lines above). Notice that this script makes system calls, so it probably doesn't work on Windows, it should work fine on any Linux distribution.

2 comments:

  1. how do you change quests, or is it just something that happens naturally throughout the game?

    ReplyDelete
  2. hola por que no volvistes a actulizar la pagina

    ReplyDelete