File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1334,6 +1334,37 @@ var Subcommands = map[string]Subcommand{
13341334 return true
13351335 },
13361336 },
1337+ "chapters" : {
1338+ Description : "Generate YouTube chapters list that is easily copy-pastable to the Video Description" ,
1339+ Run : func (commandName string , args []string ) bool {
1340+ subFlag := flag .NewFlagSet (commandName , flag .ContinueOnError )
1341+ markutPtr := subFlag .String ("markut" , "MARKUT" , "Path to the MARKUT file" )
1342+
1343+ err := subFlag .Parse (args )
1344+
1345+ if err == flag .ErrHelp {
1346+ return true
1347+ }
1348+
1349+ if err != nil {
1350+ fmt .Printf ("ERROR: Could not parse command line arguments: %s\n " , err )
1351+ return false
1352+ }
1353+
1354+ context , ok := defaultContext ()
1355+ ok = ok && context .evalMarkutFile (nil , * markutPtr , false ) && context .finishEval ()
1356+ if ! ok {
1357+ return false
1358+ }
1359+
1360+ fmt .Printf ("Chapters:\n " );
1361+ for _ , chapter := range context .chapters {
1362+ fmt .Printf ("- %s - %s\n " , millisToYouTubeTs (chapter .Timestamp ), chapter .Label )
1363+ }
1364+
1365+ return true
1366+ },
1367+ },
13371368}
13381369
13391370func usage () {
You can’t perform that action at this time.
0 commit comments