-
Notifications
You must be signed in to change notification settings - Fork 1
/
verify_results.py
executable file
·60 lines (49 loc) · 2.05 KB
/
verify_results.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from os.path import exists
from os import chdir
from koop_db import get_records_from_dbf, read_traffic, list2file, mylower
from verify_utils import getdates, test_playlist, get_weeklytraffic, get_playlist
from difflib import ndiff
from subprocess import call
import shutil
def verify_results():
on_prod = False
if exists('K:/DAD/Files/CUTS.DBF'):
on_prod = True
if on_prod:
cut_records = get_records_from_dbf('K:/DAD/Files/CUTS.DBF')
shutil.copy('K:/DAD/Files/CUTS.DBF','inputfiles/cuts.dbf')
else:
cut_records = get_records_from_dbf('inputfiles/cuts.dbf')
ascii_traffic = read_traffic()
weekof = ascii_traffic[1][2]
print("VerifyResults now running and verifying traffic for week of:",weekof,"\n")
dates = getdates(ascii_traffic)
#print("dates are:",dates,'\n')
weekly_traffic = get_weeklytraffic(ascii_traffic,dates)
#import the AUTO files and verify traffic
for date in dates:
playlist = get_playlist(date, cut_records, on_prod)
if not playlist:
continue
traffic = weekly_traffic[date]
mylower(traffic)
mylower(playlist)
ndiffs = ndiff(playlist,traffic)
#print("\nVerifying -->",date,":\n")
#print("--------------differences------------")
#print('\n'.join(ndiffs))
#print("-----------Requested Traffic---------")
#print('\n'.join(traffic))
#print("-------------Actual Traffic----------")
#print('\n'.join(playlist))
#print("-------------test results------------")
playlist_file = "logs/"+date+"playlist.txt"
traffic_file = "logs/"+date+"traffic.txt"
list2file(playlist,playlist_file)
list2file(traffic,traffic_file)
test_playlist(traffic, playlist)
call(['C:/program_files/vim/vim90/gvim', '-d',traffic_file,playlist_file])
shutil.make_archive('../gt'+dates[0], 'zip', '..','gentraffic')
return True
if __name__ == "__main__":
verify_results()