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,347 @@
1
+ # FliVideo
2
+
3
+ ## Application Overview
4
+
5
+ This document provides an overview of a specialized application designed primarily for video content creators using Ecamm Live on the Mac, and adaptable for OBS users. Tailored for projects ranging from individual YouTube videos to episodes in a podcast series, the application fits seamlessly into the workflow between video recording and editing. It streamlines the post-recording process, encompassing file organization, renaming, and assembly of video recordings, thereby enhancing the efficiency and structure of content creation.
6
+
7
+ ### Core Functionality
8
+
9
+ - **Video Management**: The application intelligently handles videos recorded via Ecamm Live. Once Ecamm saves the videos with a name and timestamp in its folder, our system relocates them to a specific project or episode folder within the project/recordings directory.
10
+ - **Project and Episode Handling**: Each video project pertains to either a single YouTube video or a series of podcast episodes. The application supports a structured approach to organizing these projects.
11
+ - **Chapter-Based Recording**: Emulating a book's structure, down to chapters and individual paragraphs or sentences, videos are recorded and categorized as chapters, which can further be divided into smaller segments or 'parts', akin to paragraphs or sentences, labeled sequentially (e.g., a, b, c...).
12
+ - **File Naming and Organization**: Adhering to a sophisticated naming convention, the application names projects using a sequence (e.g., a01..a99, b01..), a YouTube channel code (e.g., ac=AppyCast, fv=FliVideo), and specific project descriptors. This convention is applied to organize and identify video chapters and parts within each project.
13
+ - **Combining Video Chapters**: After completing recordings for a chapter, these are joined to form a new video file in the chapter's folder, enhancing content flow and consistency.
14
+ - **Speech to Text Integration**: The application features advanced speech-to-text capabilities, converting spoken content into transcriptions. These transcriptions are then utilized for various content generation scenarios, including automatic tagging, generating prompts for AI-based tools like DALL·E 3, and providing detailed instructions for video editors.
15
+
16
+ ### Advanced Features
17
+
18
+ - **Dynamic Configuration**: The system adapts to various configurations set by the user before recording, using this information for subsequent file naming and routing.
19
+ - **Trash and Undo Functions**: Videos deemed suboptimal can be moved to a 'trash' folder, with the ability to undo this action if needed.
20
+ - **Automated File Processing**: Utilizing a FileWatch processor, the application automates responses to file events, like moving new recordings to designated folders.
21
+ - **Content Segmentation**: The application supports segmentation of content into sections and subparts, each with a calculated sequence number and name for easy identification and organization.
22
+ - **Metadata and Transcription Integration**: Extracting metadata from video transcriptions and file tags, the system aids in post-production processes such as keyword generation and chapter transitions.
23
+
24
+ ### Organization Suited for
25
+
26
+ - Long form YouTube content
27
+ - Multi Episode Podcasts
28
+ - One off YouTube Short or multiple shorts extracted from Long Form or Episode videos
29
+ - Course Creation
30
+
31
+ ## eCamm Live
32
+
33
+ I use eCamm Live to record my videos. It is simple to create videos with scenes and record individual sections of a video. This application should adapt to OBS with minimal changes.
34
+
35
+ eCamm live recording files are saved in the following format:
36
+
37
+ ```bash
38
+ Ecamm Live Recording on [YYYY-MM-DD] at [HH.MM.SS].mov
39
+
40
+ # Example
41
+ Ecamm Live Recording on 2023-08-25 at 14.51.58.mov
42
+ ```
43
+
44
+ ## Configuration
45
+
46
+
47
+ ### Global configuration
48
+
49
+ FliVideo uses a global configuration file located at `~/.fli-video.json` to store settings and paths for the application and state information such as the current project and episode. This file is created when the application is first run and is updated when the user changes the configuration.
50
+
51
+ ### Project configuration
52
+
53
+ FliVideo stores project-specific settings in `.fv.json` file located in the project's root folder. This file is created when the user creates a new project and is updated when recordings are updated. This file has a section for video and a section for episodes and uses the same structure in both sections
54
+
55
+ ## Project Naming and Structure
56
+
57
+ As part of the application development, each video project is assigned an alphanumeric identifier, ensuring a unique and systematic approach to project management.
58
+
59
+ Currently, the application supports four primary project codes corresponding to distinct content areas: AppyCast, AppyDave, WinningPrompts, and FliVideo.
60
+
61
+ Each project is also given a descriptive title, providing clear and immediate insight into its content or objective. Additionally, project names may include a status or keyword, offering a quick reference to the project's current state or specific characteristics. This naming convention and structure are fundamental to the application, as they facilitate efficient organization, easy retrieval, and effective management of diverse projects, ranging from media production to targeted content creation.
62
+
63
+ ### Sample project folder names
64
+
65
+ ```bash
66
+ a13-wp-openai-moderation-api-announcement-aug-25
67
+ a20-ad-open-interpreter
68
+ a21-ac-custom-gpt-instruction
69
+ a22-ac-browse-with-bing-chatgpt-feature
70
+ a24-ad-appydave-website
71
+ a26-ac-pinokio-NOT-STARTED
72
+ a27-ac-categorize-mp4-CI
73
+ a28-ac-easy-gpt-context-creation-FIND-MINDMAP
74
+ a29-ac-gpts-analyze-pdf-transations
75
+ ```
76
+
77
+ ### Sample project codes
78
+
79
+ - `ac` - AppyCast
80
+ - `ad` - AppyDave
81
+ - `fv` - FliVideo
82
+ - `wp` - WinningPrompts
83
+ - `c9` - Carnivore90
84
+ - `t1` - Trend10
85
+
86
+ ### Video Subfolders
87
+
88
+ Within the application's structure, video subfolders play a crucial role in organizing various elements of a project. These subfolders, residing under `project-name` for single video projects or `project-name/episode-name` for podcast episodes, are named and utilized as follows:
89
+
90
+ - **recordings**: This folder contains individual labeled recordings. Each recording is meticulously named and stored here, serving as the primary repository for raw video footage.
91
+
92
+ - **chapters**: Grouped recordings that have been joined together are stored in this folder. It represents the assembled segments of a project, showcasing the progression from individual recordings to cohesive chapters.
93
+
94
+ - **.trash**: The `.trash` folder is designated for recordings considered as bad takes. This allows for an efficient way to segregate and review discarded content, keeping the main folders clutter-free while retaining the option for retrieval.
95
+
96
+ - **assets**: This folder is utilized for storing extra graphic materials or b-roll assets. These elements are crucial in the production phase of a video, enhancing the visual appeal and providing supplementary content.
97
+
98
+ - **transcription**: Transcription files, providing textual versions of the video content, are stored here. This is especially useful for accessibility, content repurposing, and as a reference during the editing process.
99
+
100
+
101
+ ### Chapter naming convention
102
+
103
+ Each video project is divided into chapters, which are further segmented into parts. This structure is analogous to a book's chapters and paragraphs, respectively.
104
+
105
+ A chapter name like introduction may have additional descriptive labels like `introduction-context`, `introduction-outline`, `introduction-call-to-action`.
106
+
107
+ #### Sample chapter names
108
+
109
+ Chapter names help to identify the content of the video and maybe used for transition slide titles or chapter titles in a YouTube video.
110
+
111
+ - introduction
112
+ - overview
113
+ - example
114
+ - question
115
+ - answer
116
+ - summary
117
+ - outro
118
+
119
+ #### Why are parts important?
120
+
121
+ Too minimize the amount of editing required, I may want to record each part of a chapter separately. This allows clean recordings with minimal editing.
122
+
123
+ ### Keywords and Tags
124
+
125
+ Any recording can have 1 or more tags associated with it. These tags can be used to inform the video editor to inject B-roll or be picked up by another automation such as transcribe and send to GPT Bot
126
+
127
+ #### Example Tags
128
+
129
+ - `INTRO` - This recording needs to be placed into an intro template
130
+ - `CTA` - Like/subscribe, add comment, link in description or any other call to action
131
+ - `TRIM` - This recording needs to be truncated
132
+ - `TRIM-40s` - This recording needs to be truncated to 40 seconds
133
+ - `BROLL` - This recording needs B-roll
134
+ - `TELEPROMPT` - This recording needs to be transcribed and put into the teleprompter or sent to GPT bot for script inprovement
135
+ - `OUTRO` - This recording needs to be placed into an outro template
136
+
137
+ ### Scenarios
138
+
139
+ #### Long form
140
+
141
+ For full-length YouTube videos, the application offers a comprehensive solution from initial recording to final organization. It supports the creation and management of individual video projects, each with unique identifiers and descriptive names. The application's robust structure allows for the segmentation of videos into chapters and subparts, making the editing process more manageable and efficient. This scenario is ideal for YouTubers looking to produce structured, high-quality content for their channels.
142
+
143
+ #### Multi Episode Podcast
144
+
145
+ For podcasters using YouTube as their platform, the application provides excellent tools for episode management. It enables the creation of episodic content, each episode with its own identifier and title, under a single project umbrella. This scenario allows podcast creators to maintain a cohesive series, with easy navigation and organization of episodes, enhancing the listener's experience on YouTube.
146
+
147
+ #### Course Creation
148
+
149
+ In the context of online courses, the application excels in organizing and managing educational content. Course creators can structure their material into distinct sections and chapters, aligning with course modules or lessons. This scenario is particularly useful for educators and trainers who seek to provide a well-organized, accessible learning experience. The application's capabilities in handling multiple recordings and segments ensure that each part of the course is neatly cataloged and easy to access for students.
150
+
151
+ #### Short form
152
+
153
+ The application streamlines YouTube Shorts creation by allowing users to start new shorts projects or extract segments from longer videos. It enables easy segmentation, customization with intros and outros, and organizes these shorts in dedicated folders, enhancing content diversity on YouTube.
154
+
155
+ ### YouTube Shorts
156
+
157
+ The application is proficiently designed to accommodate the creation of YouTube Shorts, catering to both standalone short-form videos and segments derived from longer recordings.
158
+
159
+ **Standalone Shorts**: When starting a brand-new project specifically as a YouTube Short, the process mirrors that of a regular YouTube video. The application allows for the creation, naming, and organization of these shorts in their unique project folders.
160
+
161
+ **Shorts from Longer Recordings**: In many instances, a segment within a chapter or even a single paragraph might be ideal for a YouTube Short. In such cases, the application offers the flexibility to extract and separate these segments. It allows for the recording of additional intros and outros, specifically tailoring the segment for the short-form format. These extracted segments are then organized into a dedicated folder, designated for YouTube Shorts, within the main project. This ensures that while the original recording remains an integral part of the larger video or episode, the segment is also independently accessible for the video editor to assemble into a YouTube Short.
162
+
163
+ ## Project Structure Design
164
+
165
+ The following sections describe the application's structure and naming conventions using an exiting project example and highlights the system's capabilities in managing video projects and episodes.
166
+
167
+ #### Project Naming and Organization
168
+
169
+ Each project in the system is uniquely identified with a structured naming convention. For example, `a27-ac-categorize-mp4-IN-PROGRESS` breaks down as follows:
170
+
171
+ - **Sequence**: 'a27', representing the project's unique identifier.
172
+ - **Project Code**: 'ac', denoting the AppyCast channel.
173
+ - **Project Name**: 'categorize-mp4', describing the project's focus.
174
+ - **Status**: 'IN-PROGRESS', indicating the current stage of the project.
175
+
176
+ #### Episode Management
177
+
178
+ Episodes within a project are optional and are used when a project encompasses multiple videos. Each episode has its own folder named with a sequence and descriptive title, such as `01-flivideo-project-kickoff`:
179
+
180
+ - **Sequence**: '01', '02', etc., showing the episode's order in the series.
181
+ - **Episode Name**: Like 'flivideo-project-kickoff', providing a brief description of the episode's content.
182
+
183
+ #### Recordings Folder
184
+
185
+ The recordings folder, e.g., `a27-ac-categorize-mp4-CI/01-flivideo-project-kickoff/recordings`, contains individual video files. These are named following a specific pattern:
186
+
187
+ - **Sequence and Section Name**: Starting with a number indicating their order, followed by a descriptive name, like '01-introduction.mov'.
188
+ - **Subparts**: For more detailed segmentation, files are further labeled with suffixes like '-a', '-b', '-c', indicating the subparts of a section, such as '02-a-overview.mov', '02-b-overview.mov'.
189
+
190
+ Here is an example from episode 1 of the FliVideo project Podcast.
191
+
192
+ ```bash
193
+ # a27-ac-categorize-mp4-CI/01-flivideo-project-kickoff/recordings
194
+
195
+ 01-introduction.mov
196
+ 02-a-overview.mov
197
+ 02-b-overview.mov
198
+ 02-c-overview.mov
199
+ 02-d-overview.mov
200
+ 02-e-overview.mov
201
+ 03-a-role_CI.mov
202
+ 03-b-overview_CI.mov
203
+ 04-a-gpt-first-attempt.mov
204
+ 04-b-gpt-first-attempt-explanation.mov
205
+ 05-first-commands_TRANSITION.mov
206
+ 06-a-commands_CI.mov
207
+ 07-b-commands_CI.mov
208
+ 07-d-commands-goal_CI.mov
209
+ 08-a-response_CI-TRANSITION.mov
210
+ 08-b-response_CI-TRANSITION.mov
211
+ 09-a-gpt-2nd-attempt.mov
212
+ 09-b-gpt-2nd-attempt.mov
213
+ 09-c-gpt-2nd-attempt.mov
214
+ 10-a-gpt-goal.mov
215
+ 10-b-gpt-goal.mov
216
+ 10-c-gpt-goal.mov
217
+ 10-d-gpt-goal.mov
218
+ 10-e-gpt-goal.mov
219
+ 10-f-gpt-goal.mov
220
+ 11-a-gpt-goal-more.mov
221
+ 11-b-gpt-goal-more.mov
222
+ 12-a-code-cli.mov
223
+ 12-b-code-cli.mov
224
+ 12-c-code-cli.mov
225
+ 13-a-code-cli-run.mov
226
+ 13-b-code-cli-run.mov
227
+ 13-c-code-cli-run.mov
228
+ 14-a-support-project-name.mov
229
+ 14-b-support-project-name.mov
230
+ 14-c-support-project-name.mov
231
+ 15-outro.mov
232
+ ```
233
+
234
+ #### Chapters Folder
235
+
236
+ In the chapters folder, such as `a27-ac-categorize-mp4-CI/01-flivideo-project-kickoff/chapters`, recordings are grouped and combined to form complete chapters of the project:
237
+
238
+ - **Compiled Chapters**: Each file represents a combined version of the recordings from the 'recordings' folder, named by their sequence and section, like '01-introduction.mov', '02-overview.mov'.
239
+ - **Cohesive Segments**: These files reflect the culmination of individual recordings and subparts, merged to create cohesive segments of the project or episode.
240
+
241
+ Here is an example from episode 1 of the FliVideo project Podcast.
242
+
243
+ ```bash
244
+ # a27-ac-categorize-mp4-CI/01-flivideo-project-kickoff/chapters
245
+
246
+ 01-introduction.mov
247
+ 02-overview.mov
248
+ 03-role_CI.mov
249
+ 04-gpt-first-attempt.mov
250
+ 05-first-commands.mov
251
+ 06-commands.mov
252
+ 07-commands-goal.mov
253
+ 08-response_CI.mov
254
+ 09-gpt-2nd-attempt.mov
255
+ 10-gpt-goal.mov
256
+ 11-gpt-goal-more.mov
257
+ 12-code-cli.mov
258
+ 13-code-cli-run.mov
259
+ 14-support-project-name.mov
260
+ 15-outro.mov
261
+ ```
262
+
263
+ #### Sample Project #1 - Single Video
264
+
265
+ Example folder structure for single video projects
266
+
267
+ ```bash
268
+ project-name/recordings/01-introduction.mov
269
+ project-name/recordings/02-a-content.mov
270
+ project-name/recordings/02-b-content.mov
271
+ project-name/recordings/03-a-outro.mov
272
+ project-name/recordings/03-b-outro-cta.mov
273
+ project-name/chapters/01-introduction.mov
274
+ project-name/chapters/02-content.mov
275
+ project-name/chapters/03-outro.mov
276
+ ```
277
+
278
+ #### Sample Project #2 - Multiple Episodes
279
+
280
+ Example folder structure for multiple episode projects
281
+
282
+ ```bash
283
+ project-name/01-episode-name/recordings/01-introduction.mov
284
+ project-name/01-episode-name/recordings/02-a-content.mov
285
+ project-name/01-episode-name/recordings/02-b-content.mov
286
+ project-name/01-episode-name/recordings/03-a-outro.mov
287
+ project-name/01-episode-name/recordings/03-b-outro-cta.mov
288
+ project-name/01-episode-name/chapters/01-introduction.mov
289
+ project-name/01-episode-name/chapters/02-content.mov
290
+ project-name/01-episode-name/chapters/03-outro.mov
291
+ ```
292
+
293
+ ```bash
294
+ project-name/02-different-episode-name/recordings/01-introduction.mov
295
+ project-name/02-different-episode-name/recordings/02-content.mov
296
+ project-name/02-different-episode-name/recordings/03-a-outro.mov
297
+ project-name/02-different-episode-name/recordings/03-b-outro-endcards.mov
298
+ project-name/02-different-episode-name/chapters/01-introduction.mov
299
+ project-name/02-different-episode-name/chapters/02-content.mov
300
+ project-name/02-different-episode-name/chapters/03-outro.mov
301
+ ```
302
+
303
+ #### Sample Project #3 - Awaiting descision to keep or trash
304
+
305
+ Example folder structure where there are a bunch of files that I have not yet marked as Good Takes,
306
+ All recordings need to be considered bad takes until I say save, at which time any prior bad takes will be moved to trash
307
+
308
+ 1 project=1 standard video before trash
309
+
310
+ ```bash
311
+ project-name/.trash
312
+ project-name/recordings/01-introduction.mov
313
+ project-name/recordings/02-a-content.mov
314
+ project-name/recordings/02-b-content.mov
315
+ project-name/recordings/03-a-outro.mov
316
+ project-name/recordings/03-b-outro-cta.mov
317
+ project-name/recordings/Ecamm Live Recording on 2023-12-18 at 09.58.55.mov
318
+ project-name/recordings/Ecamm Live Recording on 2023-12-18 at 09.59.38.mov
319
+ project-name/recordings/Ecamm Live Recording on 2023-12-18 at 10.00.03.mov
320
+ project-name/recordings/Ecamm Live Recording on 2023-12-18 at 10.00.26.mov
321
+ project-name/recordings/Ecamm Live Recording on 2023-12-18 at 10.00.55.mov
322
+ project-name/recordings/Ecamm Live Recording on 2023-12-18 at 10.01.30.mov
323
+ project-name/recordings/Ecamm Live Recording on 2023-12-18 at 10.02.25.mov
324
+ project-name/recordings/Ecamm Live Recording on 2023-12-18 at 10.02.56.mov
325
+ ```
326
+
327
+ #### Sample Project #4 - After trash
328
+
329
+ Notice that most of the bad takes have been moved to the trash folder, but the last one was named as 03-c-outro.mov
330
+
331
+ 1 project=1 standard video after trash
332
+
333
+ ```bash
334
+ project-name/.trash/Ecamm Live Recording on 2023-12-18 at 09.58.55.mov
335
+ project-name/.trash/Ecamm Live Recording on 2023-12-18 at 09.59.38.mov
336
+ project-name/.trash/Ecamm Live Recording on 2023-12-18 at 10.00.03.mov
337
+ project-name/.trash/Ecamm Live Recording on 2023-12-18 at 10.00.26.mov
338
+ project-name/.trash/Ecamm Live Recording on 2023-12-18 at 10.00.55.mov
339
+ project-name/.trash/Ecamm Live Recording on 2023-12-18 at 10.01.30.mov
340
+ project-name/.trash/Ecamm Live Recording on 2023-12-18 at 10.02.25.mov
341
+ project-name/recordings/01-introduction.mov
342
+ project-name/recordings/02-a-content.mov
343
+ project-name/recordings/02-b-content.mov
344
+ project-name/recordings/03-a-outro.mov
345
+ project-name/recordings/03-b-outro-cta.mov
346
+ project-name/recordings/03-c-outro.mov
347
+ ```
data/fli.rb ADDED
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Can you just absorb this starter application summary, say yay if you understand.
4
+ # Certainly! Here's a summary of the functionalities implemented in your fli_video.rb application so far:
5
+ # Global Configuration Loading: The application loads global configuration settings from a JSON file located at ~/.fli-video.json. This configuration includes paths like the ecamm-recordings directory and the project-root-folder.
6
+ # Project Configuration Loading: The application is designed to load project-specific configurations from a .fli-video.json or .fv.json file located in the project's root folder. These configurations define folders such as "recordings" and "chapters" specific to each project.
7
+ # Command-Line Interface (CLI): The script uses Ruby's optparse library to parse command-line arguments. This provides a structured way to interact with the application from the terminal.
8
+ # Project Option Handling (-p or --project): The CLI includes an option -p or --project, followed by a project name. This option allows users to specify a project context for the application. The script performs the following actions based on this option:
9
+ # Existing Project: If the specified project already exists under the project-root-folder (defined in the global configuration), the script sets the application to use that project's configuration.
10
+ # New Project Creation: If the specified project does not exist, the application prompts the user to create a new project with the given name. If the user agrees, it creates a subfolder for the project and a .fv.json file within that folder with a predefined configuration structure.
11
+ # User Interaction for Project Creation: When a non-existing project is specified, the application interacts with the user via the command line, asking whether they want to create a new project. If the user confirms, it proceeds with the creation; otherwise, it cancels the operation.
12
+ # Basic Application Structure: The application is structured with a main FliVideo class that handles the overall logic and operation. This class integrates the configuration loading and the CLI options handling.
13
+ # This summary reflects the application's state based on your provided requirements and the code snippets so far. The application is set up to be expanded with more functionalities, such as file handling, video processing, and other features you might require for your project management and video organization tasks.
14
+
15
+
16
+ require 'json'
17
+ require 'optparse'
18
+ require 'pry'
19
+
20
+ # Global configuration
21
+ GLOBAL_CONFIG_PATH = File.expand_path('~/.fli-video.json')
22
+
23
+ # Project-level configuration
24
+ PROJECT_CONFIG_FILENAMES = ['.fli-video.json', '.fv.json']
25
+
26
+ # Class to handle the application configuration
27
+ class Config
28
+ attr_reader :global_config, :project_config
29
+
30
+ def initialize
31
+ @global_config = load_global_config
32
+ end
33
+
34
+ def load_project(project_name)
35
+ @project_config = load_project_config(project_name)
36
+ end
37
+
38
+ private
39
+
40
+ def load_global_config
41
+ if File.exist?(GLOBAL_CONFIG_PATH)
42
+ JSON.parse(File.read(GLOBAL_CONFIG_PATH))
43
+ else
44
+ raise "Global configuration file does not exist."
45
+ end
46
+ end
47
+
48
+ def load_project_config(project_name)
49
+ config_filename = PROJECT_CONFIG_FILENAMES.detect do |filename|
50
+ File.exist?(File.join(project_root_folder, project_name, filename))
51
+ end
52
+
53
+ if config_filename
54
+ JSON.parse(File.read(File.join(project_root_folder, project_name, config_filename)))
55
+ else
56
+ raise "Project configuration file does not exist."
57
+ end
58
+ end
59
+
60
+ def project_root_folder
61
+ @global_config['project-root-folder']
62
+ end
63
+ end
64
+
65
+ # Main Application class
66
+ class FliVideo
67
+ def initialize
68
+ @config = Config.new
69
+ end
70
+
71
+ def run
72
+ # Application logic goes here.
73
+ puts "FLI Video application is running..."
74
+ puts "Global configuration: #{@config.global_config}"
75
+ puts "Project configuration: #{@config.project_config}"
76
+ end
77
+
78
+ def handle_project_option(project_name)
79
+ project_path = File.join(@config.global_config['project-root-folder'], project_name)
80
+
81
+ if Dir.exist?(project_path)
82
+ puts "Setting to existing project configuration..."
83
+ # Logic to set to existing project configuration goes here
84
+ @config.load_project(project_name)
85
+ else
86
+ puts "Do you want to create a project named: #{project_name}? [y/n]"
87
+ answer = STDIN.gets.chomp.downcase
88
+ if answer == 'y'
89
+ create_project_folder(project_path)
90
+ create_project_config(project_path)
91
+ puts "Project '#{project_name}' created."
92
+ else
93
+ puts "Project creation cancelled."
94
+ exit
95
+ end
96
+ @config.load_project(project_name)
97
+ end
98
+ end
99
+
100
+ # Method to create project folder
101
+ def create_project_folder(project_path)
102
+ Dir.mkdir(project_path) unless Dir.exist?(project_path)
103
+ end
104
+
105
+ # Method to create project configuration file
106
+ def create_project_config(project_path)
107
+ config_path = File.join(project_path, '.fv.json')
108
+ config_content = {
109
+ 'folders' => {
110
+ 'recordings' => './recordings',
111
+ 'chapters' => './chapters',
112
+ }
113
+ }
114
+ File.write(config_path, JSON.pretty_generate(config_content))
115
+ end
116
+ end
117
+
118
+ # Command line options parsing
119
+ options = {}
120
+ OptionParser.new do |opts|
121
+ opts.banner = "Usage: fli_video.rb [options]"
122
+
123
+ # Define other options here.
124
+ opts.on("-pPROJECT", "--project=PROJECT", "Specify the project name") do |project|
125
+ options[:project] = project
126
+ end
127
+
128
+ opts.on("-h", "--help", "Prints this help") do
129
+ puts opts
130
+ exit
131
+ end
132
+ end.parse!(ARGV)
133
+
134
+ # Instantiate and run the application
135
+ app = FliVideo.new
136
+ # If the project option is given, handle it before running the app
137
+ app.handle_project_option(options[:project]) if options[:project]
138
+ app.run
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../fli_video'
4
+
5
+ module FliVideo
6
+ # FliVideo::CLI is the command line interface for the FliVideo gem.
7
+ class CLI
8
+ def self.start(args)
9
+ new(args).execute
10
+ end
11
+
12
+ def initialize(args)
13
+ @args = args
14
+ end
15
+
16
+ def execute
17
+ if @args.empty?
18
+ puts 'FliVideo CLI - No command provided'
19
+ return
20
+ end
21
+
22
+ case @args.first
23
+ when 'version'
24
+ puts "FliVideo version #{FliVideo::VERSION}"
25
+ else
26
+ puts "Unknown command: #{@args.first}"
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FliVideo
4
- VERSION = '0.0.2'
4
+ VERSION = '0.1.0'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "fli_video",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "fli_video",
9
- "version": "0.0.2",
9
+ "version": "0.1.0",
10
10
  "devDependencies": {
11
11
  "@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
12
12
  "@semantic-release/changelog": "^6.0.3",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fli_video",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "description": "FliVideo - Video Asset Management for Content Creators",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
@@ -0,0 +1,84 @@
1
+ require 'json'
2
+
3
+ def include_file_content?(file_name, include_content_for)
4
+ include_content_for.any? do |criteria|
5
+ if criteria[:pattern]
6
+ File.fnmatch(criteria[:pattern], file_name)
7
+ elsif criteria[:file]
8
+ criteria[:file] == file_name
9
+ end
10
+ end
11
+ end
12
+
13
+ def list_dir(path, ignore_folders, ignore_files, include_content_for)
14
+ entries = Dir.entries(path) - %w[. ..] - ignore_folders - ignore_files
15
+ entries.map do |entry|
16
+ full_path = File.join(path, entry)
17
+ if File.directory?(full_path)
18
+ { name: entry, type: 'directory', children: list_dir(full_path, ignore_folders, ignore_files, include_content_for) }
19
+ else
20
+ file_info = { name: entry, type: 'file' }
21
+ file_info[:content] = File.read(full_path) if include_file_content?(entry, include_content_for)
22
+ file_info
23
+ end
24
+ end
25
+ rescue => e
26
+ puts "Error reading directory #{path}: #{e.message}"
27
+ []
28
+ end
29
+
30
+ def write_structure_to_file(file_name, structure)
31
+ File.open(file_name, 'w') do |file|
32
+ file.write(JSON.pretty_generate(structure))
33
+ end
34
+ rescue => e
35
+ puts "Error writing to file #{file_name}: #{e.message}"
36
+ end
37
+
38
+ def build_gpt_content(structure, path = '')
39
+ gpt_content = ''
40
+ structure.each do |item|
41
+ full_path = path.empty? ? item[:name] : File.join(path, item[:name])
42
+
43
+ if item[:type] == 'file'
44
+ gpt_content += "File: #{full_path}\n" # Line 1: Path/File name
45
+ gpt_content += "#{item[:content]}\n" if item.key?(:content) # Line 2: Content (if exists)
46
+ gpt_content += "\n" # Line 3: Blank line
47
+ elsif item[:type] == 'directory'
48
+ gpt_content += build_gpt_content(item[:children], full_path) # Recursively handle directories
49
+ end
50
+ end
51
+ gpt_content
52
+ end
53
+
54
+ # Usage example:
55
+ ignore_folders = ['tmp', 'log', '.git', '.githooks', '.github', 'bin', 'sig', 'node_modules', '.builders', 'docs', 'scripts']
56
+ ignore_files = [
57
+ 'fli.rb',
58
+ 'application-structure.json',
59
+ '.releaserc.json',
60
+ 'CODE_OF_CONDUCT.md',
61
+ 'Guardfile',
62
+ '.rspec',
63
+ 'CHANGELOG.md',
64
+ '.tool-versions',
65
+ 'Rakefile',
66
+ 'Gemfile.lock',
67
+ '.gitignore',
68
+ 'package-lock.json',
69
+ 'package.json',
70
+ '.rubocop.yml',
71
+ 'LICENSE.txt',
72
+ 'fli_video.gemspec',
73
+ '01-get-structure.rb'
74
+ ]
75
+ include_content_for = [
76
+ { pattern: '*.rb' },
77
+ ]
78
+
79
+ structure = list_dir('.', ignore_folders, ignore_files, include_content_for)
80
+ write_structure_to_file('docs/generated/application-structure.json', structure)
81
+
82
+ gpt_content = build_gpt_content(structure)
83
+ # puts gpt_content
84
+ IO.popen('pbcopy', 'w') { |io| io.puts gpt_content }
@@ -0,0 +1,38 @@
1
+ require 'json'
2
+
3
+ def read_file(file_name)
4
+ puts "Reading file #{file_name}"
5
+ File.read(file_name)
6
+ rescue => e
7
+ puts "Error reading file #{file_name}: #{e.message}"
8
+ ''
9
+ end
10
+
11
+ def read_klue_files(path)
12
+ klue_content = ''
13
+ Dir.glob(File.join(path, '*.klue')).each do |file|
14
+ klue_content += "Klue Component: `#{File.basename(file)}`\n"
15
+ klue_content += "\n```ruby\n"
16
+ klue_content += read_file(file)
17
+ klue_content += "```\n\n"
18
+ end
19
+ klue_content
20
+ end
21
+
22
+ def write_features_and_components_to_file(file_name, features_content, klue_content)
23
+ File.open(file_name, 'w') do |file|
24
+ file.write(features_content)
25
+ file.write("\n\n## Klue Components\n\n")
26
+ file.write(klue_content)
27
+ end
28
+ rescue => e
29
+ puts "Error writing to file #{file_name}: #{e.message}"
30
+ end
31
+
32
+ # Main execution
33
+ features_content = read_file('docs/feature-list.md')
34
+ klue_content = read_klue_files('.builders/klues')
35
+
36
+ write_features_and_components_to_file('docs/generated/features-and-components.md', features_content, klue_content)
37
+
38
+ IO.popen('pbcopy', 'w') { |io| io.puts File.read('docs/generated/features-and-components.md') }