anki2 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +108 -0
- data/Rakefile +2 -0
- data/anki2.gemspec +26 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/anki2.rb +231 -0
- data/lib/anki2/version.rb +3 -0
- data/lib/template.sql +77 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 76a0d81d75d8db6ae69ed4bbd4647472ad9f32e7
|
4
|
+
data.tar.gz: 32c738b51aa65a0d16937fb5583c860bfa7bbf6b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 90cbcaf97c3aa91ff64603df7311abd95bfe1f7c5b5ae1f4c959329ab5b17e922ff1dfaa5bb98e62be8ff0bd28442bcc14800a0acbfea380a21a0ebc8690f4ae
|
7
|
+
data.tar.gz: 326a84dd126d86d01e60a3d08f2a9720c0a13fdfbc62ef33b9844ccf2ae5ca00c2466836716c567ffb18b7ce846694fc9d942029ac3126fa991ae48e3b7f5e03
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Albert Zak
|
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,108 @@
|
|
1
|
+
# Anki<sup>2</sup>
|
2
|
+
|
3
|
+
Create Anki Flashcards with Ruby! Supports images, audio, HTML and CSS.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'anki2'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
Let's make your first deck.
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
@anki = Anki2.new
|
23
|
+
@anki.add_card('Are Walruses magical?', 'Yes')
|
24
|
+
@anki.add_card('What animals are magical?', 'Unicorns and Walruses')
|
25
|
+
@anki.save
|
26
|
+
```
|
27
|
+
|
28
|
+
This will save the deck in the default location `anki/deck.apkg`.
|
29
|
+
Change the output path like this:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
@anki = Anki2.new({
|
33
|
+
name: 'Magical Animals',
|
34
|
+
output_path: 'public/MagicalAnimals.apkg'
|
35
|
+
})
|
36
|
+
```
|
37
|
+
|
38
|
+
Congratulations!
|
39
|
+
|
40
|
+
### Images
|
41
|
+
|
42
|
+
Let's make a flashcard with an image. Put a picture of a blobfish ([here's one](http://conservationmagazine.org/wordpress/wp-content/uploads/2013/11/blobfish.jpg)) into a subfolder called `images`.
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
@anki = Anki2.new
|
46
|
+
@anki.add_card(
|
47
|
+
'What is this animal called? <img src="blobfish.jpg">',
|
48
|
+
'A Blobfish'
|
49
|
+
)
|
50
|
+
@anki.add_media('images/blobfish.jpg')
|
51
|
+
@anki.save
|
52
|
+
```
|
53
|
+
|
54
|
+
Yay! If you have a lot of cards with a lot of images, just call `add_media` once and give it a path to the directory that contains your media. All the files from that directory will be included and are available in the deck, like so:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
@anki.add_card('<img src="front.jpg">','<img src="back.jpg">')
|
58
|
+
@anki.add_media('images')
|
59
|
+
@anki.save
|
60
|
+
```
|
61
|
+
|
62
|
+
### Audio
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
@anki = Anki2.new
|
66
|
+
@anki.add_card('よ[audio:yo.mp3]','yo')
|
67
|
+
@anki.add_media('yo.mp3')
|
68
|
+
@anki.save
|
69
|
+
```
|
70
|
+
|
71
|
+
### CSS + HTML
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
@anki = Anki2.new(css: '.kanji { font-size: 88px; }')
|
75
|
+
@anki.add_card('<span class="kanji">大</span>', 'Big')
|
76
|
+
@anki.save
|
77
|
+
```
|
78
|
+
|
79
|
+
Feel free to get crazy.
|
80
|
+
|
81
|
+
## Development
|
82
|
+
|
83
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
84
|
+
|
85
|
+
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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
86
|
+
|
87
|
+
## Bugs
|
88
|
+
|
89
|
+
Here's a list of things that don't work yet:
|
90
|
+
|
91
|
+
- Tags
|
92
|
+
- Subdecks
|
93
|
+
- Modifying the model: fields and card templates
|
94
|
+
- Reading/Modifying existing decks
|
95
|
+
- The structure of the code could use some love
|
96
|
+
- And maybe add some tests?
|
97
|
+
|
98
|
+
Much Love to you if you contribute and fix one of them.
|
99
|
+
Or just open an issue here if you really want to do something that the gem doesn't do yet - I'll be glad to help.
|
100
|
+
|
101
|
+
## Contributing
|
102
|
+
|
103
|
+
1. Fork it ( https://github.com/[my-github-username]/anki2/fork )
|
104
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
105
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
106
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
107
|
+
5. Create a new Pull Request
|
108
|
+
6. Thank you 💕
|
data/Rakefile
ADDED
data/anki2.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'anki2/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'anki2'
|
8
|
+
spec.version = Anki2::VERSION
|
9
|
+
spec.authors = ['Albert Zak']
|
10
|
+
spec.email = ['me@albertzak.com']
|
11
|
+
|
12
|
+
spec.summary = 'Create Anki Flashcards with Ruby! Supports images, audio, HTML and CSS.'
|
13
|
+
spec.description = 'Build multimedia *.apkg Flashcards for use with the Anki (http://ankisrs.net) Spaced Repetition Software (SRS)'
|
14
|
+
spec.homepage = 'https://github.com/albertzak/anki2'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.8'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_runtime_dependency 'sqlite3', '~> 1.3.3'
|
25
|
+
spec.add_runtime_dependency 'rubyzip', '~> 1.1.7'
|
26
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "anki2"
|
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/lib/anki2.rb
ADDED
@@ -0,0 +1,231 @@
|
|
1
|
+
require 'anki2/version'
|
2
|
+
require 'json'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'digest/sha1'
|
5
|
+
require 'sqlite3'
|
6
|
+
require 'zip'
|
7
|
+
|
8
|
+
class Anki2
|
9
|
+
|
10
|
+
SEPARATOR = "\u001F"
|
11
|
+
|
12
|
+
attr_accessor :options
|
13
|
+
|
14
|
+
def initialize(options = {})
|
15
|
+
@options = {
|
16
|
+
output_path: File.join('anki', 'deck.apkg'),
|
17
|
+
name: 'Anki2 Rubygem Deck',
|
18
|
+
template_sql_path: File.join(File.dirname(__FILE__), 'template.sql'),
|
19
|
+
}.merge(options)
|
20
|
+
|
21
|
+
@options[:model_name] = @options[:name] unless @options[:model_name]
|
22
|
+
@options[:css] = default_css + @options[:css].to_s
|
23
|
+
@options[:model] = model_config.call(default_model) if block_given?
|
24
|
+
|
25
|
+
@media = []
|
26
|
+
|
27
|
+
FileUtils.mkdir_p(File.dirname(@options[:output_path]))
|
28
|
+
@tmpdir = Dir.mktmpdir
|
29
|
+
|
30
|
+
@db = SQLite3::Database.open(File.join(@tmpdir, 'collection.anki2'))
|
31
|
+
@db.execute_batch File.read(@options[:template_sql_path])
|
32
|
+
|
33
|
+
@top_deck_id = rand(10**13)
|
34
|
+
decks = @db.execute('select decks from col')
|
35
|
+
decks = JSON.parse(decks.first.first.gsub('\"', '"'))
|
36
|
+
deck = decks.delete(decks.keys.last)
|
37
|
+
deck['name'] = @options[:name]
|
38
|
+
deck['id'] = @top_deck_id
|
39
|
+
decks[@top_deck_id.to_s] = deck
|
40
|
+
@db.execute('update col set decks=? where id=1', decks.to_json)
|
41
|
+
|
42
|
+
@top_model_id = rand(10**13)
|
43
|
+
models = @db.execute('select models from col')
|
44
|
+
models = JSON.parse(models.first.first.gsub('\"', '"'))
|
45
|
+
model = models.delete(models.keys.first)
|
46
|
+
|
47
|
+
if @options[:model]
|
48
|
+
model = @options[:model]
|
49
|
+
else
|
50
|
+
model['name'] = @options[:model_name]
|
51
|
+
model['css'] = @options[:css]
|
52
|
+
end
|
53
|
+
|
54
|
+
model['did'] = @top_deck_id
|
55
|
+
model['id'] = @top_model_id
|
56
|
+
models[@top_model_id.to_s] = model
|
57
|
+
@db.execute('update col set models=? where id=1', models.to_json)
|
58
|
+
end
|
59
|
+
|
60
|
+
def find_or_create_deck(deck_name)
|
61
|
+
existing_decks = {}
|
62
|
+
|
63
|
+
decks = @db.execute('select decks from col')
|
64
|
+
decks = JSON.parse(decks.first.first.gsub('\"', '"'))
|
65
|
+
decks.each_pair do |id, deck|
|
66
|
+
next if id.eql?(1)
|
67
|
+
existing_decks[deck['name']] = id
|
68
|
+
end
|
69
|
+
|
70
|
+
if existing_decks.keys.any? { |name| name.eql?(deck_name) }
|
71
|
+
id = existing_decks[deck_name]
|
72
|
+
else
|
73
|
+
id = rand(10**13)
|
74
|
+
new_deck = decks[decks.keys.last]
|
75
|
+
new_deck['name'] = deck_name
|
76
|
+
new_deck['id'] = id
|
77
|
+
decks[id.to_s] = new_deck
|
78
|
+
@db.execute('update col set decks=? where id=1', decks.to_json)
|
79
|
+
add_model_for_deck(id)
|
80
|
+
end
|
81
|
+
|
82
|
+
id
|
83
|
+
end
|
84
|
+
|
85
|
+
def add_card(front, back, tags = [], deck = nil)
|
86
|
+
|
87
|
+
if deck.is_a?(String)
|
88
|
+
deck = [@options[:name], deck].join('::')
|
89
|
+
puts deck
|
90
|
+
deck_id = find_or_create_deck(deck)
|
91
|
+
elsif deck.is_a?(Integer)
|
92
|
+
deck_id = deck
|
93
|
+
else
|
94
|
+
deck_id = @top_deck_id
|
95
|
+
end
|
96
|
+
|
97
|
+
note_id = rand(10**13)
|
98
|
+
tags = tags.map { |t| t.tr(' ','_')}.join(' ')
|
99
|
+
|
100
|
+
@db.execute "insert into notes values(?,?,?,?,?,?,?,?,?,?,?)",
|
101
|
+
note_id,
|
102
|
+
rand(10**10).to_s(36),
|
103
|
+
@top_model_id,
|
104
|
+
Time.now.to_i,-1,
|
105
|
+
tags,
|
106
|
+
front + SEPARATOR + back,
|
107
|
+
strip_html(front),
|
108
|
+
checksum(strip_html(front+SEPARATOR+back)),
|
109
|
+
0,''
|
110
|
+
|
111
|
+
@db.execute "insert into cards values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
112
|
+
rand(10**13),
|
113
|
+
note_id,
|
114
|
+
deck_id,
|
115
|
+
0,
|
116
|
+
Time.now.to_i,
|
117
|
+
-1,0,0,179,0,0,0,0,0,0,0,0,''
|
118
|
+
|
119
|
+
true
|
120
|
+
end
|
121
|
+
|
122
|
+
def add_media(media_path)
|
123
|
+
if File.directory?(media_path)
|
124
|
+
Dir.glob(File.join(media_path, '**.**')).each do |single_media_path|
|
125
|
+
copy_media(single_media_path)
|
126
|
+
end
|
127
|
+
else
|
128
|
+
copy_media(media_path)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def save
|
133
|
+
tmp_media = []
|
134
|
+
@media.each do |media|
|
135
|
+
tmp_media << '"' + media[:index] + '": "' + media[:filename] + '"'
|
136
|
+
end
|
137
|
+
File.open(File.join(@tmpdir, 'media'), 'a') { |f| f.puts '{' + tmp_media.join(', ') + '}' }
|
138
|
+
|
139
|
+
FileUtils.mkdir_p(File.dirname(@options[:output_path]))
|
140
|
+
File.delete(@options[:output_path]) if File.exist?(@options[:output_path])
|
141
|
+
Zip::File.open(@options[:output_path], Zip::File::CREATE) do |zip|
|
142
|
+
Dir.glob(File.join(@tmpdir, '**')).each do |file_path|
|
143
|
+
zip.add(File.basename(file_path), file_path)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
@db.close if @db
|
148
|
+
FileUtils.rm_rf(@tmpdir) if File.exist?(@tmpdir)
|
149
|
+
|
150
|
+
@options[:output_path]
|
151
|
+
end
|
152
|
+
|
153
|
+
private
|
154
|
+
|
155
|
+
def add_model_for_deck(deck_id)
|
156
|
+
model_id = rand(10**13)
|
157
|
+
models = @db.execute('select models from col')
|
158
|
+
models = JSON.parse(models.first.first.gsub('\"', '"'))
|
159
|
+
model = models[models.keys.first]
|
160
|
+
model['name'] = @options[:model_name]
|
161
|
+
model['did'] = deck_id
|
162
|
+
model['id'] = model_id
|
163
|
+
model['css'] = @options[:css]
|
164
|
+
models[model_id.to_s] = model
|
165
|
+
model_id
|
166
|
+
end
|
167
|
+
|
168
|
+
def copy_media(source_path)
|
169
|
+
raise Errno::ENOENT.new(source_path) unless File.exist?(source_path)
|
170
|
+
destination_path = File.join(@tmpdir, @media.count.to_s)
|
171
|
+
FileUtils.cp(source_path, destination_path)
|
172
|
+
@media << { index: @media.count.to_s, filename: File.basename(source_path) }
|
173
|
+
true
|
174
|
+
end
|
175
|
+
|
176
|
+
def checksum(str)
|
177
|
+
Digest::SHA1.hexdigest(str)[0...8].to_i(16)
|
178
|
+
end
|
179
|
+
|
180
|
+
def strip_html(str)
|
181
|
+
str
|
182
|
+
end
|
183
|
+
|
184
|
+
def default_css
|
185
|
+
<<-CSS
|
186
|
+
.card {
|
187
|
+
font-family: arial;
|
188
|
+
font-size: 20px;
|
189
|
+
text-align: center;
|
190
|
+
color: black;
|
191
|
+
}
|
192
|
+
CSS
|
193
|
+
end
|
194
|
+
|
195
|
+
def default_model
|
196
|
+
{
|
197
|
+
'name' => 'Anki2 Rubygem Template',
|
198
|
+
'flds' => [
|
199
|
+
{
|
200
|
+
'name' => 'Front',
|
201
|
+
'rtl' => false,
|
202
|
+
'sticky' => false,
|
203
|
+
'media' => [],
|
204
|
+
'ord' => 0,
|
205
|
+
'font' => 'Arial',
|
206
|
+
'size' => 12
|
207
|
+
},
|
208
|
+
{
|
209
|
+
'name' => 'Back',
|
210
|
+
'rtl' => false,
|
211
|
+
'sticky' => false,
|
212
|
+
'media' => [],
|
213
|
+
'ord' => 0,
|
214
|
+
'font' => 'Arial',
|
215
|
+
'size' => 12
|
216
|
+
}
|
217
|
+
],
|
218
|
+
'tmpls' => [
|
219
|
+
{
|
220
|
+
'name' => 'Forward',
|
221
|
+
'qfmt' => '{{Front}}',
|
222
|
+
'did' => nil,
|
223
|
+
'bafmt' => '',
|
224
|
+
'afmt' => '{{Back}}',
|
225
|
+
'ord' => 0,
|
226
|
+
'bqfmt' => ''
|
227
|
+
}
|
228
|
+
],
|
229
|
+
}
|
230
|
+
end
|
231
|
+
end
|
data/lib/template.sql
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
PRAGMA foreign_keys=OFF;
|
2
|
+
BEGIN TRANSACTION;
|
3
|
+
CREATE TABLE col (
|
4
|
+
id integer primary key,
|
5
|
+
crt integer not null,
|
6
|
+
mod integer not null,
|
7
|
+
scm integer not null,
|
8
|
+
ver integer not null,
|
9
|
+
dty integer not null,
|
10
|
+
usn integer not null,
|
11
|
+
ls integer not null,
|
12
|
+
conf text not null,
|
13
|
+
models text not null,
|
14
|
+
decks text not null,
|
15
|
+
dconf text not null,
|
16
|
+
tags text not null
|
17
|
+
);
|
18
|
+
INSERT INTO "col" VALUES(1,1388548800,1435645724219,1435645724215,11,0,0,0,'{"nextPos": 1, "estTimes": true, "activeDecks": [1], "sortType": "noteFld", "timeLim": 0, "sortBackwards": false, "addToCur": true, "curDeck": 1, "newBury": true, "newSpread": 0, "dueCounts": true, "curModel": "1435645724216", "collapseTime": 1200}','{"1388596687391": {"vers": [], "name": "Basic-f15d2", "tags": ["Tag"], "did": 1435588830424, "usn": -1, "req": [[0, "all", [0]]], "flds": [{"name": "Front", "media": [], "sticky": false, "rtl": false, "ord": 0, "font": "Arial", "size": 20}, {"name": "Back", "media": [], "sticky": false, "rtl": false, "ord": 1, "font": "Arial", "size": 20}], "sortf": 0, "latexPre": "\\documentclass[12pt]{article}\n\\special{papersize=3in,5in}\n\\usepackage[utf8]{inputenc}\n\\usepackage{amssymb,amsmath}\n\\pagestyle{empty}\n\\setlength{\\parindent}{0in}\n\\begin{document}\n", "tmpls": [{"name": "Card 1", "qfmt": "{{Front}}", "did": null, "bafmt": "", "afmt": "{{Back}}", "ord": 0, "bqfmt": ""}], "latexPost": "\\end{document}", "type": 0, "id": 1388596687391, "css": ".card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n", "mod": 1435645658}}','{"1": {"desc": "", "name": "Default", "extendRev": 50, "usn": 0, "collapsed": false, "newToday": [0, 0], "timeToday": [0, 0], "dyn": 0, "extendNew": 10, "conf": 1, "revToday": [0, 0], "lrnToday": [0, 0], "id": 1, "mod": 1435645724}, "1435588830424": {"desc": "", "name": "Template", "extendRev": 50, "usn": -1, "collapsed": false, "newToday": [545, 0], "timeToday": [545, 0], "dyn": 0, "extendNew": 10, "conf": 1, "revToday": [545, 0], "lrnToday": [545, 0], "id": 1435588830424, "mod": 1435588830}}','{"1": {"name": "Default", "replayq": true, "lapse": {"leechFails": 8, "minInt": 1, "delays": [10], "leechAction": 0, "mult": 0}, "rev": {"perDay": 100, "fuzz": 0.05, "ivlFct": 1, "maxIvl": 36500, "ease4": 1.3, "bury": true, "minSpace": 1}, "timer": 0, "maxTaken": 60, "usn": 0, "new": {"perDay": 20, "delays": [1, 10], "separate": true, "ints": [1, 4, 7], "initialFactor": 2500, "bury": true, "order": 1}, "mod": 0, "id": 1, "autoplay": true}}','{}');
|
19
|
+
CREATE TABLE notes (
|
20
|
+
id integer primary key, /* 0 */
|
21
|
+
guid text not null, /* 1 */
|
22
|
+
mid integer not null, /* 2 */
|
23
|
+
mod integer not null, /* 3 */
|
24
|
+
usn integer not null, /* 4 */
|
25
|
+
tags text not null, /* 5 */
|
26
|
+
flds text not null, /* 6 */
|
27
|
+
sfld integer not null, /* 7 */
|
28
|
+
csum integer not null, /* 8 */
|
29
|
+
flags integer not null, /* 9 */
|
30
|
+
data text not null /* 10 */
|
31
|
+
);
|
32
|
+
CREATE TABLE cards (
|
33
|
+
id integer primary key, /* 0 */
|
34
|
+
nid integer not null, /* 1 */
|
35
|
+
did integer not null, /* 2 */
|
36
|
+
ord integer not null, /* 3 */
|
37
|
+
mod integer not null, /* 4 */
|
38
|
+
usn integer not null, /* 5 */
|
39
|
+
type integer not null, /* 6 */
|
40
|
+
queue integer not null, /* 7 */
|
41
|
+
due integer not null, /* 8 */
|
42
|
+
ivl integer not null, /* 9 */
|
43
|
+
factor integer not null, /* 10 */
|
44
|
+
reps integer not null, /* 11 */
|
45
|
+
lapses integer not null, /* 12 */
|
46
|
+
left integer not null, /* 13 */
|
47
|
+
odue integer not null, /* 14 */
|
48
|
+
odid integer not null, /* 15 */
|
49
|
+
flags integer not null, /* 16 */
|
50
|
+
data text not null /* 17 */
|
51
|
+
);
|
52
|
+
CREATE TABLE revlog (
|
53
|
+
id integer primary key,
|
54
|
+
cid integer not null,
|
55
|
+
usn integer not null,
|
56
|
+
ease integer not null,
|
57
|
+
ivl integer not null,
|
58
|
+
lastIvl integer not null,
|
59
|
+
factor integer not null,
|
60
|
+
time integer not null,
|
61
|
+
type integer not null
|
62
|
+
);
|
63
|
+
CREATE TABLE graves (
|
64
|
+
usn integer not null,
|
65
|
+
oid integer not null,
|
66
|
+
type integer not null
|
67
|
+
);
|
68
|
+
ANALYZE sqlite_master;
|
69
|
+
INSERT INTO "sqlite_stat1" VALUES('col',NULL,'1');
|
70
|
+
CREATE INDEX ix_notes_usn on notes (usn);
|
71
|
+
CREATE INDEX ix_cards_usn on cards (usn);
|
72
|
+
CREATE INDEX ix_revlog_usn on revlog (usn);
|
73
|
+
CREATE INDEX ix_cards_nid on cards (nid);
|
74
|
+
CREATE INDEX ix_cards_sched on cards (did, queue, due);
|
75
|
+
CREATE INDEX ix_revlog_cid on revlog (cid);
|
76
|
+
CREATE INDEX ix_notes_csum on notes (csum);
|
77
|
+
COMMIT;
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: anki2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Albert Zak
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-02 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.8'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
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: sqlite3
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.3.3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.3.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubyzip
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.7
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.1.7
|
69
|
+
description: Build multimedia *.apkg Flashcards for use with the Anki (http://ankisrs.net)
|
70
|
+
Spaced Repetition Software (SRS)
|
71
|
+
email:
|
72
|
+
- me@albertzak.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- CODE_OF_CONDUCT.md
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- anki2.gemspec
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- lib/anki2.rb
|
87
|
+
- lib/anki2/version.rb
|
88
|
+
- lib/template.sql
|
89
|
+
homepage: https://github.com/albertzak/anki2
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.0.3
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Create Anki Flashcards with Ruby! Supports images, audio, HTML and CSS.
|
113
|
+
test_files: []
|