diff options
author | emkael <emkael@tlen.pl> | 2017-04-14 02:06:15 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-04-14 02:06:15 +0200 |
commit | bed78f3f27f66a0411b27b8989e8e7b6c2333eb9 (patch) | |
tree | 4ff47c96705a3d7a1be787c2f29fa0593337e520 | |
parent | da4e3a5b6670e5116c95d7c6db8d7155d66968e6 (diff) |
Extended page subtitles, with ranking edition detailed titles
-rwxr-xr-x | bin/build.sh | 2 | ||||
l--------- | config/dates.json | 2 | ||||
-rw-r--r-- | ranking.py | 11 | ||||
-rw-r--r-- | templates/ranking.html | 4 |
4 files changed, 11 insertions, 8 deletions
diff --git a/bin/build.sh b/bin/build.sh index 4cd0f90..14b4f98 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -9,7 +9,7 @@ cat config/dates.json | xargs -n4 | while read DATE URL INDEX NAME do - python ranking.py $DATE $PREV_DATE > $DIR/$URL + python ranking.py "$NAME" $INDEX $DATE $PREV_DATE > $DIR/$URL PREV_DATE=$DATE done find $DIR -maxdepth 1 -type f -name \*.html | diff --git a/config/dates.json b/config/dates.json index f302866..4388d7d 120000 --- a/config/dates.json +++ b/config/dates.json @@ -1 +1 @@ -prod-dates.json
\ No newline at end of file +test-dates.json
\ No newline at end of file @@ -3,9 +3,12 @@ from bs4 import BeautifulSoup as bs4 from pyranking.fetch import fetch_ranking -ranking_date = sys.argv[1] +ranking_date = sys.argv[3] +subtitle = 'notowanie %s (%s), stan na %s' % ( + sys.argv[1], sys.argv[2], '.'.join(ranking_date.split('-')[::-1]) +) ranking = fetch_ranking(ranking_date) -old_ranking = fetch_ranking(sys.argv[2], True) if len(sys.argv) > 2 else {} +old_ranking = fetch_ranking(sys.argv[4], True) if len(sys.argv) > 4 else {} for row in ranking: if row['pid'] in old_ranking: @@ -28,9 +31,7 @@ table = bs4(file('templates/ranking.html'), 'lxml') table_body = table.select('tbody')[0] table_row = table_body.select('tr')[0].extract() -table.select('.page-header h1 small')[0].string = 'stan na %s' % ( - '.'.join(ranking_date.split('-')[::-1]) -) +table.select('.page-header h2 small')[0].string = subtitle for row in ranking: new_row = copy.copy(table_row) diff --git a/templates/ranking.html b/templates/ranking.html index c630753..a9b77e1 100644 --- a/templates/ranking.html +++ b/templates/ranking.html @@ -10,8 +10,10 @@ <div class="page-header"> <h1> Oficjalny Ranking Brydżowy PZBS - <small></small> </h1> + <h2> + <small></small> + </h2> </div> <div class="panel panel-default filters"> <div class="panel-heading" role="button" data-toggle="collapse" data-target="#filters" aria-expanded="false" aria-controls="filters"> |