diff --git a/src/streamer/__init__.py b/src/streamer/__init__.py index 9c64032..0d2a52e 100644 --- a/src/streamer/__init__.py +++ b/src/streamer/__init__.py @@ -59,7 +59,7 @@ def new() -> None: parsed_content = parse_markdown_file(prelimary_path, content) final_file_name = f"{timestamp}.md" - if parsed_content.shard and len(markers := parsed_content.shard.markers): + if len(markers := parsed_content.shard.markers): final_file_name = f"{timestamp} {' '.join(markers)}.md" final_path = os.path.join(streamer_directory, final_file_name) diff --git a/src/streamer/localize/__init__.py b/src/streamer/localize/__init__.py new file mode 100644 index 0000000..3b3380e --- /dev/null +++ b/src/streamer/localize/__init__.py @@ -0,0 +1,11 @@ +from .localize import localize_stream_file +from .repostory_configuration import RepositoryConfiguration +from .localized_shard import LocalizedShard + +__all__ = [ + "Dimension", + "Marker", + "RepositoryConfiguration", + "localize_stream_file", + "LocalizedShard", +] diff --git a/src/streamer/localize/extract_datetime.py b/src/streamer/localize/extract_datetime.py new file mode 100644 index 0000000..28012d7 --- /dev/null +++ b/src/streamer/localize/extract_datetime.py @@ -0,0 +1,21 @@ +from datetime import datetime +import re +import os +from typing import Optional + + +def extract_date_from_file_name(file_name: str) -> Optional[datetime]: + FILE_NAME_REGEX = r"^(?P\d{8})(?:-(?P