-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
35 lines (31 loc) · 1.14 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from matcher import matcher
import os.path
import imghdr
import requests
import subprocess
def getFrame(channel):
r = requests.get('http://usher.justin.tv/find/%s.json?type=any' % (channel))
result = r.json()[0]
command = 'rtmpdump --swfUrl http://www.justin.tv/widgets/live_embed_player.swf --jtv \'%s\' --live -r %s/%s --stop 1 | avconv -i - -s 1920x1080 -vframes 1 file.png' % (result['token'], result['connect'], result['play'])
subprocess.call(command, shell=True)
def matchChamp():
# getFrame("therainman")
# getFrame("guardsmanbob")
# getFrame("ms_yuyu")
# getFrame("robertxlee")
M = matcher()
print(M.matchChamp('file3.png'))
# imdir = './img/test/'
# imf = os.listdir(imdir)
# M = matcher()
# for ind,champFile in enumerate(imf):
# print(champFile)
# print(M.matchChamp(''.join([imdir,champFile])))
# filePath = raw_input("Give me file name: ")
# if(os.path.isfile(filePath) and imghdr.what(filePath)):
# M = matcher()
# print(M.matchChamp(filePath))
# else:
# print("Please input a valid image file path")
if __name__ == "__main__":
matchChamp()