-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnew_entry_detection.py
63 lines (58 loc) · 1.46 KB
/
new_entry_detection.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
61
62
63
import submission
def check_new_entry(god: list, local: list, feature: bool):
new_entry = False
local_uuids = []
for local_item in local:
local_uuids.append(local_item['uuid'])
for item in god:
if item['uuid'] not in local_uuids:
new_entry = True
if feature:
print(f'New feature detected: {item}')
else:
print(f'New entry detected: {item}')
if feature:
submission.reddit_post(
title=item['title'],
author=item['author'],
tier=item['tier'],
link=item['link'],
parody=item['parody'],
feature=feature
)
else:
submission.reddit_post(
title=item['title'],
author=item['author'],
tier=item['tier'],
pages=item['pages'],
tags=item['tags'],
link=item['link'],
note=item['note'],
parody=item['parody'],
uuid=item['uuid'],
feature=feature
)
submission.twitter_post(
title=item['title'],
author=item['author'],
tier=item['tier'],
pages=item['pages'],
tags=item['tags'],
link=item['link'],
note=item['note'],
parody=item['parody'],
image=item['image'],
uuid=item['uuid'],
feature=feature
)
local.append(item)
if feature:
print(f'Newest local feature item is now {local[-1]}')
else:
print(f'Newest local list item is now {local[-1]}')
if not new_entry:
if feature:
print('No new feature detected')
else:
print('No new entry detected')