feat: Track Youtube interactions via Video DocType

This commit is contained in:
marination
2020-08-02 05:35:45 +05:30
parent 01e0d50eba
commit d4817c8685
14 changed files with 296 additions and 8 deletions

View File

View File

@@ -0,0 +1,9 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["YouTube Interactions"] = {
"filters": [
]
};

View File

@@ -0,0 +1,27 @@
{
"add_total_row": 0,
"creation": "2020-08-02 05:05:00.457093",
"disable_prepared_report": 0,
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 0,
"is_standard": "Yes",
"modified": "2020-08-02 05:05:00.457093",
"modified_by": "Administrator",
"module": "Utilities",
"name": "YouTube Interactions",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Video",
"report_name": "YouTube Interactions",
"report_type": "Script Report",
"roles": [
{
"role": "All"
},
{
"role": "System Manager"
}
]
}

View File

@@ -0,0 +1,72 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def execute(filters=None):
columns = get_columns()
data = get_data()
return columns, data
def get_columns():
return [
{
"label": _("Published Date"),
"fieldname": "publish_date",
"fieldtype": "Date",
"width": 100
},
{
"label": _("Title"),
"fieldname": "title",
"fieldtype": "Data",
"width": 100
},
{
"label": _("Provider"),
"fieldname": "provider",
"fieldtype": "Data",
"width": 100
},
{
"label": _("Views"),
"fieldname": "view_count",
"fieldtype": "Float",
"width": 100
},
{
"label": _("Likes"),
"fieldname": "like_count",
"fieldtype": "Float",
"width": 100
},
{
"label": _("Dislikes"),
"fieldname": "dislike_count",
"fieldtype": "Float",
"width": 100
},
{
"label": _("Views"),
"fieldname": "view_count",
"fieldtype": "Float",
"width": 100
},
{
"label": _("Like:Dislike Ratio"),
"fieldname": "ratio",
"fieldtype": "Data",
"width": 100
}
]
def get_data():
return frappe.db.sql("""
SELECT
publish_date, title, provider,
view_count, like_count, dislike_count, comment_count
FROM `tabVideo`
WHERE view_count is not null
ORDER BY view_count desc""")