Browse Source

YouTube ID を外部に

btc-sounds
みてるぞ 1 year ago
parent
commit
bbfb8c97fe
4 changed files with 18 additions and 4 deletions
  1. +1
    -1
      .gitignore
  2. +13
    -0
      common_module.py
  3. +2
    -3
      main.py
  4. +2
    -0
      youtube.sample.py

+ 1
- 1
.gitignore View File

@@ -1,4 +1,4 @@
/connection.py
/__pycache__
/nizika_talking.wav
/youtube.py

+ 13
- 0
common_module.py View File

@@ -0,0 +1,13 @@
import unicodedata


class CommonModule:
@staticmethod
def is_wide (c: str) -> bool:
return unicodedata.east_asian_width (c) in ['F', 'W', 'A']

@classmethod
def string_width_per_pt (cls, string: str) -> float:
return sum ([1 if cls.is_wide (c) else .5
for c in string.decode ('utf-8')])


+ 2
- 3
main.py View File

@@ -8,9 +8,8 @@ from talk import Talk
import subprocess
from aques import Aques
from playsound import playsound


YOUTUBE_ID: str = 'Q0kSYNcu5Xk'
from common_module import CommonModule
from youtube import *


class Main:


+ 2
- 0
youtube.sample.py View File

@@ -0,0 +1,2 @@
YOUTUBE_ID: str = 'XXXXXXXXXXX'


Loading…
Cancel
Save