fli_video 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/klues/add_episode.klue +25 -0
  3. data/.builders/klues/change_chapter_name.klue +32 -0
  4. data/.builders/klues/create_chapter_video.klue +34 -0
  5. data/.builders/klues/create_project.klue +37 -0
  6. data/.builders/klues/empty_trash.klue +24 -0
  7. data/.builders/klues/episode_path.klue +77 -0
  8. data/.builders/klues/global_config.klue +31 -0
  9. data/.builders/klues/move_ecamm_file.klue +21 -0
  10. data/.builders/klues/move_to_trash.klue +29 -0
  11. data/.builders/klues/open_in_finder.klue +25 -0
  12. data/.builders/klues/project_config.klue +123 -0
  13. data/.builders/klues/project_meta_data_store.klue +28 -0
  14. data/.builders/klues/project_path.klue +77 -0
  15. data/.builders/klues/recording_file_watcher.klue +28 -0
  16. data/.builders/klues/recording_filename.klue +112 -0
  17. data/.builders/klues/restore_from_trash.klue +29 -0
  18. data/.builders/klues/switch_focus.klue +24 -0
  19. data/.builders/klues/text_to_speech.klue +29 -0
  20. data/.builders/klues/transcript_data_store.klue +28 -0
  21. data/.rubocop.yml +2 -0
  22. data/CHANGELOG.md +18 -0
  23. data/README.md +13 -20
  24. data/bin/fli_video +6 -0
  25. data/docs/feature-list.md +75 -0
  26. data/docs/generated/application-structure.json +57 -0
  27. data/docs/generated/features-and-components.md +987 -0
  28. data/docs/generated/technical-design-and-features.md +420 -0
  29. data/docs/technical-specifications.md +347 -0
  30. data/fli.rb +138 -0
  31. data/lib/fli_video/cli.rb +30 -0
  32. data/lib/fli_video/version.rb +1 -1
  33. data/package-lock.json +2 -2
  34. data/package.json +1 -1
  35. data/scripts/01-get-structure.rb +84 -0
  36. data/scripts/02-get-features-and-components.rb +38 -0
  37. data/scripts/03-get-technical-design-and-features.rb +27 -0
  38. metadata +32 -3
  39. data/README-features.md +0 -36
@@ -0,0 +1,987 @@
1
+ ## Features
2
+
3
+ ### Feature <-> DSL GPTs
4
+ https://chat.openai.com/g/g-AyFi0UOXn-code-simplifier
5
+
6
+ **Read Global Configuration**
7
+ Access and apply global configuration settings for video asset management and state consistency.
8
+
9
+ **Project Configuration**
10
+ Access and apply video or episode settings and state.
11
+
12
+ **FileWatch Processor for File Event Commands**
13
+ Utilize a FileWatch processor to automate file event responses, directing new recordings to designated folders for efficient content management.
14
+
15
+ **Create Project**
16
+ Setup a new video project for standalone YouTube video or Podcast.
17
+
18
+ **Add Episode**
19
+ Add a new episode to an existing podcast project.
20
+
21
+ **Switch Video Focus**
22
+ Easily switch between different video projects or episodes to accommodate changing content priorities.
23
+
24
+ **Move eCamm File**
25
+ Seamlessly transfer eCamm recordings to the current focused video or podcast episode recordings subfolder.
26
+
27
+ **Project Path**
28
+ Construct and manage project paths dynamically using configurable values and existing folder name segments.
29
+
30
+ **Episode Path**
31
+ Construct and manage episode paths dynamically using configurable values and existing folder name segments.
32
+
33
+ **Recording Namer**
34
+ Dynamically generate and update video recording filenames, incorporating chapter and part sequences, chapter names, and tags, with capabilities to modify chapter sequences and tags for improved organization and content identification.
35
+
36
+ **Change Chapter Name**
37
+ Alter the name of a chapter based on its sequence in the project, facilitating better organization and identification of video content.
38
+
39
+ **Trash**
40
+ Moves suboptimal video takes to a designated 'trash' or 'archive' folder, optimizing storage and maintaining project clarity by segregating lesser-quality content.
41
+
42
+ **Trash Undo**
43
+ Retrieves video takes from the '.trash' folder and moves them back into the target project folder, allowing for reconsideration or re-evaluation of previously discarded content.
44
+
45
+ **Clean Trash**
46
+ Permanently deletes video takes from the 'trash' or 'archive' folder, freeing up storage space and ensuring project clarity.
47
+
48
+ **Open in Finder**
49
+ Quickly access video project and episode folders within the Finder, streamlining file navigation.
50
+
51
+ **Create Chapter Video**
52
+ Combine and review video chapter segments independently, facilitating content evaluation and editing.
53
+
54
+ **Text to Speech**
55
+ Transcribe spoken content to text and store transcriptions folder in multiple transcription formats.
56
+
57
+ Create a DSL using the interactor pattern for:
58
+
59
+ **Transcript Data Store**
60
+ Builds a JSON datastore of transcripts for an entire project based on existing transcript folders found within project, episode, recording, chapter and post-produced folders.
61
+
62
+ **Project Meta Data Store**
63
+ Build a JSON datastore of files for an entire project based on existing project, episode, recording, chapter and post-produced folders and infer metadata based on KEYWORDS, transcripts or other useful data.
64
+
65
+ ## Future Ideas
66
+
67
+ **CLI Project Management Interface**
68
+ Efficiently execute and manage video project commands using a command-line interface, enhancing control and flexibility in project handling.
69
+
70
+ **Web Command Interface for Video Project Management**
71
+ Introduce a streamlined, web-based interface for managing video project commands, enabling efficient control and organization of project components through simple browser interactions.
72
+
73
+ **Project Meta Report**
74
+ Generate a detailed report for a specific video project, including the episodes, chapters, recordings, a list of recording IDs (chapter sequence + part sequence), and the name for the next video recording, file sizes.
75
+ This should be extracted to an AstroJS Website or HTML template servered by a local webserver and provide viewing and navigation for all my video projects.
76
+
77
+
78
+ ## Klue Components
79
+
80
+ Klue Component: `add_episode.klue`
81
+
82
+ ```ruby
83
+ component :add_episode do
84
+ desc "Add a new episode to an existing podcast project."
85
+
86
+ pattern "Interactor"
87
+
88
+ comments <<~TEXT
89
+ - Facilitates the addition of a new episode to a specific podcast project.
90
+ - Requires the project code of the podcast to ensure correct association.
91
+ - Allows setting of episode-specific details like episode code and name.
92
+ - Ensures that the episode is added only to podcast projects and not to other project types.
93
+ - Will create recording, chapter and support folders for the episode.
94
+ TEXT
95
+
96
+ method :run(:project_code, :episode_code, :episode_name)
97
+
98
+ sample :add_episode_to_podcast, <<~RUBY
99
+ # Add a new episode to existing podcast folder
100
+ add_episode.run('a21', '01', 'Episode About Something')
101
+ # Create:
102
+ # ~/video-projects/a21-ac-some-podcast/01-episode-about-something/assets
103
+ # ~/video-projects/a21-ac-some-podcast/01-episode-about-something/chapters
104
+ # ~/video-projects/a21-ac-some-podcast/01-episode-about-something/recordings
105
+ # ~/video-projects/a21-ac-some-podcast/01-episode-about-something/.trash
106
+ RUBY
107
+ end
108
+ ```
109
+
110
+ Klue Component: `change_chapter_name.klue`
111
+
112
+ ```ruby
113
+ component :change_chapter_name do
114
+ desc "Alter the name of a chapter based on its sequence in the project, facilitating better organization and identification of video content."
115
+
116
+ pattern "Command"
117
+ note "This should be a method on the project"
118
+
119
+ comments <<~TEXT
120
+ - Allows the renaming of a chapter within a video project.
121
+ - Utilizes the chapter's sequence number to identify and target the specific chapter for renaming.
122
+ TEXT
123
+
124
+ method :rename_chapter(:parent, :chapter_sequence, :new_name)
125
+
126
+ <<~FILE_SYSTEM
127
+ 01-a-introduction-GPTIMPROVE.mov
128
+ 01-b-introduction-more-content.mov
129
+ 01-c-introduction.mov
130
+ 01-d-introduction-CTA.mov
131
+ 02-a-overview.mov
132
+ 03-a-scenario-TITLE.mov
133
+ FILE_SYSTEM
134
+
135
+ sample :change_chapter_name_in_project, <<~RUBY
136
+ # Example of changing the name of a specific chapter in a project
137
+ change_chapter_name.rename_chapter('a27', '01', 'intro')
138
+
139
+ # 01-a-intro-GPTIMPROVE.mov
140
+ # 01-b-intro.mov
141
+ # 01-c-intro.mov
142
+ # 01-d-intro-CTA.mov
143
+ RUBY
144
+ end
145
+ ```
146
+
147
+ Klue Component: `create_chapter_video.klue`
148
+
149
+ ```ruby
150
+ component :create_chapter_video do
151
+ desc "Combine and all video parts for a chapter sequence and put into the chapters folder."
152
+
153
+ pattern "Command"
154
+
155
+ comments <<~TEXT
156
+ - Combines individual video segments into a single chapter video.
157
+ - Facilitates independent review and editing of each chapter.
158
+ TEXT
159
+
160
+ constructor(:parent_project)
161
+
162
+ method :run(:chapter_seq)
163
+
164
+ sample :create_chapter_video, <<~RUBY
165
+ project_path = ProjectPath.new('a27')
166
+
167
+ # Instantiate the component with the parent project
168
+ create_chapter_video = generate_chapter_video.new(project_path)
169
+
170
+ # Automatically combine all video segments for a chapter
171
+ create_chapter_video.run(1)
172
+ # Output: '~/video-projects/a27-ac-some-podcast/chapters/01-complete-chapter.mov'
173
+ RUBY
174
+
175
+ sample :create_chapter_video_for_segments, <<~RUBY
176
+ project_path = ProjectPath.new('a27')
177
+
178
+ create_chapter_video = generate_chapter_video.new(project_path)
179
+
180
+ create_chapter_video.run(1, ['01-intro-a.mov', '02-intro-b.mov'], output_file_name: '01-intro-custom.mov')
181
+ # Output: '~/video-projects/a27-ac-some-podcast/chapters/01-intro-custom.mov'
182
+ RUBY
183
+ end
184
+ ```
185
+
186
+ Klue Component: `create_project.klue`
187
+
188
+ ```ruby
189
+ component :create_project do
190
+ desc "Setup a new video project for standalone YouTube video or Podcast."
191
+
192
+ pattern "Interactor"
193
+
194
+ comments <<~TEXT
195
+ - Allows the creation of a new project, specifying if it's for a YouTube video or a Podcast.
196
+ - For YouTube videos, the project will be single-episode based.
197
+ - For Podcasts, the project can include multiple episodes.
198
+ - Stores project-specific settings and metadata.
199
+ - Will create recording, chapter and support folders for project_type: video
200
+ TEXT
201
+
202
+ enum :project_type, %w(video podcast)
203
+
204
+ method :run(:project_type, :project_code, :channel_code, :project_name)
205
+
206
+ sample :new_video_project, <<~RUBY
207
+ # Create a new video project for AppyDave
208
+ create_project.run(:video, 'a20', 'ad', 'Some Video')
209
+ # Create:
210
+ # ~/video-projects/a20-ad-some-video
211
+ # ~/video-projects/a20-ad-some-video/.fv.json
212
+ # ~/video-projects/a20-ad-some-video/assets
213
+ # ~/video-projects/a20-ad-some-video/chapters
214
+ # ~/video-projects/a20-ad-some-video/recordings
215
+ # ~/video-projects/a20-ad-some-video/.trash
216
+ RUBY
217
+
218
+ sample :new_podcast_project, <<~RUBY
219
+ # Create a new podcast project for AppyCast
220
+ create_project.run(:podcast, 'a21', 'ac', 'Some Podcast')
221
+ # Creates folder:
222
+ # ~/video-projects/a21-ac-some-podcast
223
+ # ~/video-projects/a21-ac-some-podcast/.fv.json
224
+ RUBY
225
+ end
226
+ ```
227
+
228
+ Klue Component: `empty_trash.klue`
229
+
230
+ ```ruby
231
+ component :empty_trash do
232
+ desc "Permanently delete video takes from the '.trash' folder."
233
+
234
+ pattern "Command"
235
+
236
+ comments <<~TEXT
237
+ - Permanently removes all recordings from the trash folder.
238
+ - Frees up storage space by deleting unnecessary files.
239
+ - Maintains project clarity by clearing clutter.
240
+ - Ensures that only unwanted takes are deleted after a final review.
241
+ TEXT
242
+
243
+ constructor(:parent_project)
244
+
245
+ method :run
246
+
247
+ sample :permanently_delete_trash, <<~RUBY
248
+ project_path = ProjectPath.new('a27')
249
+
250
+ # Permanently deleting all contents of the trash folder
251
+ clean_trash.empty_trash
252
+ # Empties the entire .trash folder in "~/video-projects/a27-ac-categorize-mp4-CI/.trash/
253
+ RUBY
254
+ end
255
+ ```
256
+
257
+ Klue Component: `episode_path.klue`
258
+
259
+ ```ruby
260
+ component :episode_path do
261
+ desc "Construct episode path using project/episode code and deducing state based on existing folder name."
262
+
263
+ pattern "Adapter"
264
+
265
+ comments <<~TEXT
266
+ - Infers episode path based on episode code and existing folder name.
267
+ - Maintains state for episode code and descriptive name and keywords.
268
+ - Will use current project code if not provided.
269
+ - Path is relative to project path.
270
+ - Uses existing folder name and keywords to build internal state.
271
+ - Provides method for building absolute, relative and sub folder.
272
+ - Provides method for building a new path for rename operations.
273
+ - Provides access to associated project.
274
+ - Stores state in an internal data object.
275
+ - Designed for building folder names, not create or modify actual directories.
276
+ TEXT
277
+
278
+ accessors :episode_code, :episode_name, :keywords, :episode_path, :project
279
+
280
+ method :constructor(:episode_code, episode_name: nil, keywords: nil, project_code: nil)
281
+ method :instance(:folder)
282
+
283
+ method :change_path(episode_code: nil, episode_name: nil, keywords: nil)
284
+
285
+ # project_path.recording_path # => "~/video-projects/a27-ac-categorize-mp4-CI/recordings"
286
+ # ~/video-projects/a27-ac-categorize-mp4-CI/01-flivideo-project-kickoff-TODO/recordings
287
+
288
+ sample :create_episode_path, <<~RUBY
289
+ # Create a new episode path
290
+ episode_path = EpisodePath.new('01', episode_name: 'flivideo-project-kickoff', keywords: ['TODO'] )
291
+ episode_path.episode_path # => "~/video-projects/a27-ac-categorize-mp4-CI/01-flivideo-project-kickoff-TODO"
292
+ episode_path.episode_code # => "01"
293
+ episode_path.episode_name # => "flivideo-project-kickoff"
294
+ episode_path.keywords # => ["TODO"]
295
+
296
+ project_path = episode_path.project
297
+ project_path.project_path # => "~/video-projects/a27-ac-categorize-mp4-CI"
298
+ RUBY
299
+
300
+ sample :infer_episode_path, <<~RUBY
301
+ # Infer episode path based on episode code and existing folder
302
+ episode_path = EpisodePath.new('01')
303
+ episode_path.episode_path # => "~/video-projects/a27-ac-categorize-mp4-CI/01-flivideo-project-kickoff-TODO"
304
+ episode_path.episode_code # => "01"
305
+ episode_path.episode_name # => "flivideo-project-kickoff"
306
+ episode_path.keywords # => ["TODO"]
307
+
308
+ RUBY
309
+
310
+ sample :rename_episode_path, <<~RUBY
311
+ # Rename episode path
312
+ episode1 = EpisodePath.new('01')
313
+ episode1.episode_path # => "~/video-projects/a27-ac-categorize-mp4-CI/01-flivideo-project-kickoff-TODO"
314
+
315
+ episode2 = episode1.change_path(episode_code: '02')
316
+ episode2.episode_path # => "~/video-projects/a27-ac-categorize-mp4-CI/02-flivideo-project-kickoff-TODO"
317
+
318
+ episode3 = episode1.change_path(episode_code: '03', episode_name: 'build-gpts', keywords: [])
319
+ episode3.episode_path # => "~/video-projects/a27-ac-categorize-mp4-CI/03-build-gpts"
320
+ RUBY
321
+
322
+ sample :next_episode_code, <<~RUBY
323
+ # Get next episode code
324
+ episode_path = EpisodePath.new('01')
325
+ episode_path.next_episode_code # => "02"
326
+ RUBY
327
+
328
+ sample :folder_to_episode_path, <<~RUBY
329
+ # Convert folder to episode path
330
+ episode_path = EpisodePath.instance('~/video-projects/a27-ac-categorize-mp4-CI/01-flivideo-project-kickoff-TODO')
331
+ episode_path.episode_path # => "~/video-projects/a27-ac-categorize-mp4-CI/01-flivideo-project-kickoff-TODO"
332
+ episode_path.episode_code # => "01"
333
+ episode_path.episode_name # => "flivideo-project-kickoff"
334
+ episode_path.keywords # => ["TODO"]
335
+ RUBY
336
+ end
337
+ ```
338
+
339
+ Klue Component: `global_config.klue`
340
+
341
+ ```ruby
342
+ component :global_configuation do
343
+ pattern "Singleton"
344
+
345
+ desc "Access and apply global configuration settings for video asset management and state consistency."
346
+
347
+ comments <<~TEXT
348
+ Configuration file path: ~/.fli-video.json
349
+ - Automatically creates a configuration file if it does not exist.
350
+ - Responsible for reading and updating global configuration.
351
+ - Provides methods to manage folder paths and various settings.
352
+ TEXT
353
+
354
+ sample :configuration, <<~JSON
355
+ {
356
+ "folders": {
357
+ "ecamm-recordings": "~/Movies/Ecamm Live Recordings",
358
+ "project-root": "/Volumes/Expansion/Sync/tube-channels/a-cast/cast-active",
359
+ },
360
+ "settings": {
361
+ "focus-project-code": "a27",
362
+ },
363
+ }
364
+ JSON
365
+
366
+ method :set_folder(:key, :folder)
367
+ method :folder(:key)
368
+ method :set_setting(:key, :value)
369
+ method :setting(:key)
370
+ method :load
371
+ method :save
372
+ end
373
+ ```
374
+
375
+ Klue Component: `move_ecamm_file.klue`
376
+
377
+ ```ruby
378
+ component :move_ecamm_file do
379
+ desc "Seamlessly transfer eCamm recordings to the current focused video or podcast episode recordings subfolder."
380
+
381
+ comments <<~TEXT
382
+ - Facilitates the transfer of eCamm recording files to the appropriate project's recording subfolder.
383
+ - Automatically identifies the current focused project or episode to ensure correct file placement.
384
+ - Handles the file transfer process, maintaining file integrity and updating any necessary metadata.
385
+ - Uses global configuration to determine eCamm recording folder location.
386
+ - Uses current project configuration to determine recording subfolder location.
387
+ - Aborts the transfer process if target folder does not exist.
388
+ TEXT
389
+
390
+ method :execute(:ecamm_file_name)
391
+
392
+ sample :move_ecamm_file_to_project, <<~RUBY
393
+ # Move an eCamm recording to the currently focused project's recordings subfolder
394
+ move_ecamm_file.execute('Ecamm Live Recording on 2023-08-25 at 14.51.58.mov')
395
+
396
+ # ~/video-projects/a20-ad-some-video/recordings/Ecamm Live Recording on 2023-08-25 at 14.51.58.mov
397
+ RUBY
398
+ end
399
+ ```
400
+
401
+ Klue Component: `move_to_trash.klue`
402
+
403
+ ```ruby
404
+ component :move_to_trash do
405
+ desc "Move suboptimal video takes to '.trash' folder"
406
+
407
+ pattern "Command"
408
+
409
+ comments <<~TEXT
410
+ - Will trash a specific recording in a project folder.
411
+ - Will identify the last eCamm recording in a project folder if no specific recording is provided.
412
+ - Enhances project clarity and organization.
413
+ TEXT
414
+
415
+ constructure(:parent_project)
416
+
417
+ method :run(:file_name)
418
+
419
+ sample :move_video_to_trash, <<~RUBY
420
+ project_path = ProjectPath.new('a27')
421
+
422
+ command = move_to_trash.new(project_path)
423
+
424
+ # Example of moving a specific suboptimal video take to the trash folder
425
+ command.run('01-a-introduction.mov')
426
+ # => "~/video-projects/a27-ac-categorize-mp4-CI/.trash/01-a-introduction.mov"
427
+
428
+ # Example of moving the last suboptimal video take to the trash folder
429
+ command.run
430
+ # => "~/video-projects/a27-ac-categorize-mp4-CI/.trash/Ecamm Live Recording on 2023-08-25 at 14.51.58.mov
431
+ RUBY
432
+ end
433
+ ```
434
+
435
+ Klue Component: `open_in_finder.klue`
436
+
437
+ ```ruby
438
+ component :open_in_finder do
439
+ desc "Quickly access video project and episode folders within the Finder."
440
+
441
+ pattern "Command"
442
+
443
+ comments <<~TEXT
444
+ - Provides shortcuts to open project and episode folders in the Finder.
445
+ - Enhances efficiency in navigating to specific video project locations.
446
+ - Streamlines the process of locating and managing video files and folders.
447
+ TEXT
448
+
449
+ constructor(:parent_project)
450
+
451
+ method :run
452
+
453
+ sample :access_project_in_finder, <<~RUBY
454
+ project_path = ProjectPath.new('a27')
455
+
456
+ command = open_in_finder.new(project_path)
457
+ # Opens the folder for project 'a27' in Finder
458
+
459
+ command.run
460
+ # Opens the folder for episode '01' of project 'a27' in Finder
461
+ RUBY
462
+ end
463
+ ```
464
+
465
+ Klue Component: `project_config.klue`
466
+
467
+ ```ruby
468
+ component :project_configuration do
469
+ desc "Manage project / episode settings and state."
470
+
471
+ pattern "Adapter"
472
+
473
+ comments <<~TEXT
474
+ Configuration file: .fv.json
475
+ - Handles settings for single videos or the episodes in a Podcast.
476
+ - Responsible for reading and updating settings.
477
+ - Supports state management for single video, episodes, recording and chapter progression.
478
+ - This class is a reflection of the configuration file and the folders and files it manages.
479
+
480
+ Project type: video
481
+ - A single video file.
482
+ - Supports recording and chapter progression
483
+
484
+ Project type: podcast
485
+ - Multiple video files known as episodes.
486
+ - Supports recording and chapter progression for each episode.
487
+
488
+ Infers project type from the presence of the "episodes" key.
489
+ Infers project name from the name of the folder containing the configuration file.
490
+ Infers episode name from the name of the folder containing the video file.
491
+ Keeps track of prefered chapter name for each chapter sequence.
492
+ TEXT
493
+
494
+ method :load
495
+ method :save
496
+ method :resync_project_files() # refreshes the configuration based on the file system
497
+ method :current_chapter() # if type == :video
498
+ method :current_episode() # if type == :podcast
499
+
500
+ data_object :project_config do
501
+ constructor(:json)
502
+
503
+ attribute :type # video, podcast
504
+ attribute :code
505
+ attribute :chapters # if type == :video
506
+ attribute :episodes # if type == :podcast
507
+ end
508
+
509
+ data_object :episode_config do
510
+ constructor(:json)
511
+
512
+ attribute :seq # episode number store as number, but displayed as 2 digit string
513
+ attribute :chapters
514
+ attribute :current # true if this is the current episode
515
+
516
+ method :current_chapter()
517
+ end
518
+
519
+ data_object :chapter_config do
520
+ constructor(:json)
521
+
522
+ attribute :seq
523
+ attribute :preferred_name
524
+ attribute :current # true if this is the current chapter
525
+ end
526
+
527
+ sample :configuration, :for_video, <<~JSON
528
+ {
529
+ "type": "video",
530
+ "code": "e28",
531
+ "chapters": [
532
+ {
533
+ seq: 1,
534
+ preferred_name: "intro"
535
+ },
536
+ {
537
+ seq: 2,
538
+ preferred_name: "example"
539
+ },
540
+ {
541
+ seq: 3,
542
+ preferred_name: "outro",
543
+ current: true
544
+ }
545
+ ]
546
+ }
547
+ JSON
548
+
549
+ sample :configuration, :for_podcast, <<~JSON
550
+ {
551
+ "type": "podcast",
552
+ "code": "e27",
553
+ "episodes": [
554
+ {
555
+ "seq": 1,
556
+ "chapters": [
557
+ {
558
+ "seq": 1,
559
+ "preferred_name": "introduction",
560
+ },
561
+ {
562
+ "seq": 2,
563
+ "preferred_name": "scenario",
564
+ "current": true
565
+ }
566
+ ]
567
+ },
568
+ {
569
+ "seq": 2,
570
+ "current": true,
571
+ "chapters": [
572
+ {
573
+ "seq": 1,
574
+ "preferred_name": "introduction",
575
+ },
576
+ {
577
+ "seq": 2,
578
+ "preferred_name": "scenario",
579
+ },
580
+ {
581
+ "seq": 3,
582
+ "preferred_name": "story",
583
+ "current": true
584
+ }
585
+ ]
586
+ }
587
+ ]
588
+ }
589
+ JSON
590
+ end
591
+ ```
592
+
593
+ Klue Component: `project_meta_data_store.klue`
594
+
595
+ ```ruby
596
+ component :project_meta_data_store do
597
+ desc "Build a JSON datastore of project files with inferred metadata."
598
+
599
+ pattern "Command"
600
+
601
+ comments <<~TEXT
602
+ - Aggregates file data from project, episode, recording, chapter, and post-produced folders.
603
+ - Infers metadata from sources like KEYWORDS, transcripts, and other relevant data.
604
+ - Creates a comprehensive JSON datastore for the entire project.
605
+ - Facilitates advanced data analysis and management for the project.
606
+ - The extracted data can be used for automated post-production processes like keyword generation, B-roll prompts, chapter names, title slides, and time code markers for calls to action.
607
+ TEXT
608
+
609
+ constructor(:parent_project)
610
+
611
+ method :run
612
+
613
+ sample :build_project_metadata, <<~RUBY
614
+ project_path = ProjectPath.new('a27')
615
+
616
+ # Instantiate the component with the parent project
617
+ metadata_store = project_meta_data_store.new(project_path)
618
+
619
+ # Execute the process to aggregate files and infer metadata
620
+ metadata_store.run
621
+ # Output: '~/video-projects/a27-ac-categorize-mp4-CI/project_metadata.json'
622
+ RUBY
623
+ end
624
+ ```
625
+
626
+ Klue Component: `project_path.klue`
627
+
628
+ ```ruby
629
+ component :project_path do
630
+ desc "Construct project path using project code and deducing state based on existing folder name."
631
+
632
+ pattern "Adapter"
633
+
634
+ comments <<~TEXT
635
+ - Infers project path based on project code and existing folder name.
636
+ - Maintains state for project code, channel code, descriptive name, keywords and episodes.
637
+ - Uses global configuration to determine root folder.
638
+ - Uses existing folder name and keywords to build internal state.
639
+ - Provides method for building absolute, relative and sub folder.
640
+ - Provides method for building new path for rename operations.
641
+ - Provides list of associated episode paths.
642
+ - Stores state in an internal data object.
643
+ - Designed for building folder names, not create or modify actual directories.
644
+ TEXT
645
+
646
+ accessors :project_code, :channel_code, :project_name, :keywords, :project_path, :episodes
647
+
648
+ method :constructor(:project_code, channel_code: nil, project_name: nil, keywords: nil)
649
+ method :instance(:folder)
650
+
651
+ method :change_path(project_code: nil, channel_code: nil, project_name: nil, keywords: nil)
652
+
653
+ sample :create_project_path, <<~RUBY
654
+ # Create a new project path
655
+ project_path = ProjectPath.new('a27', channel_code: 'ac', project_name: 'categorize-mp4', keywords: ['CI'] )
656
+ project_path.project_path # => "~/video-projects/a27-ac-categorize-mp4-CI"
657
+ project_path.project_code # => "a27"
658
+ project_path.channel_code # => "ac"
659
+ project_path.project_name # => "categorize-mp4"
660
+ project_path.keywords # => "CI"
661
+ project_path.episodes.count # => 0
662
+ RUBY
663
+
664
+ sample :infer_project_path, <<~RUBY
665
+ # Infer project path based on project code and existing folder
666
+ project_path = ProjectPath.new('a27')
667
+ project_path.project_path # => "~/video-projects/a27-ac-categorize-mp4-CI"
668
+ project_path.project_code # => "a27"
669
+ project_path.channel_code # => "ac"
670
+ project_path.project_name # => "categorize-mp4"
671
+ project_path.keywords # => "CI"
672
+ project_path.episodes.count # => 2
673
+ RUBY
674
+
675
+ sample :rename_project_path, <<~RUBY
676
+ # Rename project path
677
+ project_path = ProjectPath.new('a27')
678
+
679
+ path1 = project_path.change_path(project_code: 'a28')
680
+ path1.project_path # => "~/video-projects/a28-ac-categorize-mp4-CI"
681
+ path2 = project_path.change_path(channel_code: 'ad', project_name: 'categorize-mp4-for-appydave')
682
+ path2.project_path # => "~/video-projects/a27-ad-categorize-mp4-for-appydave-CI"
683
+ path3 = project_path.change_path(keywords: [])
684
+ path3.project_path # => "~/video-projects/a27-ac-categorize-mp4"
685
+ RUBY
686
+
687
+ sample :next_project_code, <<~RUBY
688
+ # Get next project code
689
+ project_path = ProjectPath.new('a27')
690
+ project_path.next_project_code # => "a28"
691
+
692
+ project_path = ProjectPath.new('a99')
693
+ project_path.next_project_code # => "b00"
694
+ RUBY
695
+
696
+ sample :folder_to_project_path, <<~RUBY
697
+ # Convert folder to project path
698
+ project_path = ProjectPath.instance('~/video-projects/a27-ac-categorize-mp4-CI')
699
+ project_path.project_path # => "~/video-projects/a27-ac-categorize-mp4-CI"
700
+ project_path.project_code # => "a27"
701
+ project_path.channel_code # => "ac"
702
+ project_path.project_name # => "categorize-mp4"
703
+ project_path.keywords # => "CI"
704
+ RUBY
705
+ end
706
+ ```
707
+
708
+ Klue Component: `recording_file_watcher.klue`
709
+
710
+ ```ruby
711
+ component :filewatch_processor do
712
+ desc "Automate file event responses, directing new recordings to current project folders."
713
+
714
+ pattern "Observer"
715
+
716
+ comments <<~TEXT
717
+ - Monitors new eCamm recordings file events.
718
+ - Automates the process of moving new recordings to specified project folders.
719
+ - Enhances content management by ensuring recordings are organized efficiently.
720
+ - Configurable to respond to different types of file events and target folders.
721
+ TEXT
722
+
723
+ method :watch(:folder_path, :event_type)
724
+
725
+ # Will move the file to current project's recordings folder
726
+ method :move_file
727
+
728
+ sample :automate_recording_organization, <<~RUBY
729
+ config = GlobalConfig.instance
730
+
731
+ # Watch a specific folder for new and existing recordings
732
+ filewatch_processor.watch(config.folders['ecamm-recordings'], '*.mov', :moved_file)
733
+
734
+ # Example usage
735
+ # When a new file is detected in Ecamm Live Recordings, it is automatically moved to the current project's recordings folder.
736
+ filewatch_processor.move_file
737
+ RUBY
738
+ end
739
+ ```
740
+
741
+ Klue Component: `recording_filename.klue`
742
+
743
+ ```ruby
744
+ component :recording_filename do
745
+ desc "Calculate the next video recording file name based on chapter sequence, part number, chapter name, and tags if available."
746
+
747
+ pattern "Adapter"
748
+
749
+ comments <<~TEXT
750
+ - File name construction for new and existing video recordings.
751
+ - Utilizes the chapter and part sequence for systematic naming.
752
+ - Incorporates the chapter name for descriptive clarity.
753
+ - Has support for tags in the file name to aid content identification and post-processing workflows.
754
+ - Set episode & project via the episode if recording belongs to an episode
755
+ - Set project if recording belongs to a project
756
+ - Parent returns episode || project
757
+ TEXT
758
+
759
+ accessors :chapter_seq, :part_seq, :chapter_name, :tags, :filename, :episode, :project, :parent
760
+
761
+ method :constructor(:chapter_seq, :part_seq, :chapter_name, tags: [], parent: nil)
762
+ method :instance(:full_path)
763
+
764
+ # Use the current chapter sequence if not provided
765
+ # Part sequence will increment based on the previous part letter in the chapter if not provided
766
+ # Chapter name will defaults to previous recording chapter name if not provided
767
+ method :next_filename(:previous_filename, chapter_name: nil, tags: [], chapter_seq: nil, part_seq: nil)
768
+ method :update_chapter_sequence(:current_chapter_seq, :new_chapter_seq)
769
+ method :resequence_chapters(:starting_chapter_seq)
770
+ method :update_tags(:new_tags)
771
+
772
+ sample :create_recording_filename, <<~RUBY
773
+ project_path = ProjectPath.new('a27')
774
+ project_path.project_path # => "~/video-projects/a27-ac-categorize-mp4-CI"
775
+
776
+ # Generate a filename for a new video recording
777
+ filename1 = RecordingFilename.new(1, 'a' 'introduction', tags: [], parent: project_path)
778
+ filename1.filename # => "01-a-introduction.mov"
779
+ filename1.chapter_seq # => 1
780
+ filename1.part_seq # => "a"
781
+ filename1.chapter_name # => "introduction"
782
+ filename1.tags # => []
783
+ filename1.full_path # => "~/video-projects/a27-ac-categorize-mp4-CI/01-a-introduction.mov"
784
+ RUBY
785
+
786
+ sample :next_recording_filename, <<~RUBY
787
+ filename1 = "~/video-projects/a27-ac-categorize-mp4-CI/01-a-introduction.mov"
788
+
789
+ project = ProjectConfig.new('a27')
790
+
791
+ # Class method to generate a filename for a new video recording
792
+ filename2 = RecordingFilename.next_filename(filename1, chapter_name: 'introduction-more-content', tags: ['GPTIMPROVE'])
793
+
794
+ # Fluent method to generate a filename for a new video recording
795
+ filename3 = filename2.next_filename(chapter_name: 'introduction')
796
+ filename4 = filename3.next_filename(tags: ['CTA'])
797
+
798
+ project.next_chapter('overview')
799
+
800
+ filename5 = RecordingFilename.next_filename(project.last_file)
801
+
802
+ project.next_chapter('scenario')
803
+
804
+ filename6 = RecordingFilename.next_filename(project.last_file, tags: ['TITLE'])
805
+
806
+ filename1.filename # => "01-a-introduction-GPTIMPROVE.mov" # Send transcription to GPT Bot for improvement
807
+ filename2.filename # => "01-b-introduction-more-content.mov"
808
+ filename3.filename # => "01-c-introduction.mov"
809
+ filename4.filename # => "01-d-introduction-CTA.mov" # Instruction for video editor to add a CTA
810
+ filename5.filename # => "02-a-overview.mov"
811
+ filename6.filename # => "03-a-scenario-TITLE.mov" # Instruction for video editor to add a title slide
812
+ RUBY
813
+
814
+ sample :file_to_recording_filename, <<~RUBY
815
+ # Convert absolute file to recording filename
816
+ filename = RecordingFilename.instance('~/video-projects/a27-ac-categorize-mp4-CI/01-a-introduction.mov')
817
+
818
+ filename.filename # => "01-a-introduction.mov"
819
+ filename.chapter_seq # => 1
820
+ filename.part_seq # => "a"
821
+ filename.chapter_name # => "introduction"
822
+ filename.tags # => []
823
+ filename.full_path # => "~/video-projects/a27-ac-categorize-mp4-CI/01-a-introduction.mov"
824
+ RUBY
825
+
826
+ sample :rename_recording_filename, <<~RUBY
827
+ filename = RecordingFilename.instance('~/video-projects/a27-ac-categorize-mp4-CI/01-a-introduction.mov')
828
+ filename.filename # => "01-a-introduction.mov"
829
+
830
+ filename.change_filename(chapter_name: 'introduction-trim-23s', tags: ['GPTDALE3'])
831
+ filename.filename # => "01-a-introduction-trim-23s-GPTDALE3.mov"
832
+ RUBY
833
+
834
+ sample :update_chapter_sequence, <<~RUBY
835
+ project_path = ProjectPath.new('a27')
836
+
837
+ # Update chapter sequence in a project
838
+ filename = RecordingFilename.new(2, 'b', 'overview', parent: project_path)
839
+ filename.update_chapter_sequence(2, 3)
840
+ filename.filename # => "03-b-overview.mov"
841
+ RUBY
842
+
843
+ sample :resequence_chapters, <<~RUBY
844
+ # Resequence chapters starting from a given sequence
845
+ filename.resequence_chapters(2)
846
+ # Adjusts chapter sequence of all subsequent chapters starting from '02'
847
+ RUBY
848
+
849
+ sample :update_tags, <<~RUBY
850
+ # Update tags for a recording
851
+ filename = RecordingFilename.new(1, 'a', 'introduction', tags: ['OLD_TAG'], parent: project_path)
852
+ filename.update_tags(['NEW_TAG'])
853
+ filename.filename # => "01-a-introduction-NEW_TAG.mov"
854
+ RUBY
855
+ end
856
+ ```
857
+
858
+ Klue Component: `restore_from_trash.klue`
859
+
860
+ ```ruby
861
+ component :restore_from_trash do
862
+ desc "Retrieve video takes from '.trash' folder and move them back to the project folder."
863
+
864
+ pattern "Command"
865
+
866
+ comments <<~TEXT
867
+ - Restores a specific recording from the trash to the project folder.
868
+ - If no specific recording is provided, restores the most recently trashed recording.
869
+ - Facilitates reconsideration or re-evaluation of previously discarded content.
870
+ TEXT
871
+
872
+ constructor(:parent_project)
873
+
874
+ method :run(:file_name)
875
+
876
+ sample :restore_from_trash, <<~RUBY
877
+ project_path = ProjectPath.new('a27')
878
+
879
+ command = undo_trash.new(project_path)
880
+
881
+ # Example of restoring a specific recording from the trash folder
882
+ command.run('01-a-introduction.mov')
883
+ # => "~/video-projects/a27-ac-categorize-mp4-CI/01-a-introduction.mov"
884
+
885
+ # Example of restoring the most recently trashed recording
886
+ command.run
887
+ # => "~/video-projects/a27-ac-categorize-mp4-CI/Ecamm Live Recording on 2023-08-25 at 14.51.58.mov"
888
+ RUBY
889
+ end
890
+ ```
891
+
892
+ Klue Component: `switch_focus.klue`
893
+
894
+ ```ruby
895
+ component :change_focus do
896
+ desc "Easily switch between different video projects or episodes to accommodate changing content priorities."
897
+
898
+ pattern "Interactor"
899
+
900
+ comments <<~TEXT
901
+ - Allows switching the focus to a different video project or a specific episode within a podcast.
902
+ - Video recordings belong to a specific project or episode and this interaction ensures that the correct project or episode is in focus.
903
+ - Ensures seamless transition and updates the working context to the selected project or episode.
904
+ - Maintains state consistency across switches using the global configuration.
905
+ TEXT
906
+
907
+ method :run(:project_code, episode_code: nil)
908
+
909
+ sample :switch_focus_to_video_project, <<~RUBY
910
+ # Switch focus to a different video project
911
+ change_focus.run('a20')
912
+ RUBY
913
+
914
+ sample :switch_focus_to_podcast_episode, <<~RUBY
915
+ # Switch focus to a specific episode within a podcast project
916
+ change_focus.run('a21', '02')
917
+ RUBY
918
+ end
919
+ ```
920
+
921
+ Klue Component: `text_to_speech.klue`
922
+
923
+ ```ruby
924
+ component :text_to_speech do
925
+ desc "Transcribe spoken content to text and store in multiple transcription formats."
926
+
927
+ pattern "Command"
928
+
929
+ comments <<~TEXT
930
+ - Transcribes audio content from videos into text.
931
+ - Supports storing transcriptions in various formats for accessibility and further processing.
932
+ - Uses the transcript folder under the recording, chapter or post-production folder and stores the transcriptions in a subfolder called 'transcript'.
933
+ TEXT
934
+
935
+ constructor(:parent_project)
936
+
937
+ method :run(:recording_file, output_formats:)
938
+
939
+ sample :transcribe_audio_to_text, <<~RUBY
940
+ project_path = ProjectPath.new('a27')
941
+
942
+ # ~/video-projects/a27-ac-categorize-mp4-CI/01-a-introduction.mov
943
+ # Instantiate the component with the parent project
944
+ tts = text_to_speech.new(project_path)
945
+
946
+ # Execute the transcription against
947
+ tts.run('01-introduction.mov', output_formats: ['txt', 'srt', 'vtt', 'json', 'tsv'])
948
+
949
+ # Transcribes '01-introduction.mov' and stores the transcriptions in the specified formats
950
+ # Output: Transcriptions saved in '~/video-projects/a27-ac-categorize-mp4-CI/recordings/transcript/01-introduction.txt|srt|vtt|json|tsv'
951
+ RUBY
952
+ end
953
+ ```
954
+
955
+ Klue Component: `transcript_data_store.klue`
956
+
957
+ ```ruby
958
+ component :transcript_data_store do
959
+ desc "Build a JSON datastore of transcripts for an entire project."
960
+
961
+ pattern "Command"
962
+
963
+ comments <<~TEXT
964
+ - Aggregates transcripts from various project levels into a single JSON datastore.
965
+ - Scans project, episode, recording, chapter, and post-produced folders for existing transcripts.
966
+ - Facilitates easy access and management of transcript data across the entire project.
967
+ - Enhances data retrieval and analysis capabilities for the project's transcripts.
968
+ - Stores data in a JSON file called 'transcripts.json' in the project folder.
969
+ TEXT
970
+
971
+ constructor(:parent_project)
972
+
973
+ method :run
974
+
975
+ sample :build_transcript_datastore, <<~RUBY
976
+ project_path = ProjectPath.new('a27')
977
+
978
+ # Instantiate the component with the parent project
979
+ transcript_store = transcript_data_store.new(project_path)
980
+
981
+ # Execute the process to aggregate and store transcript data
982
+ transcript_store.run
983
+ # Output: '~/video-projects/a27-ac-categorize-mp4-CI/project_transcripts.json'
984
+ RUBY
985
+ end
986
+ ```
987
+