Check-in [b070f5b166]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:First commit. Depends on path to vlc to be set in file.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b070f5b1666b775752e359214119d680891fd2b2
User & Date: DarkLinkXXXX 2013-09-24 03:46:41
Context
2013-09-25
00:04
Second commit. Leaf check-in: ea34849e2d user: DarkLinkXXXX tags: trunk
2013-09-24
03:46
First commit. Depends on path to vlc to be set in file. check-in: b070f5b166 user: DarkLinkXXXX tags: trunk
03:39
initial empty check-in check-in: a6202c8e59 user: DarkLinkXXXX tags: trunk
Changes

Added repl.py.

            1  +#!/usr/bin/env python
            2  +
            3  +import readline
            4  +import threading
            5  +import http.client
            6  +import shutil
            7  +import os
            8  +import subprocess
            9  +import shlex
           10  +
           11  +##########################
           12  +#Configuration Parameters#
           13  +##########################
           14  +
           15  +debug = True
           16  +vlc = "c:/Program\ Files/VideoLAN/VLC/vlc.exe"
           17  +
           18  +
           19  +
           20  +
           21  +PROMPT = '> '
           22  +
           23  +def info():
           24  +    print("""
           25  +   _____    _________.____         _____                        .__   
           26  +  /  _  \  /   _____/|    |       /  _  \   ____    ____   ____ |  |  
           27  + /  /_\  \ \_____  \ |    |      /  /_\  \ /    \  / ___\_/ __ \|  |  
           28  +/    |    \/        \|    |___  /    |    \   |  \/ /_/  >  ___/|  |__
           29  +\____|__  /_______  /|_______ \ \____|__  /___|  /\___  / \___  >____/
           30  +        \/        \/         \/         \/     \//_____/      \/
           31  +Alex Stubbins Anti-Copyright 2013
           32  +""")
           33  +    
           34  +
           35  +
           36  +def handspeak(word):
           37  +    import urllib.request as req
           38  +    domain = "www.handspeak.com"
           39  +    con = http.client.HTTPConnection(domain)
           40  +    url = "/word/" + word[0] + "/" + word + ".mp4"
           41  +    con.request("GET", url)
           42  +    stat = con.getresponse().status
           43  +    print(stat)
           44  +    if stat == 200:
           45  +        file = req.urlretrieve("http://" + domain + url)[0]
           46  +        file = shutil.copyfile(file, file + ".mp4")
           47  +        print("File saved at " + file)
           48  +        lcmd = shlex.split(vlc + " -vvv ")
           49  +        print(lcmd + [file])
           50  +        subprocess.call(lcmd + [file])
           51  +
           52  +        
           53  +
           54  +commands  = {'i': info, 'hs': handspeak}
           55  +
           56  +
           57  +def interrupt():
           58  +    print() # Don't want to end up on the same line the user is typing on.
           59  +    print('Interrupting cow -- moo!')
           60  +#    print(PROMPT, readline.get_line_buffer(), sep='', end='')
           61  +
           62  +def cli():
           63  +    while True:
           64  +        try:
           65  +            coli = str(input(PROMPT))
           66  +            try:
           67  +                cmd = coli.split()[0]
           68  +            except IndexError:
           69  +                cli()
           70  +
           71  +                
           72  +                
           73  +            args = coli[len(cmd)+1:]
           74  +            if cmd in commands:
           75  +                commands[cmd](args)
           76  +            else:
           77  +                if cli != "":
           78  +                    print('"' + cli + '"')
           79  +        except EOFError as err:
           80  +            print("\rGoodbye!", end="")
           81  +            exit()
           82  +
           83  +
           84  +if __name__ == '__main__':
           85  +    threading.Thread(target=cli).start()
           86  +#    threading.Timer(0, interrupt).start()