mirror of
				https://gitlab.crans.org/mediatek/med.git
				synced 2025-11-04 15:22:27 +01:00 
			
		
		
		
	Ensure that the fetched roman ISBN is the queried ISBN
This commit is contained in:
		@@ -115,9 +115,18 @@ class MediaAdminForm(ModelForm):
 | 
				
			|||||||
            data = json.loads(url.read().decode())
 | 
					            data = json.loads(url.read().decode())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if data and data['totalItems']:
 | 
					        if data and data['totalItems']:
 | 
				
			||||||
            data = data['items'][0]
 | 
					            fetched_item = None
 | 
				
			||||||
 | 
					            for item in data['items']:
 | 
				
			||||||
 | 
					                for identifiers in item["volumeInfo"]["industryIdentifiers"]:
 | 
				
			||||||
 | 
					                    if identifiers["identifier"] == isbn:
 | 
				
			||||||
 | 
					                        fetched_item = item
 | 
				
			||||||
 | 
					                        break
 | 
				
			||||||
 | 
					                if fetched_item:
 | 
				
			||||||
 | 
					                    break
 | 
				
			||||||
 | 
					            if not fetched_item:
 | 
				
			||||||
 | 
					                return False
 | 
				
			||||||
            # Fill the data
 | 
					            # Fill the data
 | 
				
			||||||
            self.parse_data_google(data)
 | 
					            self.parse_data_google(fetched_item)
 | 
				
			||||||
            return True
 | 
					            return True
 | 
				
			||||||
        return False
 | 
					        return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user