Skip to content

Commit a19d480

Browse files
committed
20261122-194157: introduce drop_chapter
1 parent 6781f12 commit a19d480

5 files changed

Lines changed: 69 additions & 29 deletions

File tree

‎markut.go‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,24 @@ func main() {
16421642
return true
16431643
},
16441644
},
1645-
"removed": {
1645+
"drop_chapter": {
1646+
Description: "Remove the last defined chapter$SPOILER$. Useful for disabling a certain chapter, so you can reenable it later if needed.",
1647+
Signature: "--",
1648+
Category: "Chapter",
1649+
Run: func(context *EvalContext, command string, token Token) bool {
1650+
if len(context.chapStack) > 0 {
1651+
context.chapStack = context.chapStack[:len(context.chapStack)-1]
1652+
return true
1653+
}
1654+
if len(context.chapters) > 0 {
1655+
context.chapters = context.chapters[:len(context.chapters)-1]
1656+
return true
1657+
}
1658+
fmt.Printf("%s: ERROR: no chapters defined for removal\n", token.Loc)
1659+
return false
1660+
},
1661+
},
1662+
"drop_chunk": {
16461663
Description: "Remove the last defined chunk$SPOILER$. Useful for disabling a certain chunk, so you can reenable it later if needed.",
16471664
Signature: "--",
16481665
Category: "Chunk",
@@ -1869,7 +1886,7 @@ func main() {
18691886
},
18701887
"chapter": {
18711888
Description: "Define a new YouTube chapter for within a chunk for `markut summary` command.",
1872-
Category: "Misc",
1889+
Category: "Chapter",
18731890
Signature: "<timestamp:Timestamp> <title:String> --",
18741891
Run: func(context *EvalContext, command string, token Token) bool {
18751892
args, err := context.typeCheckArgs(token.Loc, TokenString, TokenTimestamp)

‎tasks/20261122-194157/TASK.md‎

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Disable chapters through func
22

3-
- STATUS: OPEN
3+
- STATUS: CLOSED
44
- PRIORITY: 100
5-
- TAGS: scope
65

76
```
87
<timestamp> "Ignored chapter" chapter_ignore
@@ -13,31 +12,12 @@ The only thing you need to do is `s/chapter/chapter_ignore` and vise versa.
1312

1413
---
1514

16-
There is another idea I had. An `ignore` magical function that works on anything.
17-
18-
```
19-
<timestamp> "Ignored chapter" ignore chapter
20-
<start> <end> ignore chunk
21-
```
22-
23-
What it does is executes the next function after it making it consume and verify its arguments
24-
but completely supresses its effect. I'm not sure how to implement this though.
15+
TASK(20261125-151329) is an interesting idea, but it will take too much time
16+
to implement and I'm not even sure if it's worth it.
2517

2618
---
2719

28-
But what will happen if you do `ignore` twice?
29-
30-
```
31-
... ignore ignore chunk
32-
```
20+
We already have `drop` which works on argument stack.
21+
I think for the sake of consistency we should introduce `drop_chapter`
22+
and rename `removed` to `drop_chunk`.
3323

34-
Does it `ignore` the `ignore` effectively cancelling it out?
35-
Sounds like a reasonable thing to do in this case actually.
36-
37-
---
38-
39-
You should also be able to ignore certain arguments this way
40-
41-
```
42-
ignore <timestamp> // "ignores" so it's consumed but never pushed onto the argument stack
43-
```

‎tasks/20261122-194158/TASK.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Allow rendering chunks in parallel
22

33
- STATUS: OPEN
4-
- PRIORITY: 100
4+
- PRIORITY: 99
55
- TAGS: scope
6+
7+
Which means that instead of using `unfinished-chunk.mp4` we should come up with a unique name per rendered chunk.
8+
9+
Maybe it should be based on TASK(20261122-194210)? Basically `chunks/<hash>-unfinished.mp4`.

‎tasks/20261122-194210/TASK.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
- STATUS: OPEN
44
- PRIORITY: 100
55
- TAGS: scope
6+
7+
Should probably use a better hash function though. Something like sha1.

‎tasks/20261125-151329/TASK.md‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Ignore effect
2+
3+
- STATUS: OPEN
4+
- PRIORITY: 100
5+
6+
Moved out TASK(20261122-194157).
7+
8+
---
9+
10+
There is an idea I had. An `ignore` magical function that works on anything.
11+
12+
```
13+
<timestamp> "Ignored chapter" ignore chapter
14+
<start> <end> ignore chunk
15+
```
16+
17+
What it does is executes the next function after it making it consume and verify its arguments
18+
but completely supresses its effect. I'm not sure how to implement this though.
19+
20+
---
21+
22+
But what will happen if you do `ignore` twice?
23+
24+
```
25+
... ignore ignore chunk
26+
```
27+
28+
Does it `ignore` the `ignore` effectively cancelling it out?
29+
Sounds like a reasonable thing to do in this case actually.
30+
31+
---
32+
33+
You should also be able to ignore certain arguments this way
34+
35+
```
36+
ignore <timestamp> // "ignores" so it's consumed but never pushed onto the argument stack
37+
```

0 commit comments

Comments
 (0)