NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

def adding_caption(project_id,job_id,username,input_video,font_key):
project = get_object_or_404(Project, id=project_id)
image = Project_Image.objects.filter(job_id=job_id).first()

if image:
text=image.caption
else:
text='None'
caption_position=image.caption_position
styles=image.caption_styles
caption_font_weight=styles.get('font_weight')
caption_font_family=styles.get('font_family')
caption_font_style=styles.get('font_style')
caption_text_decoration=styles.get('text_decoration')
caption_font_color=styles.get('color')

# {"font_family": "Arial", "font_weight": "normal", "font_style": "normal", "text_decoration": "none", "color": "#000000"}

print("input video path========",input_video)
# input_video=f"media/videos/{username}/video_{job_id}.mp4"
watermark_logo = branded_details.objects.filter(Project_Image=project).first()
if watermark_logo:
logo = watermark_logo.Company_Logo.path
company_name = watermark_logo.Company_name
else:
logo=None
company_name=None

data = {
"text": text,
"font_name": font_key, # matches FastAPI param
"company_name": company_name,
"caption_position":caption_position,
"caption_font_weight":caption_font_weight,
"caption_font_family":caption_font_family,
"caption_font_style":caption_font_style,
"caption_text_decoration":caption_text_decoration,
"caption_font_color":caption_font_color
}

print("data for adding caption -------",data)
# -------- FILES --------
files = {
"video": (
os.path.basename(input_video),
open(input_video, "rb"),
"video/mp4"
)
}
print("data for caption ----",data)
if logo and os.path.exists(logo):
files["logo"] = (
os.path.basename(logo),
open(logo, "rb"),
"image/png"
)
print("files for data-----------",files)
response = requests.post(
FASTAPI_TEXT_VIDEO_URL,
data=data,
files=files,
timeout=1500
)
print("post request compleated ===========")
response.raise_for_status()
os.makedirs(os.path.dirname(input_video), exist_ok=True)

with open(input_video, "wb") as f:
for chunk in response.iter_content(chunk_size=8192):
if chunk:
f.write(chunk)

return input_video
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.