plexflow 0.0.103__py3-none-any.whl → 0.0.105__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  from typing import List
2
2
  from pydantic import BaseModel
3
3
  import subprocess
4
+ import re
4
5
 
5
6
  class SubtitleStream(BaseModel):
6
7
  class Config:
@@ -26,12 +27,16 @@ def get_subtitles(video_path: str) -> List[SubtitleStream]:
26
27
  )
27
28
  output = result.stderr.decode("utf-8")
28
29
 
30
+ pattern = re.compile(r'stream\s*#\d+:(\d+)\(([a-z]+)\):\s*subtitle', re.IGNORECASE | re.MULTILINE | re.UNICODE)
31
+
29
32
  subtitle_streams = []
30
- for line in output.splitlines():
31
- if "Stream #" in line and "Subtitle" in line:
32
- index = int(line.split("#")[1].split(":")[1].strip())
33
- language = line.split("(")[1].split(")")[0].strip()
34
- subtitle_streams.append(SubtitleStream(index=index, language=language))
33
+
34
+ matches = re.finditer(pattern, output)
35
+
36
+ for match in matches:
37
+ index = int(match.group(1))
38
+ language = match.group(2)
39
+ subtitle_streams.append(SubtitleStream(index=index, language=language))
35
40
 
36
41
  return subtitle_streams
37
42
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: plexflow
3
- Version: 0.0.103
3
+ Version: 0.0.105
4
4
  Summary: A short description of the package.
5
5
  License: MIT
6
6
  Keywords: keyword1,keyword2,keyword3
@@ -682,8 +682,8 @@ plexflow/utils/video/__pycache__/__init__.cpython-312.pyc,sha256=Kn1y-pxBX-xxS-z
682
682
  plexflow/utils/video/__pycache__/audio.cpython-312.pyc,sha256=vXBnJwWgTDFdixMBs-QJeeejwXQJ4wnXuG6oYqbqaSk,4497
683
683
  plexflow/utils/video/__pycache__/subtitle.cpython-312.pyc,sha256=PCjpCLydGXaRsQy6cikhgsEs8WlComfOoYPiLFqfVMA,2515
684
684
  plexflow/utils/video/audio.py,sha256=tJ_lNwcjVuBQYD5cYOlXpr__eh8-hnReIgNRgIYOpqo,3380
685
- plexflow/utils/video/subtitle.py,sha256=7QIVwWXzK5gxotwllv38AYa82SmboP0VkEnzJHPYveI,1290
686
- plexflow-0.0.103.dist-info/METADATA,sha256=RitiUKaDkYR66HFXjOh1aAI1J0T-cYOStbBMS3VIUck,3051
687
- plexflow-0.0.103.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
688
- plexflow-0.0.103.dist-info/entry_points.txt,sha256=uZc6ohXod3uudTgfeTqnkXBS4Cb7eajdjeqZc3P0PX4,1456
689
- plexflow-0.0.103.dist-info/RECORD,,
685
+ plexflow/utils/video/subtitle.py,sha256=qPvvBjlPj0fynJJvGJgGeKt9ey26R-cF6EoLaYt9iXU,1333
686
+ plexflow-0.0.105.dist-info/METADATA,sha256=Z5DAjgu1rNen2FLaQSgwxNDyAKTbp8hciqJ96nDyhW8,3051
687
+ plexflow-0.0.105.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
688
+ plexflow-0.0.105.dist-info/entry_points.txt,sha256=uZc6ohXod3uudTgfeTqnkXBS4Cb7eajdjeqZc3P0PX4,1456
689
+ plexflow-0.0.105.dist-info/RECORD,,