-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Huge update to website & website generation
- Loading branch information
Showing
16 changed files
with
259 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# Cache | ||
__pycache__/ | ||
|
||
# Website generated files | ||
website/api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import sys | ||
import os | ||
|
||
sys.path.append('../') | ||
from Region import REGIONS # noqa: E402 | ||
from utils import mkpath # noqa: E402 | ||
|
||
|
||
WEBSITE_ROOT = '../website' | ||
|
||
|
||
def main(): | ||
for region in REGIONS: | ||
api = region.read_api() | ||
|
||
webiste_directory = mkpath(WEBSITE_ROOT, 'api', region.country.upper()) | ||
|
||
os.makedirs(webiste_directory, exist_ok=True) | ||
|
||
for file in os.listdir(webiste_directory): | ||
os.remove(mkpath(webiste_directory, file)) | ||
|
||
region.write_api(api, mkpath(webiste_directory, region.lang.lower() + '.json')) | ||
# region.write_api( | ||
# api, | ||
# mkpath(webiste_directory, region.lang.lower() + '.min.json'), | ||
# indent=None, separators=(',', ':') | ||
# ) | ||
|
||
# only_urls = {image['date']: image['url'] for image in api} | ||
|
||
# region.write_api( | ||
# only_urls, | ||
# mkpath(webiste_directory, region.lang.lower() + '.url.json'), | ||
# indent=None, separators=(',', ':') | ||
# ) | ||
|
||
# Split by year | ||
min_year = int(min(image['date'] for image in api).split('-')[0]) | ||
max_year = int(max(image['date'] for image in api).split('-')[0]) | ||
for year in range(min_year, max_year + 1): | ||
year_api = [image for image in api if image['date'].startswith(str(year))] | ||
region.write_api( | ||
year_api, | ||
mkpath(webiste_directory, region.lang.lower() + f'.{year}.json'), | ||
indent=None, separators=(',', ':') | ||
) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import sys | ||
|
||
sys.path.append('../') | ||
from Region import REGIONS # noqa: E402 | ||
|
||
|
||
def main(): | ||
total_image_count = 0 | ||
|
||
for region in REGIONS: | ||
api = region.read_api() | ||
|
||
total_image_count += len(api) | ||
|
||
print(total_image_count) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.