· 6 years ago · Nov 05, 2018, 06:24 AM
1import json, os, uuid, urllib3, subprocess, hashlib, time, glob
2
3def mediaNfo(location):
4 mediaCommand = subprocess.check_call("mediainfo --output=JSON --LogFile=data.json \"{0}\"".format(location), shell=True)
5 f = open('data.json', 'r')
6 nfo = json.load(f)
7 title = nfo['media']['track'][0]['Title']
8 return str(title)
9
10def single(fileLocation, x, t):
11 i = 0
12 j = 10
13 x = int(x)
14 y = 0
15 ad = str(uuid.uuid4().int)[:4]
16 p = "{0}".format(mediaNfo(fileLocation))
17 for i in range(x):
18 if j >= 60:
19 j = j - 60
20 y = 1
21 screen = subprocess.check_call("ffmpeg -ss {4}:{3}:00 -t 1 -i \"{0}\" -vframes 1 \"{5}-frame-{2}-{1}.png\"".format(fileLocation, ad, i, j, y, t))
22 i += 1
23 j += 5
24
25def up(image):
26 ts = round(time.mktime(time.localtime()))
27 token = "nOGuYh64vNWDINwwev785NDNOW4cmkzI"
28 secret = "Eyt1DCUkZbuA5V5P"
29 sig3 = "CEGJ1W6HZCDE342KD7JE6GED2ZE9HKDSYSBZOHGOTT2WX3GB{}{}{}{}".format(ts, ts, token, secret).encode('utf-8')
30 o = hashlib.md5()
31 o.update(sig3)
32 encode = o.hexdigest()
33 fp = open(image, 'rb')
34 file_data = fp.read()
35 http = urllib3.PoolManager()
36 api_key = "CEGJ1W6HZCDE342K"
37 ad = str(uuid.uuid4().int)[:4]
38 q = http.request('POST',
39 'http://www.imagebam.com/sys/API/resource/upload_image',
40 fields={'Content-Type': 'multipart/form-data',
41 'oauth_consumer_key': api_key,
42 'oauth_token': token,
43 'oauth_signature_method': 'MD5',
44 'oauth_signature': encode,
45 'oauth_timestamp': ts,
46 'oauth_nonce': ts,
47 'image': (image, file_data),
48 'content_type': 'family'})
49 h = json.loads(q.data)
50 print(q.data)
51 return '[url=' + str(h['rsp']['image']['URL']) + '][img]' + str(h['rsp']['image']['thumbnail'] + '[/img][/url]')
52
53
54location = 'D:\The Rain Killer 1990 1080p BluRay Remux AVC FLAC 2.0-BLURANiUM.mkv'
55
56r = mediaNfo(location)
57n = 12
58a = []
59b = []
60path = os.getcwd()
61single(location, n, r)
62for filename in glob.glob(os.path.join(path, '*.png')):
63 a.append(filename)
64aCount = len(a)
65for l in range(len(a)):
66 poo = a[l]
67 print(poo)
68
69testers = a[0]
70
71up()
72
73
74
75os.remove('data.json')