Skip to content

Commit

Permalink
Use more ISO-like timestamp format, separating each datetime's fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jun 23, 2021
1 parent 590a9c8 commit 926a42b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ in progress
- Remove ``recording_`` prefix from recorded file name. Thanks, Weef.
- Improve spool subdirectory hierarchy to reduce the number of files per directory. Thanks, Michael.
The new scheme is ``/var/spool/saraswati/{year}/{month:02d}/{day:02d}/{channel}/{timestamp}_{channel}_{fragment:04d}.mka``.

- Use more ISO-like timestamp format, separating each datetime's fragments.
Currently, ``%Y-%m-%dT%H-%M-%S%z`` is used.


2021-06-22 0.4.2
Expand Down
7 changes: 5 additions & 2 deletions saraswati/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import shutil
import threading
from functools import partial
from pathlib import Path
from typing import List

import gi
Expand Down Expand Up @@ -250,8 +251,10 @@ def on_format_location(self, splitmux, fragment_id, user_data):
# print('tag:', splitmux.parse_tag())

# Compute current timestamp (now) in ISO format, using UTC, with timezone offset
# timestamp_format = '%Y-%m-%dT%H-%M-%S%z'
timestamp_format = "%Y%m%dT%H%M%S%z"
# TODO: Refactor to `model.py` / make it configurable.
#timestamp_format = "%Y-%m-%dT%H:%M:%S%z"
timestamp_format = "%Y-%m-%dT%H-%M-%S%z"
# timestamp_format = "%Y%m%dT%H%M%S%z"
now = datetime.utcnow().replace(tzinfo=pytz.utc)
# now = datetime.now().replace(tzinfo=pytz.timezone('Europe/Berlin'))
timestamp = now.strftime(timestamp_format)
Expand Down

0 comments on commit 926a42b

Please sign in to comment.