bjsi / bjsi/youtube-dl-split-chapters
Prefix chapter title with chapter index
- Dominant language
- Python
- Stars
- 56
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
I also tweecked a 'quick & dirty' numbering mod.
```python
def create_chapter(self, chapter, i) -> bool:
start = chapter["start_time"]
end = chapter["end_time"]
diff = end - start
args = [
"ffmpeg",
"-i", self.file.media_filepath,
"-ss", str(start),
"-t", str(diff),
"-acodec", "copy",
"-vcodec", "copy",
self.file.output_chapter_file(str(i) + "-" + chapter["title"])
]
ret = subprocess.run(args)
return ret.returncode == 0
```
Called as follows. A bit ugly.
```python
def split_into_chapters(self):
if not self.file.chapters:
self.log("No chapters available.")
return False
if not self.file.create_output_folder():
self.log("Failed to create output folder.")
return False
for i, chapter in enumerate(self.file.chapters):
if not self.create_chapter(chapter, i):
self.log("Failed to create chapter " + i + " file: " + chapter["title"])
return True
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate create_chapter and split_into_chapters in the Python project, then read how chapter metadata and output paths are handled. Run the existing chapter-splitting flow and verify that generated chapter filenames begin with their chapter index while splitting still succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100