-
Notifications
You must be signed in to change notification settings - Fork 0
/
freshen.py
38 lines (32 loc) · 1.05 KB
/
freshen.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
from channelguide import manage, init
init.init_external_libraries()
from channelguide.guide.views import channels, frontpage
from channelguide.guide.models import user
from channelguide import db, cache
import time
cache.client.get = lambda x: None
database = db.connect()
def request(_method='GET', _path="/", **kwargs):
class MockRequest:
connection = database
method = _method
path = _path
if _method == 'GET':
GET = kwargs
if _method == 'POST':
POST = kwargs
META = {'QUERY_STRING':''}
# middleware would do this, but I'm lazy
user = user.AnonymousUser()
total_channels = 0
return MockRequest()
while True:
print 'updating'
channels.popular(request(view='month'))
channels.popular(request(view='alltime'))
frontpage.get_popular_channels(database, 7)
frontpage.get_new_channels(database, 7)
for category in frontpage.get_categories(database):
frontpage.get_category_channels(database, category)
print 'updated'
time.sleep(60)