diff --git a/README.md b/README.md index 6fbdc529..86bb51d3 100644 --- a/README.md +++ b/README.md @@ -94,3 +94,9 @@ One API file consists of an array of image data: [^1]: These files are not a typical [API](https://en.wikipedia.org/wiki/API), but they are used to retrieve all valuable information. In some sence they are the Interface of my Application (though not really a Programming Interface) + +### Copyright + +All images are property of their respective owners (Microsoft, Getty Images, etc.), see the `copyright` field for more details. + +Microsoft's official statement regarding wallpaper downloads is: "**Use of this image is restricted to wallpaper only.**" diff --git a/src/Region.py b/src/Region.py index f3b64b64..0b7e6e1d 100644 --- a/src/Region.py +++ b/src/Region.py @@ -10,6 +10,8 @@ def __init__(self, region): self.path = mkpath(os.path.dirname(__file__), '../api', self.country.upper()) self.api_path = mkpath(self.path, self.country.lower() + '.json') + os.makedirs(self.path, exist_ok=True) + self.gcloud_images_path = mkpath(self.country.upper(), 'images') @property @@ -17,6 +19,9 @@ def mkt(self): return f'{self.lang}-{self.country.upper()}' def read_api(self) -> str: + if not os.path.exists(self.api_path): + return [] + with open(self.api_path, 'r', encoding='utf-8') as file: return json.load(file) @@ -28,6 +33,13 @@ def __repr__(self): return f'Region({self.mkt})' +# ------------------------------------------------------- Regions ------------------------------------------------------ + +# Canada - English: en-ca | Canada - French: fr-ca | China: zh-cn | China - English: en-cn | France: fr-fr +# Germany: de-de | India: en-in | Japan: ja-jp | United Kingdom: en-gb | United States: en-us | International: en-ww + # REGIONS = ['AU', 'CA', 'CN', 'DE', 'FR', 'IN', 'JP', 'ES', 'GB', 'US'] -# REGIONS = ['en-ca', 'fr-ca', 'zh-cn', 'en-cn', 'fr-fr', 'de-de', 'en-in', 'ja-jp', 'en-gb', 'en-us', 'en-ww'] -REGIONS = list(map(Region, ['en-US'])) +# REGIONS = ['en-CA', 'fr-CA', 'zh-CN', 'en-CN', 'fr-FR', 'de-DE', 'en-IN', 'ja-JP', 'en-GB', 'en-US'] +REGIONS = ['en-US'] + +REGIONS = list(map(Region, REGIONS)) diff --git a/src/bing.py b/src/bing.py index baa0381b..09bab355 100644 --- a/src/bing.py +++ b/src/bing.py @@ -172,6 +172,7 @@ def update(region: Region): region.write_api( postprocess_api(list(api_by_date.values())) ) + print() def update_all():