무비를 볼 때마다 임의의 자막을 만드는 파이썬 프로그램을 만들려고합니다. vlc.py 2.2 및 pysrt를 사용합니다. 파일을 만들고로드 할 필요없이 만든 자막을 전달하고 싶습니다.플레이어 pysrt 및 vlc의 파이썬 자막 내부
pysrt.SubRipItems는 inspect.getargspec() 함수는 나에게주는, 클래스 등의 목록은 다음과 같습니다
1
00:00:00,100 --> 00:02:18,828
Hello World!
및 유형() :
ArgSpec(args=['self', 'index', 'start', 'end', 'text', 'position'], varargs=None, keywords=None, defaults=(0, None, None, '', ''))
인쇄()가 나와 있습니다 :
class 'str'
자막이 나타나지 않으며 오류가 없습니다.
import vlc
import pysrt
import inspect
file = pysrt.SubRipFile(encoding='utf-8')
sub = pysrt.SubRipItem(1, start='00:00:0,100', end='00:02:18,828', text="Hello World!")
file.append(sub)
SubString=str(file[0])
print(SubString)
print (type(SubString))
print (inspect.getargspec(pysrt.SubRipItem))
Instance = vlc.Instance()
player = Instance.media_player_new()
Media = Instance.media_new('Test.avi')
player.set_media(Media)
player.play()
player.video_set_subtitle_file(SubString)