Download Jar. Libraryless. Click here for Pure Java version (6721L/48K).
!7 p-exp { new L<PairS> out1; for (S line : tlft(userDir("Documents/give it away.txt"))) { continue if startsWith(line, "["); PairS p = splitAtFirstSpace(line); continue unless p != null; if (!regexpMatches("\\d:\\d\\d", p.a)) continue with print("Weird: " + p); out1.add(p); } new LS out; for i over out1: { PairS p = out1.get(i); S nextTime = pairA(get(out1, i+1)); int minute = parseInt(substring(p.a, 0, 1)); int second = parseInt(substring(p.a, 2)); second += 2; if (second >= 60) { second -= 60; ++minute; } S endTime = minute + ":" + formatInt(second, 2); if (nextTime != null && cmp(endTime, nextTime) > 0) endTime = nextTime; out.add(""); out.add(str(i+1)); out.add("00:0" + p.a + ",000 --> 00:0" + endTime + ",000"); out.add(p.b); } printLines(out); saveTextFileVerbose(programDir("give it away.srt"), lines(out)); }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023389 |
Snippet name: | Make .srt from text file |
Eternal ID of this version: | #1023389/6 |
Text MD5: | 0e4d6b8106f0e54f43a5ea8b488274c6 |
Transpilation MD5: | f396b4f0b3a8009a0325043d3273fcf0 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-06-16 01:29:52 |
Source code size: | 956 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 358 / 1068 |
Version history: | 5 change(s) |
Referenced in: | -