You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Make API call to certificates endpoint using the movie's IMDB ID
81
+
2. Parse the `certificates` array in the response
82
+
3. Find the certificate where:
83
+
-`country.code` equals `"US"`
84
+
-`attributes` array contains a string that includes `"certificate #"` or `"certificate#"`
85
+
4. Extract the `rating` value from the matching certificate
86
+
5. Store the rating in the `tenup_movie_mpa_rating` meta field
87
+
88
+
**Example**:
89
+
Based on the API response from [https://api.imdbapi.dev/titles/tt2380307/certificates](https://api.imdbapi.dev/titles/tt2380307/certificates), the script should find:
90
+
```json
91
+
{
92
+
"rating": "PG",
93
+
"country": {
94
+
"code": "US",
95
+
"name": "United States"
96
+
},
97
+
"attributes": [
98
+
"certificate #51192"
99
+
]
100
+
}
101
+
```
102
+
And store `"PG"` as the MPA rating.
103
+
104
+
**Error Handling**:
105
+
- If no US certificate with "certificate #" or "certificate#" attribute is found, set `tenup_movie_mpa_rating` to "Not Rated"
106
+
- If the certificates API call fails, log the error but continue with the movie import
107
+
- Handle cases where the certificates array is empty or malformed
108
+
72
109
### Genre Taxonomy
73
110
-**Taxonomy**: `tenup-genre`
74
111
-**Source**: `genres` array from API response
@@ -228,8 +265,9 @@ wp imdb-import both --file=imdb_ids.txt
228
265
When importing a movie, the script should:
229
266
230
267
1.**Fetch Movie Data**: Get movie data from IMDB API
231
-
2.**Create Movie Post**: Create the movie post with all meta fields
232
-
3.**Process Stars Array**: For each star in the `stars` array:
268
+
2.**Fetch MPA Rating**: Get MPA rating from certificates API
269
+
3.**Create Movie Post**: Create the movie post with all meta fields including MPA rating
270
+
4.**Process Stars Array**: For each star in the `stars` array:
233
271
- Check if person already exists (by `tenup_person_imdb_id`)
234
272
- If exists:
235
273
- Update person post with latest data from People API
@@ -251,15 +289,16 @@ When importing a movie, the script should:
251
289
- Handle duplicate filenames by appending numbers
252
290
253
291
### API Rate Limiting
254
-
- Respect rate limits between movie and people API calls
292
+
- Respect rate limits between movie, certificates, and people API calls
255
293
- Cache people API responses to avoid duplicate calls
294
+
- Cache certificates API responses to avoid duplicate calls
256
295
- Batch process stars to minimize API requests
296
+
- Implement delays between API calls to respect rate limits
257
297
258
298
## Additional Notes
259
299
260
300
### Fields Not Available in API
261
301
The following existing post meta fields do not have equivalents in the IMDB API responses and will not be populated:
262
-
-`tenup_movie_mpa_rating` (MPA rating not available)
0 commit comments