Closed ridgehkr closed 10 years ago
I like it.
My question is this: when should I retrieve the title? I'd lean toward storing the title in the field data, so that it doesn't have to be queried from Google each time the template is run. But that means that the title could be stale. (I can't imagine people change titles of published videos very often, but it's possible.)
On the other hand, I could query the title from Google each time the template is run, but that could make templates take longer to render (because they have to wait for a network connection from the server to Google), and could put a site over Google's rate limit (I don't know what this limit is, or even if they have one, but knowing Google, one exists).
Thoughts on that?
Good question. I'm inclined to think it's better to pull the title only when editing the entry and let it get outdated if its value changes at YouTube. A possible compromise might be to run the JS function that refreshes the video's title automatically whenever that channel entry's Edit form is opened. There could even be a button by the field for refreshing the title manually, too.
While we're at it, it probably wouldn't hurt to grab the video thumbnail as well, right? I can add a separate issue for that, though.
Are you at all interested in taking a stab at this?
I envision the data being stored as http://www.youtube.com/watch?v=6KeG_i8CWE8|An American Coach in London: NBC Sports Premier League Film featuring Jason Sudeikis
, and the code splitting on that pipe. The title will probably need to be passed via a hidden input back to the fieldtype.
However, looking at my schedule, I don't think I'll have time to update to this for a while. If you are can and are willing to make the changes, submit a pull request. Otherwise, I'll keep it in mind as a future enhancement.
Absolutely. I'm pretty busy as well, but I'll see what I can do.
It appears that the title is already available to the add-on as the value is visible in the Publish form view. It would be nice to have that available from a tag.