Spaces:
Runtime error
Runtime error
Update parsers/__init__.py
Browse files- parsers/__init__.py +7 -81
parsers/__init__.py
CHANGED
|
@@ -1,89 +1,15 @@
|
|
|
|
|
| 1 |
"""
|
| 2 |
-
|
| 3 |
-
|
| 4 |
"""
|
| 5 |
|
| 6 |
-
|
| 7 |
-
from .fdx_parser import FDXParser, parse_fdx, Episode, Scene, ScriptElement
|
| 8 |
-
from .fdx_elements import (
|
| 9 |
-
# Enums
|
| 10 |
-
ElementType,
|
| 11 |
-
TimeOfDay,
|
| 12 |
-
LocationType,
|
| 13 |
-
|
| 14 |
-
# Clases de datos
|
| 15 |
-
CharacterExtension,
|
| 16 |
-
DialogueLine,
|
| 17 |
-
SceneHeading,
|
| 18 |
-
ActionLine,
|
| 19 |
-
SceneAnalysis,
|
| 20 |
-
EpisodeMetrics
|
| 21 |
-
)
|
| 22 |
|
| 23 |
-
# Definir qu茅 se exporta cuando se hace "from parsers import *"
|
| 24 |
__all__ = [
|
| 25 |
-
# Parser principal
|
| 26 |
'FDXParser',
|
| 27 |
-
'
|
| 28 |
-
|
| 29 |
-
# Clases de datos b谩sicas
|
| 30 |
-
'Episode',
|
| 31 |
-
'Scene',
|
| 32 |
-
'ScriptElement',
|
| 33 |
-
|
| 34 |
-
# Enums
|
| 35 |
-
'ElementType',
|
| 36 |
-
'TimeOfDay',
|
| 37 |
-
'LocationType',
|
| 38 |
-
|
| 39 |
-
# Clases de an谩lisis
|
| 40 |
-
'CharacterExtension',
|
| 41 |
-
'DialogueLine',
|
| 42 |
-
'SceneHeading',
|
| 43 |
-
'ActionLine',
|
| 44 |
-
'SceneAnalysis',
|
| 45 |
-
'EpisodeMetrics'
|
| 46 |
]
|
| 47 |
|
| 48 |
-
#
|
| 49 |
-
__version__ = '1.0
|
| 50 |
-
|
| 51 |
-
# Funci贸n de utilidad para verificar si un archivo es FDX
|
| 52 |
-
def is_fdx_file(filepath: str) -> bool:
|
| 53 |
-
"""
|
| 54 |
-
Verifica si un archivo es formato Final Draft
|
| 55 |
-
|
| 56 |
-
Args:
|
| 57 |
-
filepath: Ruta al archivo
|
| 58 |
-
|
| 59 |
-
Returns:
|
| 60 |
-
True si es archivo .fdx
|
| 61 |
-
"""
|
| 62 |
-
return filepath.lower().endswith('.fdx')
|
| 63 |
-
|
| 64 |
-
# Funci贸n helper para an谩lisis r谩pido
|
| 65 |
-
def quick_parse(filepath: str) -> dict:
|
| 66 |
-
"""
|
| 67 |
-
Hace un parsing r谩pido y retorna informaci贸n b谩sica
|
| 68 |
-
|
| 69 |
-
Args:
|
| 70 |
-
filepath: Ruta al archivo .fdx
|
| 71 |
-
|
| 72 |
-
Returns:
|
| 73 |
-
Dict con informaci贸n b谩sica del episodio
|
| 74 |
-
"""
|
| 75 |
-
try:
|
| 76 |
-
episode = parse_fdx(filepath)
|
| 77 |
-
return {
|
| 78 |
-
'title': episode.title,
|
| 79 |
-
'pages': episode.total_pages,
|
| 80 |
-
'scenes': len(episode.scenes),
|
| 81 |
-
'characters': len(episode.characters),
|
| 82 |
-
'locations': len(episode.locations),
|
| 83 |
-
'status': 'success'
|
| 84 |
-
}
|
| 85 |
-
except Exception as e:
|
| 86 |
-
return {
|
| 87 |
-
'status': 'error',
|
| 88 |
-
'error': str(e)
|
| 89 |
-
}
|
|
|
|
| 1 |
+
# parsers/__init__.py
|
| 2 |
"""
|
| 3 |
+
Parsers Module
|
| 4 |
+
Contains parsers for different script formats
|
| 5 |
"""
|
| 6 |
|
| 7 |
+
from .fdx_parser import FDXParser, parse_fdx_file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
|
|
|
| 9 |
__all__ = [
|
|
|
|
| 10 |
'FDXParser',
|
| 11 |
+
'parse_fdx_file'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
]
|
| 13 |
|
| 14 |
+
# Version info
|
| 15 |
+
__version__ = '0.1.0'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|