Skip to content

Instantly share code, notes, and snippets.

View zoharbabin's full-sized avatar
💭
dreaming, breaking, building

Zohar Babin zoharbabin

💭
dreaming, breaking, building
View GitHub Profile
@zoharbabin
zoharbabin / example_metadata.py
Created October 22, 2023 07:23
Create Custom Metadata Instance in Kaltura
from KalturaClient import KalturaClient
from KalturaClient.Base import KalturaConfiguration
from KalturaClient.Plugins.Metadata import KalturaMetadataObjectType, KalturaMetadata
from KalturaClient.Plugins.Core import KalturaMediaEntry, KalturaMediaType
import xml.etree.ElementTree as ET
# Initialize Kaltura configuration and client
config = KalturaConfiguration()
config.serviceUrl = "https://cdnapi-ev.kaltura.com/"
client = KalturaClient(config)
@zoharbabin
zoharbabin / config.json
Created October 20, 2023 17:08
Manage and create URI restricted Kaltura App Tokens with this utility, perfect for updating permissions
{
"PARTNER_ID": 0000,
"ADMIN_SECRET": "REPLACE_ME_KMC_SETTINGS_ADMIN_SECRET",
"SCRIPT_USER_ID": "kapptoken-mgr",
"ADMIN_SESSION_EXPIRY": 1800,
"KALTURA_SERVICE_URL": "https://cdnapi-ev.kaltura.com"
}
@zoharbabin
zoharbabin / gdrive2kaltura.py
Created October 10, 2023 23:35
Recursively migrate all media assets from Google Drive to Kaltura using Bulk Upload CSV
"""
Google Drive Media Extractor for Kaltura Upload:
This script processes a specified Google Drive folder to identify media files
(audio, video, and images) and produces a CSV file suitable for bulk upload
to the Kaltura platform. It recursively traverses through all subfolders,
captures metadata about the media files, and appends them to the CSV. Media
files are determined based on their MIME type.
Author Metadata:
05232023 Build Andrej Karpathy Session
Build 2023
Andrej Karpathy
Tuesday, May 23, 2023
ANDREJ KARPATHY: Hi, everyone. I’m happy to be here to tell you about the state of GPT. And more generally, about the rapidly growing ecosystem of large language models. So I would like to partition the talk into two parts.
In the first part, I would like to tell you about how we train GPT assistants. And then in the second part, we are going to take a look at how we can use these assistants effectively for your applications.
@zoharbabin
zoharbabin / kaltura_llama_esearch_object.py
Last active May 23, 2023 17:14
Sample code to use the LlamaIndex KalturaESearchReader - https://github.com/emptycrown/llama-hub/pull/286
import logging
import sys
from llama_index import (
download_loader,
GPTVectorStoreIndex,
LLMPredictor,
ServiceContext
)
from langchain.llms import OpenAI
from KalturaClient.Plugins.Core import KalturaMediaType
@zoharbabin
zoharbabin / llamaindex_kaltura_esearch_reader_example.py
Created May 20, 2023 20:49
An example use of the Kaltura eSearch Reader for LlamaIndex showing searching for list of Kaltura video entries, and querying ChatGPT against them
import logging
import sys
from llama_index import (
download_loader,
GPTVectorStoreIndex,
LLMPredictor,
ServiceContext,
PromptHelper,
load_index_from_storage,
StorageContext
This file has been truncated, but you can view the full file.
{
"basePath": "/api_v3",
"definitions": {
"KalturaABCScreenersWatermarkCondition": {
"allOf": [
{
"$ref": "#/definitions/KalturaCondition"
}
],
"properties": {},
This file has been truncated, but you can view the full file.
{
"openapi": "3.0.1",
"info": {
"title": "Kaltura Video Experience Cloud API",
"description": "Kaltura Media Services offers a feature-rich API for seamless integration of high-quality video streaming and management. It provides scalability, flexibility, and extensive customization options, empowering developers to build robust media-centric applications.",
"version": "19.4.0"
},
"servers": [
{
"url": "https://cdnapi-ev.kaltura.com/api_v3"
@zoharbabin
zoharbabin / convert-srt-to-transcript-txt.py
Created March 8, 2023 21:34
A python script to strip SRT captions file into a non-timed TXT transcript. Provided an SRT file as input, the script preserves the caption blocks structure in an SRT file input, while merging consecutive lines inside each caption block. Then, the script removes all SRT formatting, and produces a clean TXT file without line index markers, timing…
import sys
import re
def merge_lines(srt_file):
# Read in the SRT file
with open(srt_file, 'r') as f:
srt = f.read()
# Merge consecutive lines in each caption block
merged_srt = re.sub(r'\d+\n(\d\d:\d\d:\d\d,\d+ --> \d\d:\d\d:\d\d,\d+\n)?(.*?\n\n)', lambda match: match.group(2).replace('\n', ' ') + '\n', srt, flags=re.S)
<div style="position: relative; padding-bottom: 56.25%; padding-top: 25px; height: 0;"><iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" src="https://cdnapisec.kaltura.com/p/2539171/sp/253917100/embedIframeJs/uiconf_id/44037791/partner_id/2539171?iframeembed=true&amp;playerId=kaltura_player_1556142794&amp;entry_id=1_vqxvmjj6&amp;flashvars[streamerType]=auto" width="560" height="400" frameborder="0" allowfullscreen="allowfullscreen"></iframe></div>