Phoe2004 commited on
Commit
8009580
Β·
verified Β·
1 Parent(s): e572ac3

Upload 3 files

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. Dockerfile +4 -4
  3. NamKhoneUnicode.ttf +3 -0
  4. app.py +5 -5
.gitattributes CHANGED
@@ -1 +1,2 @@
1
  NotoSansMyanmar-Bold.ttf filter=lfs diff=lfs merge=lfs -text
 
 
1
  NotoSansMyanmar-Bold.ttf filter=lfs diff=lfs merge=lfs -text
2
+ NamKhoneUnicode.ttf filter=lfs diff=lfs merge=lfs -text
Dockerfile CHANGED
@@ -30,16 +30,16 @@ RUN pip install --no-cache-dir -U "yt-dlp[default]"
30
  COPY app.py .
31
  COPY bot.py .
32
  COPY index.html .
33
- COPY NotoSansMyanmar-Bold.ttf .
34
  COPY m_youtube_com_cookies.txt .
35
  COPY start.sh .
36
  RUN chmod +x start.sh
37
 
38
- # Install NotoSansMyanmar font to system so libass/ffmpeg can find it
39
  RUN mkdir -p /usr/local/share/fonts/myanmar \
40
- && cp /app/NotoSansMyanmar-Bold.ttf /usr/local/share/fonts/myanmar/ \
41
  && fc-cache -fv \
42
- && fc-list | grep -i myanmar || true
43
 
44
  RUN mkdir -p outputs
45
 
 
30
  COPY app.py .
31
  COPY bot.py .
32
  COPY index.html .
33
+ COPY NamKhoneUnicode.ttf .
34
  COPY m_youtube_com_cookies.txt .
35
  COPY start.sh .
36
  RUN chmod +x start.sh
37
 
38
+ # Install NamKhoneUnicode font to system so libass/ffmpeg can find it
39
  RUN mkdir -p /usr/local/share/fonts/myanmar \
40
+ && cp /app/NamKhoneUnicode.ttf /usr/local/share/fonts/myanmar/ \
41
  && fc-cache -fv \
42
+ && fc-list | grep -i namkhone || true
43
 
44
  RUN mkdir -p outputs
45
 
NamKhoneUnicode.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:efcedb30bb7d2b326b590e0a136e2f481a3c376500387ad4f8583db45e1becbb
3
+ size 533164
app.py CHANGED
@@ -1003,7 +1003,7 @@ def _fix_mid_sync(audio_path, video_dur, audio_dur, tmp_dir):
1003
  # ══════════════════════════════════════════════
1004
  # SUBTITLE ASS GENERATOR
1005
  # ══════════════════════════════════════════════
1006
- MYANMAR_FONT_PATH = str(BASE_DIR / 'NotoSansMyanmar-Bold.ttf')
1007
 
1008
  def _generate_ass_subtitle(script, ass_path, sub_lang='my',
1009
  fontsize=52, canvas_w=720, canvas_h=1280,
@@ -1011,7 +1011,7 @@ def _generate_ass_subtitle(script, ass_path, sub_lang='my',
1011
  sub_x=0, sub_y=0, sub_w=0, sub_h=0):
1012
  ALIGN_MAP = {2: 2} # bottom-center default
1013
  alignment = 2
1014
- font_name = 'Noto Sans Myanmar' if sub_lang == 'my' else 'Arial'
1015
 
1016
  def _hex_to_ass(h):
1017
  h = h.lstrip('#')
@@ -1094,9 +1094,9 @@ def _generate_ass_timed(script, ass_path, timings, sub_lang='my',
1094
  color='#FFFFFF', outline=3,
1095
  sub_x=0, sub_y=0, sub_w=0, sub_h=0):
1096
  """Generate ASS subtitle β€” Python pre-wraps lines to fit 80% canvas width."""
1097
- # Font name matches fc-list output after Dockerfile fc-cache
1098
  if sub_lang == 'my' and os.path.exists(MYANMAR_FONT_PATH):
1099
- font_name = 'Noto Sans Myanmar'
1100
  else:
1101
  font_name = 'Arial'
1102
 
@@ -1305,7 +1305,7 @@ def _build_video(vpath, cmb, mpath, ad, vd, crop, flip, col, wmk, out_file,
1305
  def _esc_ff(p):
1306
  return p.replace('\\', '/').replace(':', '\\:').replace("'", "\\'")
1307
  # Custom fonts.conf β€” only Myanmar font dir, bypasses system DejaVu priority
1308
- fc_dir = '/usr/local/share/fonts/myanmar'
1309
  fc_conf = f'{tmp_dir}/fonts.conf'
1310
  fc_cache = f'{tmp_dir}/fc_cache'
1311
  os.makedirs(fc_cache, exist_ok=True)
 
1003
  # ══════════════════════════════════════════════
1004
  # SUBTITLE ASS GENERATOR
1005
  # ══════════════════════════════════════════════
1006
+ MYANMAR_FONT_PATH = str(BASE_DIR / 'NamKhoneUnicode.ttf')
1007
 
1008
  def _generate_ass_subtitle(script, ass_path, sub_lang='my',
1009
  fontsize=52, canvas_w=720, canvas_h=1280,
 
1011
  sub_x=0, sub_y=0, sub_w=0, sub_h=0):
1012
  ALIGN_MAP = {2: 2} # bottom-center default
1013
  alignment = 2
1014
+ font_name = 'NamKhoneUnicode' if sub_lang == 'my' else 'Arial'
1015
 
1016
  def _hex_to_ass(h):
1017
  h = h.lstrip('#')
 
1094
  color='#FFFFFF', outline=3,
1095
  sub_x=0, sub_y=0, sub_w=0, sub_h=0):
1096
  """Generate ASS subtitle β€” Python pre-wraps lines to fit 80% canvas width."""
1097
+ # Font name matches TTF internal name
1098
  if sub_lang == 'my' and os.path.exists(MYANMAR_FONT_PATH):
1099
+ font_name = 'NamKhoneUnicode'
1100
  else:
1101
  font_name = 'Arial'
1102
 
 
1305
  def _esc_ff(p):
1306
  return p.replace('\\', '/').replace(':', '\\:').replace("'", "\\'")
1307
  # Custom fonts.conf β€” only Myanmar font dir, bypasses system DejaVu priority
1308
+ fc_dir = str(BASE_DIR) # NamKhoneUnicode.ttf is in /app
1309
  fc_conf = f'{tmp_dir}/fonts.conf'
1310
  fc_cache = f'{tmp_dir}/fc_cache'
1311
  os.makedirs(fc_cache, exist_ok=True)