Skip to content

Commit

Permalink
Change the interface to default to non-generated names
Browse files Browse the repository at this point in the history
  • Loading branch information
aMarcireau committed Jul 31, 2023
1 parent b187a8f commit ca8494c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 44 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ It supports Python 3.9, 3.10, and 3.11.
│ ├── ...
│ └── file_n.es
├── renders
│ ├── adjective-animal-1
│ ├── file_1
│ │ ├── filtered-recording.es
│ │ ├── rendered-file-1.es
│ │ ├── ...
│ │ └── rendered-file-m.es
│ ├── adjective-animal-2
│ ├── file_2
│ ├── ...
│ └── adjective-animal-n
│ └── file_n
└── charidotella-configuration.toml
```
Expand Down
70 changes: 30 additions & 40 deletions charidotella/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ def main():
help="Replace the configuration if it exists",
)
init_parser.add_argument(
"--preserve-names",
"-p",
"--generate-names",
"-g",
action="store_true",
help="Do not generate new names for the recordings",
help="Generate new names (adjective + animal) for the recordings",
)
init_parser.add_argument(
"--spatiospectrograms",
Expand Down Expand Up @@ -340,7 +340,9 @@ def run_generators(configuration: dict[str, typing.Any]):
paths.sort(key=lambda path: (path.stem, path.parent))
if len(paths) == 0:
utilities.error(f'no .es files match "{args.glob}"')
if args.preserve_names:
if args.generate_names:
names = animals.generate_names(len(paths))
else:
names = sorted([path.stem for path in paths])
if len(names) != len(set(names)):
name_to_path: dict[str, pathlib.Path] = {}
Expand All @@ -350,8 +352,6 @@ def run_generators(configuration: dict[str, typing.Any]):
f'two files have the same name ("{name_to_path[path.stem]}" and "{path}"), rename one or do *not* use the flag --preserve-name'
)
name_to_path[path.stem] = path
else:
names = animals.generate_names(len(paths))
attachments: dict[str, list[dict[str, str]]] = {}
for name, path in zip(names, paths):
for sibling in path.parent.iterdir():
Expand Down Expand Up @@ -561,7 +561,7 @@ def run_generators(configuration: dict[str, typing.Any]):
"times": 1000,
"gamma": 0.5,
},
"video-real-time": {
"video-1x": {
"type": "video",
"icon": "🎬",
"frametime": utilities.timestamp_to_timecode(20000),
Expand All @@ -576,7 +576,7 @@ def run_generators(configuration: dict[str, typing.Any]):
"ffmpeg": "ffmpeg",
"scale": 1,
},
"video-slow-motion": {
"video-0.1x": {
"type": "video",
"icon": "🎬",
"frametime": utilities.timestamp_to_timecode(2000),
Expand All @@ -591,6 +591,23 @@ def run_generators(configuration: dict[str, typing.Any]):
"ffmpeg": "ffmpeg",
"scale": 1,
},
"wiggle": {
"type": "wiggle",
"icon": "👋",
"forward_duration": utilities.timestamp_to_timecode(
1000000
),
"tau_to_frametime_ratio": 3.0,
"style": "cumulative",
"idle_color": "#191919",
"on_color": "#F4C20D",
"off_color": "#1E88E5",
"idle_color": "#191919",
"cumulative_ratio": 0.01,
"timecode": True,
"ffmpeg": "ffmpeg",
"scale": 1,
},
},
},
configuration_file,
Expand Down Expand Up @@ -620,14 +637,14 @@ def run_generators(configuration: dict[str, typing.Any]):
},
{
"parameters": {
"suffix": ["100000-10000", "1000-100"],
"suffix": ["100000-10000", "10000-1000"],
"long_tau": [
utilities.timestamp_to_timecode(100000),
utilities.timestamp_to_timecode(1000),
utilities.timestamp_to_timecode(10000),
],
"short_tau": [
utilities.timestamp_to_timecode(10000),
utilities.timestamp_to_timecode(100),
utilities.timestamp_to_timecode(1000),
],
},
"template": {
Expand All @@ -645,33 +662,6 @@ def run_generators(configuration: dict[str, typing.Any]):
"height": 720,
},
},
{
"parameters": {
"suffix": ["4s", "2s", "1s", "0.5s"],
"forward_duration": [
utilities.timestamp_to_timecode(2000000),
utilities.timestamp_to_timecode(1000000),
utilities.timestamp_to_timecode(500000),
utilities.timestamp_to_timecode(250000),
],
},
"template": {
"name": "wiggle-@suffix",
"type": "wiggle",
"icon": "👋",
"forward_duration": "@raw(forward_duration)",
"tau_to_frametime_ratio": 3.0,
"style": "cumulative",
"idle_color": "#191919",
"on_color": "#F4C20D",
"off_color": "#1E88E5",
"idle_color": "#191919",
"cumulative_ratio": 0.01,
"timecode": True,
"ffmpeg": "ffmpeg",
"scale": 1,
},
},
]
},
configuration_file,
Expand Down Expand Up @@ -719,8 +709,8 @@ def run_generators(configuration: dict[str, typing.Any]):
"colourtime-.+",
"event-rate-.+",
"spectrogram",
"wiggle-.+",
"video-real-time",
"wiggle",
"video-1x",
]
+ (
["spatiospectrogram"]
Expand Down
2 changes: 1 addition & 1 deletion charidotella/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.0"
__version__ = "2.0.0"

0 comments on commit ca8494c

Please sign in to comment.