[flickr] provide human-readable 'license_name' metadata

This commit is contained in:
Mike Fährmann
2025-05-12 16:34:47 +02:00
parent cf6eff7ff7
commit bd7fcdab4c
2 changed files with 35 additions and 0 deletions

View File

@@ -262,6 +262,19 @@ class FlickrAPI(oauth.OAuth1API):
"appletv" : 1,
"iphone_wifi": 0,
}
LICENSES = {
"0": "All Rights Reserved",
"1": "Attribution-NonCommercial-ShareAlike License",
"2": "Attribution-NonCommercial License",
"3": "Attribution-NonCommercial-NoDerivs License",
"4": "Attribution License",
"5": "Attribution-ShareAlike License",
"6": "Attribution-NoDerivs License",
"7": "No known copyright restrictions",
"8": "United States Government Work",
"9": "Public Domain Dedication (CC0)",
"10": "Public Domain Mark",
}
def __init__(self, extractor):
oauth.OAuth1API.__init__(self, extractor)
@@ -526,6 +539,9 @@ class FlickrAPI(oauth.OAuth1API):
"Unable to retrieve 'contexts' data for %s (%s: %s)",
photo["id"], exc.__class__.__name__, exc)
if "license" in photo:
photo["license_name"] = self.LICENSES.get(photo["license"])
@staticmethod
def _clean_info(info):
info["title"] = info["title"]["_content"]