tscripter 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07b2b5f211bd76bacfce348ca69be7b641dd7163
4
- data.tar.gz: 10456f0151e1d6e577628060c08ceb8901190039
3
+ metadata.gz: 313653814cd5a9837b7d68eef157798c989801f3
4
+ data.tar.gz: 1516a38bd9f606d27d5ea40943313d116a4993c6
5
5
  SHA512:
6
- metadata.gz: f1bd2a76d12c8a504fc198aa402efd5f7fdf768c377d73bc517b8752f8ab886cd6b5a34fa1542f68dd2d6d17587173836b86c69e224ad7758baa363a6c0d9bd2
7
- data.tar.gz: b989478276db9c255961944df33f551f52a3c1ce17ec7b0d61f537bf6000ecf54de3d9c6563d7678b15bd7abe78785d76a1dcbd23d8fd710f38f0ff5c8a8a57e
6
+ metadata.gz: 4267ee3298c0afe598f7acada5ddf49f1ffc45b175302ee4c15b4b7d59c2fa7f4647b0d3ee1a122d8cb462b5bb84234037361aee66eeb36ab52592f184bd27ed
7
+ data.tar.gz: b131ce9dedb922955137eed63d48e313ee9400d72a7e9b7aaa3c7ece57edfc8c18533849a8824ffc94acba6f14ca724de203c5143e110ab2226621d7730a5bcb
data/README.md CHANGED
@@ -1,23 +1,78 @@
1
1
  # Tscripter
2
2
 
3
- This gem edits transcript files, given that they are in the expected format.
3
+ This gem edits transcript files. Files must be plaintext (.txt).
4
4
 
5
- Current features:
6
- - Prepends alternating IDs to spoken lines
7
- - Detect spoken lines that start with stage directions
8
- - Implement notation for consecutive lines by the same speaker
5
+ ## Current features:
6
+ - Prepend alternating IDs to spoken lines
9
7
  - If a line starts with `^`, then the speaker is the same as the previous line
10
- - The pattern `*i 00:00` (where 00:00 is any timestamp) is replaced with `inaudible [00:00]
11
-
12
- Planned features:
8
+ - Example:
9
+ ```
10
+ You've changed, Heathcliff...
11
+ [looks to the moon]
12
+ ^ ...and I don't know who you are anymore.
13
+ That's not true!
14
+ ```
15
+ becomes...
16
+ ```
17
+ Cathy: You've changed, Heathcliff...
18
+ [looks to the moon]
19
+ Cathy: ...and I don't know who you are anymore.
20
+ Heathcliff: That's not true!
21
+ ```
22
+
23
+ - Replace pattern `*i MM:SS` (where MM:SS is any timestamp) with `inaudible [MM:SS]`
24
+ - Example:
25
+ ```
26
+ But what if *i 10:05 to the end?
27
+ ```
28
+ becomes...
29
+ ```
30
+ Heathcliff: But what if [inaudible 10:05] to the end?
31
+ ```
32
+ - Note: Currently only supports MM:SS timestamps, not HH:MM:SS
33
+
34
+ - Lines that contain _only_ stage directions (text inside [square brackets]) are left intact
35
+
36
+ - Lines that contain _only_ whitespace are left intact
37
+
38
+ ## Sample input and output
39
+
40
+ Input:
41
+ ```
42
+ Hello there.
43
+
44
+ Hello to you too.
45
+
46
+ Lovely night on the moors.
47
+ [uncomfortable silence]
48
+ This is splendid, don't you agree?
49
+ I mean, I would never...
50
+ [pause]
51
+ ^ disagree with you.
52
+ But what if *i 45:09 tomorrow?
53
+ [turns away] You can't mean that!
54
+ ```
55
+
56
+ Output:
57
+ ```
58
+ Heathcliff: Hello there.
59
+
60
+ Cathy: Hello to you too.
61
+
62
+ Heathcliff: Lovely night on the moors.
63
+ [uncomfortable silence]
64
+ Cathy: This is splendid, don't you agree?
65
+ Heathcliff: I mean, I would never...
66
+ [pause]
67
+ Heathcliff: disagree with you.
68
+ Cathy: But what if [inaudible 45:09] tomorrow?
69
+ Heathcliff: [turns away] You can't mean that!
70
+ ```
71
+
72
+ ## Planned features:
13
73
  - Accept multiple filenames
14
74
  - Accept wildcard filenames
15
-
16
- Expected format:
17
- - File must be .txt
18
- - Speakers of each line must alternate
19
- - Lines that start with square brackets (stage directions) will be skipped
20
- - Whitespace lines are skipped
75
+ - Support HH:MM:SS timestamps
21
76
 
22
77
  ## Installation
23
78
 
@@ -25,9 +80,9 @@ Expected format:
25
80
 
26
81
  ## Usage
27
82
 
28
- $ tscripter filename.txt AAA BBB
83
+ $ tscripter filename.txt Heathcliff Cathy
29
84
 
30
- AAA and BBB are the IDs to prepend.
85
+ `Heathcliff` and `Cathy` are the IDs to prepend.
31
86
 
32
87
  ## Development
33
88
 
data/lib/tscripter.rb CHANGED
@@ -72,14 +72,14 @@ module Tscripter
72
72
 
73
73
  def remove_markup(line)
74
74
  if line[0] == '^'
75
- line = line.slice(/\^\s(.*)/, 1)
75
+ line = line.slice(/\^\s*(.*)/, 1)
76
76
  else
77
77
  line
78
78
  end
79
79
  end
80
80
 
81
81
  def add_inaudible_notation(line)
82
- line.scan(/\*[iI]\s\d{1,2}\:\d{1,2}/) do |inaud_markup|
82
+ line.scan(/\*[iI]\s*\d{1,2}\:\d{1,2}/) do |inaud_markup|
83
83
  timestamp = inaud_markup.match(/(\d{1,2}\:\d{1,2})/)[1]
84
84
  inaudible_notation = "[inaudible #{timestamp}]"
85
85
  line = line.gsub(inaud_markup, inaudible_notation)
@@ -1,3 +1,3 @@
1
1
  module Tscripter
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/test_input.txt CHANGED
@@ -1,13 +1,13 @@
1
- This is a line.
1
+ Hello there.
2
2
 
3
- This is another line.
3
+ Hello to you too.
4
4
 
5
- Oh look, another line!
6
- [simultaneously]
7
- This is fun!
8
- I agree!
9
- I mean right?
10
- ^ Yup!
5
+ I can't read books anymore.
6
+ [uncomfortable silence]
7
+ This is fun, don't you agree?
8
+ I mean, I would never...
9
+ [pause]
10
+ ^ disagree with you.
11
11
  But what if *i 45:09
12
12
  [turns away] You can't really mean that!
13
13
 
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tscripter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - A. M.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-11 00:00:00.000000000 Z
11
+ date: 2018-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,10 +70,10 @@ files:
70
70
  - bin/console
71
71
  - bin/setup
72
72
  - bin/tscripter
73
- - lib/test_input.txt
74
73
  - lib/tscripter.rb
75
74
  - lib/tscripter/version.rb
76
75
  - test_input.txt
76
+ - tscripter-0.1.1.gem
77
77
  - tscripter.gemspec
78
78
  homepage: https://github.com/ichthala/tscripter
79
79
  licenses:
data/lib/test_input.txt DELETED
@@ -1,11 +0,0 @@
1
- This is a line.
2
-
3
- This is another line.
4
-
5
- Oh look, another line!
6
- [simultaneously]
7
- This is fun!
8
- I agree!
9
- I mean right?
10
- Yup!
11
-