Fix Darwin build and update Shared

This commit is contained in:
j 2014-09-30 22:25:10 +02:00
commit 0ec7e7cc9e
97 changed files with 294 additions and 219 deletions

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import print_function
from datetime import datetime
import re
import time
@ -58,12 +59,12 @@ def get_news(year, month, day):
if new['url'][:1] == '/':
new['url'] = 'http://www.spiegel.de' + new['url']
news.append(new)
# print '%s, %s' % (new['section'], dateString)
# print('%s, %s' % (new['section'], dateString))
'''
elif dateString[:10] == date and not description:
print dateString + ' - no description'
print(dateString + ' - no description')
elif dateString[:10] == date and not imageUrl:
print dateString + ' - no image'
print(dateString + ' - no image')
'''
return news
@ -140,7 +141,7 @@ def archive_issues():
else:
wMax = 53
for w in range(wMax, 0, -1):
print 'get_issue(%d, %d)' % (y, w)
print('get_issue(%d, %d)' % (y, w))
issue = get_issue(y, w)
if issue:
dirname = '%s/%d/%02d' % (archivePath, y, w)
@ -185,7 +186,7 @@ def archive_issues():
p['min'] = issue['pages']
if issue['pages'] > p['max']:
p['max'] = issue['pages']
print p['min'], p['sum'] / p['num'], p['max']
print(p['min'], p['sum'] / p['num'], p['max'])
def archive_news():
@ -218,7 +219,7 @@ def archive_news():
else:
dMax = days[m]
for d in range(dMax, 0, -1):
print 'getNews(%d, %d, %d)' % (y, m, d)
print('getNews(%d, %d, %d)' % (y, m, d))
news = getNews(y, m ,d)
for new in news:
dirname = archivePath + '/' + new['date'][0:4] + '/' + new['date'][5:7] + new['date'][8:10] + '/' + new['date'][11:13] + new['date'][14:16]
@ -260,19 +261,19 @@ def archive_news():
if strings[0] != new['title1'] or strings[1] != new['title2']:
colon.append('%s %s %s: %s' % (new['date'], new['title'], new['title1'], new['title2']))
for key in sorted(count):
print '%6d %-24s %s' % (count[key]['count'], key, count[key]['string'])
print('%6d %-24s %s' % (count[key]['count'], key, count[key]['string']))
for value in colon:
print value
print(value)
if __name__ == '__main__':
# spiegel = Spiegel(2008, 8)
# print spiegel.getContents()
# print(spiegel.getContents())
# news = News(2001, 9, 10)
# output(news.getNews())
'''
x = []
for d in range(10, 30):
print '2/%d' % d
print('2/%d' % d)
news = getNews(2008, 2, d)
for new in news:
strings = new['url'].split('/')
@ -281,7 +282,7 @@ if __name__ == '__main__':
string += '/' + format_subsection(strings[4])
if not string in x:
x.append(string)
print x
print(x)
'''
# archive_issues()
archive_news()