tscripter 0.1.0
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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/tscripter +6 -0
- data/lib/test_input.txt +11 -0
- data/lib/tscripter.rb +57 -0
- data/lib/tscripter/version.rb +3 -0
- data/test_input.txt +11 -0
- data/tscripter.gemspec +33 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9027856dc86868bb991a34c30472780bd05f81f3
|
4
|
+
data.tar.gz: 65c56d380abd7c08b9d976e0a5451a22f793d2b0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3030aacac118dba2450245e2bb6c74df4534fe36d859ea7fcacce65962cf6275361e691bf662f17d72c776035de8be1fd7eb5abc15eb4e467784f929c806d132
|
7
|
+
data.tar.gz: cb4d127d1ca7376c2c388fce81f9a940ca0db6d572ec563b8120151f38bf090df4c7430e64a60f767e7e88990eb77882893b870ecc2009ddfc9c31562335c602
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 TODO: Write your name
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Tscripter
|
2
|
+
|
3
|
+
This gem edits transcript files, given that they are in the expected format.
|
4
|
+
|
5
|
+
Current features:
|
6
|
+
- Prepends alternating IDs to spoken lines
|
7
|
+
|
8
|
+
Planned features:
|
9
|
+
- Detect spoken lines that start with stage directions
|
10
|
+
- Implement notation for consecutive lines by the same speaker
|
11
|
+
- Accept multiple filenames
|
12
|
+
- Accept wildcard filenames
|
13
|
+
|
14
|
+
Expected format:
|
15
|
+
- File must be .txt
|
16
|
+
- Speakers of each line must alternate
|
17
|
+
- Lines that start with square brackets (stage directions) will be skipped
|
18
|
+
- Whitespace lines are skipped
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
$ gem install tscripter
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
$ tscripter filename.txt AAA BBB
|
27
|
+
|
28
|
+
AAA and BBB are the IDs to prepend.
|
29
|
+
|
30
|
+
## Development
|
31
|
+
|
32
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
33
|
+
|
34
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ichthala/tscripter.
|
39
|
+
|
40
|
+
## License
|
41
|
+
|
42
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
43
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "tscripter"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/bin/tscripter
ADDED
data/lib/test_input.txt
ADDED
data/lib/tscripter.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require "tscripter/version"
|
3
|
+
|
4
|
+
module Tscripter
|
5
|
+
class Runner
|
6
|
+
def go
|
7
|
+
puts(go_with_args(ARGV))
|
8
|
+
end
|
9
|
+
|
10
|
+
def go_with_args(args)
|
11
|
+
if filename = args[0]
|
12
|
+
file_basename = File.basename(filename, File.extname(filename))
|
13
|
+
id1 = args[1]
|
14
|
+
id2 = args[2]
|
15
|
+
|
16
|
+
return "Please supply two ID arguments." if (id1.nil? || id2.nil?)
|
17
|
+
|
18
|
+
transcript_text = File.new(filename).read
|
19
|
+
|
20
|
+
edited_file_content = generate_edited_text(transcript_text, id1, id2)
|
21
|
+
|
22
|
+
edited_file = File.new("#{file_basename}_edited_#{Time.now.to_i}.txt", "w")
|
23
|
+
edited_file.write(edited_file_content)
|
24
|
+
edited_file.close
|
25
|
+
|
26
|
+
"Transcript edit complete."
|
27
|
+
else
|
28
|
+
"Please supply a filename."
|
29
|
+
end
|
30
|
+
rescue IOError
|
31
|
+
"ERROR: File named #{args[0]} does not exist in this directory.\nPlease supply a valid filename."
|
32
|
+
end
|
33
|
+
|
34
|
+
def generate_edited_text(text, id1, id2)
|
35
|
+
edited_text = ""
|
36
|
+
use_id1 = true
|
37
|
+
|
38
|
+
text.split("\n").each do |line, i|
|
39
|
+
if line[0] == "[" || line.strip == ""
|
40
|
+
edited_text << "#{line}\n"
|
41
|
+
next
|
42
|
+
end
|
43
|
+
|
44
|
+
if use_id1
|
45
|
+
edited_text << "#{id1}: #{line}\n"
|
46
|
+
else
|
47
|
+
edited_text << "#{id2}: #{line}\n"
|
48
|
+
end
|
49
|
+
|
50
|
+
use_id1 = !use_id1
|
51
|
+
end
|
52
|
+
|
53
|
+
edited_text
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
data/test_input.txt
ADDED
data/tscripter.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tscripter/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "tscripter"
|
8
|
+
spec.version = Tscripter::VERSION
|
9
|
+
spec.authors = ["A. M."]
|
10
|
+
spec.email = ["ichthala@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{This gem edits transcript files.}
|
13
|
+
spec.description = %q{This gem edits transcript files.}
|
14
|
+
spec.homepage = "https://github.com/ichthala/tscripter"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "bin"
|
27
|
+
spec.executables = ["tscripter"]
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tscripter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- A. M.
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-10-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: This gem edits transcript files.
|
56
|
+
email:
|
57
|
+
- ichthala@gmail.com
|
58
|
+
executables:
|
59
|
+
- tscripter
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- bin/tscripter
|
73
|
+
- lib/test_input.txt
|
74
|
+
- lib/tscripter.rb
|
75
|
+
- lib/tscripter/version.rb
|
76
|
+
- test_input.txt
|
77
|
+
- tscripter.gemspec
|
78
|
+
homepage: https://github.com/ichthala/tscripter
|
79
|
+
licenses:
|
80
|
+
- MIT
|
81
|
+
metadata:
|
82
|
+
allowed_push_host: https://rubygems.org
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.4.8
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: This gem edits transcript files.
|
103
|
+
test_files: []
|