2020-09-07 13:19:06 +00:00
|
|
|
from __future__ import unicode_literals
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2020-09-07 13:19:06 +00:00
|
|
|
import frappe
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2020-09-07 13:19:06 +00:00
|
|
|
from erpnext.utilities.doctype.video.video import get_id_from_url
|
|
|
|
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2020-09-07 13:19:06 +00:00
|
|
|
def execute():
|
2020-09-07 15:15:50 +00:00
|
|
|
frappe.reload_doc("utilities", "doctype","video")
|
|
|
|
|
2020-09-07 13:19:06 +00:00
|
|
|
for video in frappe.get_all("Video", fields=["name", "url", "youtube_video_id"]):
|
|
|
|
if video.url and not video.youtube_video_id:
|
|
|
|
frappe.db.set_value("Video", video.name, "youtube_video_id", get_id_from_url(video.url))
|