-
Notifications
You must be signed in to change notification settings - Fork 3
/
usingTimelapseToTakeScreenShots.py
executable file
·46 lines (35 loc) · 1.41 KB
/
usingTimelapseToTakeScreenShots.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
36
37
38
39
40
41
42
43
44
45
46
import os, sys
from timelapse import timelapse
from getConfig import getConfigParameters
globalPrefix = getConfigParameters('globalPrefix')
globalInputUrlsFileName = globalPrefix + 'twitter_requests_wdill.txt'
try:
listOfNominatedURLs = open(globalInputUrlsFileName, "r")
nominationTuples = listOfNominatedURLs.readlines()
except:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
print((fname, exc_tb.tb_lineno, sys.exc_info() ))
listOfNominatedURLs.close()
print("read lines: ", len(nominationTuples))
originalPath = os.getcwd()
for i in range(0,len(nominationTuples)):
#<0: URL, 1: SCREEN-NAME, 2: DATE-TIME, 3: TWEET-ID, 4: (optional POST-ID, 5: POST-FLAG) >
nominationData = nominationTuples[i].split(' <> ')
#this url has not been published
if( len(nominationData) < 6):
URL = nominationData[0].strip()
#screen_name = nomimationData[1].strip()
#datetime = nomimationData[2].strip()
#tweetID = nomimationData[3].strip()
dateRange = nominationData[4].strip()
if dateRange == '0 - 0':
dateRange = None
os.chdir(originalPath)
print("...sending "+ URL+ " to timelapse to take pictures")
timelapse(URL, dateRange=dateRange)
print('...calling timelapseSubEngine.py')
#MOD
os.chdir(originalPath)
pythonVirtualEnvPath = getConfigParameters('pythonVirtualEnv1Path')
os.system(pythonVirtualEnvPath + ' -u ' + globalPrefix + 'timelapseSubEngine.py &')