narou 3.2.3 → 3.2.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of narou might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: d6aa12c63571ad1601f542bb53c24cc3b48cf26911594bfc9d417a23c4f22b55
4
- data.tar.gz: 669af3773090a7799b1116b577d329d1f4f006716d435d4edd2ac96c4f57468b
2
+ SHA1:
3
+ metadata.gz: 390c0f586cf54d1479c01edded154253c4b23c06
4
+ data.tar.gz: bd4d8fca70dea8827945974c2768a016db78a4e4
5
5
  SHA512:
6
- metadata.gz: 72895a49e054a3be922e52172b062295d97c486103dc118b0b3993f5c6bb2c9377698f91c2c080b1ac79f9e549916a847967285bde9dcc8128c4db9647a9a6d1
7
- data.tar.gz: 1959c35097256dcd76949e98d841cc6a4fd73ec8d009af2d7a3aef3a432e31a8d8c57d4dc8077cd6edb1835b455d5f0535e5850e76b0c54b95f92c3b6b417ede
6
+ metadata.gz: 293fc9142f5147e382c73f6244a8f4dd718a92f6669df2fd7a92d0ea138ea7c938215b583b528e4ff6ab3f7e9c806656e6c133a5304b89f1d69859da8ddcbdea
7
+ data.tar.gz: b1ade8d8f20f1e41b7f7aaa10520f8f6ed6f2d62241c7087956e106828da312f8cd574d0ea5a10e641000da3c836170e589dae8c310c132f13bed5afc1a42265
data/.rubocop.yml CHANGED
@@ -43,7 +43,7 @@ Metrics/MethodLength:
43
43
  Metrics/PerceivedComplexity:
44
44
  Max: 11
45
45
 
46
- Style/AccessorMethodName:
46
+ Naming/AccessorMethodName:
47
47
  Enabled: true
48
48
 
49
49
  # 条件式の時に使った時のみ警告を出す
@@ -105,7 +105,7 @@ Style/NumericLiterals:
105
105
  MinDigits: 7
106
106
 
107
107
  # has_ から始まるメソッドは許可する
108
- Style/PredicateName:
108
+ Naming/PredicateName:
109
109
  NamePrefixBlacklist:
110
110
  - "is_"
111
111
  - "have_"
@@ -185,7 +185,10 @@ Layout/Tab:
185
185
  Layout/TrailingBlankLines:
186
186
  Enabled: false
187
187
 
188
- Style/TrailingCommaInLiteral:
188
+ Style/TrailingCommaInArrayLiteral:
189
+ Enabled: false
190
+
191
+ Style/TrailingCommaInHashLiteral:
189
192
  Enabled: false
190
193
 
191
194
  Style/TrivialAccessors:
data/ChangeLog.md CHANGED
@@ -1,6 +1,17 @@
1
1
  更新履歴 - ChangeLog
2
2
  ====================
3
3
 
4
+ 3.2.4: 2018/07/14
5
+ ------------------
6
+ #### 追加機能
7
+ - WEB UI の Download ボタンに、DL終了後にメールで送信するオプションを追加
8
+
9
+ #### 修正内容
10
+ - enable_inspect が有効だと変換後にエラーが出ていた
11
+ - 分割して変換した場合にあらすじにURLが含まれていると変換結果がおかしくなる
12
+ - カクヨムのあらすじが取得できなくなっていた
13
+
14
+
4
15
  3.2.3: 2018/05/27
5
16
  ------------------
6
17
  #### 修正内容
data/README.md CHANGED
@@ -33,6 +33,17 @@ Narou.rb ― 「小説家になろう」「小説を読もう!」ダウンロ
33
33
  更新履歴 - ChangeLog
34
34
  --------------------
35
35
 
36
+ 3.2.4: 2018/07/14
37
+ ------------------
38
+ #### 追加機能
39
+ - WEB UI の Download ボタンに、DL終了後にメールで送信するオプションを追加
40
+
41
+ #### 修正内容
42
+ - enable_inspect が有効だと変換後にエラーが出ていた
43
+ - 分割して変換した場合にあらすじにURLが含まれていると変換結果がおかしくなる
44
+ - カクヨムのあらすじが取得できなくなっていた
45
+
46
+
36
47
  3.2.3: 2018/05/27
37
48
  ------------------
38
49
  #### 修正内容
@@ -530,7 +530,7 @@ module Command
530
530
  tab: :global
531
531
  },
532
532
  "server-port" => {
533
- type: :integer, help: "WEBサーバ起動時のポート",
533
+ type: :integer, help: "WEBサーバ起動時のポート。server-port + 1 のポートも WebSocket で使用",
534
534
  tab: :global
535
535
  },
536
536
  "server-bind" => {
data/lib/device/kindle.rb CHANGED
@@ -23,7 +23,7 @@ module Device::Kindle
23
23
  documents_path = get_documents_path
24
24
  raise Device::DontConneting unless documents_path
25
25
  paths = Dir.glob(File.join(documents_path, "*.sdr/*.azw3{f,r}"))
26
- Helper.copy_files(paths, get_storage_path)
26
+ Helper.copy_files(paths, get_storage_path, exception: false)
27
27
  paths.size
28
28
  end
29
29
 
@@ -31,7 +31,7 @@ module Device::Kindle
31
31
  documents_path = get_documents_path
32
32
  raise Device::DontConneting unless documents_path
33
33
  paths = Dir.glob(File.join(get_storage_path, "*.sdr/*"))
34
- Helper.copy_files(paths, documents_path)
34
+ Helper.copy_files(paths, documents_path, exception: false)
35
35
  paths.size
36
36
  end
37
37
  end
@@ -3,7 +3,7 @@
3
3
  # Copyright 2013 whiteleaf. All rights reserved.
4
4
  #
5
5
 
6
- # rubocop:disable Style/VariableName
6
+ # rubocop:disable Naming/VariableName
7
7
 
8
8
  require "win32ole"
9
9
  require_relative "../../extensions/windows"
@@ -2,8 +2,8 @@
2
2
  #
3
3
  # Copyright 2013 whiteleaf. All rights reserved.
4
4
  #
5
- # rubocop:disable Style/MethodName
6
- # rubocop:disable Style/VariableName
5
+ # rubocop:disable Naming/MethodName
6
+ # rubocop:disable Naming/VariableName
7
7
 
8
8
  class Device
9
9
  module Library
data/lib/helper.rb CHANGED
@@ -268,7 +268,7 @@ module Helper
268
268
  # dest_dir: コピー先のディレクトリ
269
269
  # check_timestamp: タイムスタンプを比較して新しければコピーする
270
270
  #
271
- def copy_files(from, dest_dir, check_timestamp: true)
271
+ def copy_files(from, dest_dir, check_timestamp: true, exception: true)
272
272
  from.each do |path|
273
273
  basename = File.basename(path)
274
274
  dirname = File.basename(File.dirname(path))
@@ -282,7 +282,12 @@ module Helper
282
282
  dest_mtime = File.mtime(dest)
283
283
  next if dest_mtime >= src_mtime
284
284
  end
285
- FileUtils.copy(path, dest)
285
+ begin
286
+ FileUtils.copy(path, dest)
287
+ rescue StandardError => e
288
+ raise if exception
289
+ error "#{path} はコピー出来ませんでした"
290
+ end
286
291
  end
287
292
  end
288
293
 
data/lib/html.rb CHANGED
@@ -10,13 +10,17 @@ class HTML
10
10
  attr_reader :string
11
11
  attr_accessor :strip_decoration_tag
12
12
 
13
- def initialize(string = "")
13
+ def initialize(string = +"")
14
14
  self.string = string
15
15
  @illust_current_url = nil
16
16
  @illust_grep_pattern = /<img.+?src=\"(?<src>.+?)\".*?>/i
17
17
  @strip_decoration_tag = false
18
18
  end
19
19
 
20
+ def clear
21
+ @string = +""
22
+ end
23
+
20
24
  def string=(str)
21
25
  @string = str.to_s
22
26
  end
@@ -632,16 +632,18 @@ class NovelConverter
632
632
  else
633
633
  array_of_subtitles = [subtitles]
634
634
  end
635
+ toc["story"] = @converter.convert(toc["story"], "story")
636
+ site_setting = SiteSetting.find(toc["toc_url"])
637
+ html = HTML.new
638
+ html.strip_decoration_tag = @setting.enable_strip_decoration_tag
639
+ html.set_illust_setting(
640
+ current_url: site_setting["illust_current_url"],
641
+ grep_pattern: site_setting["illust_grep_pattern"]
642
+ )
635
643
  array_of_converted_text = []
636
644
  array_of_subtitles.each_with_index do |sliced_subtitles, index|
637
645
  @converter.subtitles = sliced_subtitles
638
- toc["story"] = @converter.convert(toc["story"], "story")
639
- html = HTML.new
640
- html.strip_decoration_tag = @setting.enable_strip_decoration_tag
641
- site_setting = SiteSetting.find(toc["toc_url"])
642
- html.set_illust_setting({ current_url: site_setting["illust_current_url"],
643
- grep_pattern: site_setting["illust_grep_pattern"] })
644
-
646
+ html.clear
645
647
  sections = subtitles_to_sections(sliced_subtitles, html)
646
648
  array_of_converted_text.push(
647
649
  create_novel_text_by_template(
@@ -718,9 +720,10 @@ class NovelConverter
718
720
 
719
721
  def inspect_novel(array_of_text)
720
722
  if @setting.enable_inspect
721
- text = array_of_text.flatten
722
- @inspector.inspect_end_touten_conditions(text) # 行末読点の現在状況を調査する
723
- @inspector.countup_return_in_brackets(text) # カギ括弧内の改行状況を調査する
723
+ array_of_text.each do |text|
724
+ @inspector.inspect_end_touten_conditions(text) # 行末読点の現在状況を調査する
725
+ @inspector.countup_return_in_brackets(text) # カギ括弧内の改行状況を調査する
726
+ end
724
727
  end
725
728
 
726
729
  if !@display_inspector
data/lib/novelsetting.rb CHANGED
@@ -430,13 +430,13 @@ $ntag 小説のタグをカンマ区切りにしたもの
430
430
  name: "enable_insert_word_separator",
431
431
  type: :boolean,
432
432
  value: false,
433
- help: "単語選択がしやすいように単語単位の区切りデータを挿入する(Kindle専用)"
433
+ help: "単語選択がしやすいように単語単位の区切りデータを挿入する(Kindle専用)※Kindle ファームウェア 5.9.6.1 から MOBI ファイルでも単語選択が可能になったので、この機能を使う必要がなくなりました"
434
434
  },
435
435
  {
436
436
  name: "enable_insert_char_separator",
437
437
  type: :boolean,
438
438
  value: false,
439
- help: "文字選択がしやすいように1文字ずつ区切りデータを挿入する(Kindle専用。enable_insert_word_separator が有効な場合無この設定は無視される)"
439
+ help: "文字選択がしやすいように1文字ずつ区切りデータを挿入する(Kindle専用。enable_insert_word_separator が有効な場合無この設定は無視される)※Kindle ファームウェア 5.9.6.1 から MOBI ファイルでも単語選択が可能になったので、この機能を使う必要がなくなりました"
440
440
  },
441
441
  {
442
442
  name: "enable_strip_decoration_tag",
data/lib/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  #
5
5
 
6
6
  module Narou
7
- VERSION = "3.2.3"
7
+ VERSION = "3.2.4"
8
8
  end
data/lib/web/appserver.rb CHANGED
@@ -500,9 +500,10 @@ class Narou::AppServer < Sinatra::Base
500
500
  headers "Access-Control-Allow-Origin" => "*"
501
501
  targets = params["targets"] or error("need a parameter: `targets'")
502
502
  targets = targets.kind_of?(Array) ? targets : targets.split
503
+ opt_mail = "--mail" if query_to_boolean(params["mail"])
503
504
  pass if targets.size == 0
504
505
  Narou::Worker.push do
505
- CommandLine.run!("download", targets)
506
+ CommandLine.run!("download", targets, opt_mail)
506
507
  @@push_server.send_all(:"table.reload")
507
508
  end
508
509
  end
@@ -37,7 +37,11 @@
37
37
 
38
38
  $("#download-link-submit").on("click", function(e) {
39
39
  var targets = $("#download-input").val();
40
- $.post("/api/download", { targets: targets });
40
+ var optMail = $("#download-mail").is(":checked");
41
+ $.post("/api/download", {
42
+ targets: targets,
43
+ mail: optMail
44
+ });
41
45
  });
42
46
 
43
47
  :css
@@ -87,3 +91,9 @@
87
91
  .inner
88
92
  %div ここにリンクかショートカットファイルをドラッグ
89
93
  #download-link-drop-cover.drop-cover(effectAllowed="all")
94
+
95
+ .text-right
96
+ .checkbox
97
+ %label
98
+ %input#download-mail(type="checkbox")
99
+ ダウンロード終了後にメールで送信する
data/narou.gemspec CHANGED
@@ -32,11 +32,15 @@ Gem::Specification.new do |gem|
32
32
  install_message = <<-EOS
33
33
  #{"*" * 60}
34
34
 
35
- 3.2.3: 2018/05/27
35
+ 3.2.4: 2018/07/14
36
36
  ------------------
37
+ #### 追加機能
38
+ - WEB UI の Download ボタンに、DL終了後にメールで送信するオプションを追加
39
+
37
40
  #### 修正内容
38
- - タイトルに ` が含まれていると変換時にエラーが出ていた
39
- - Windows でDL用ブックマークレットを動かすとエラーが出ていた
41
+ - enable_inspect が有効だと変換後にエラーが出ていた
42
+ - 分割して変換した場合にあらすじにURLが含まれていると変換結果がおかしくなる
43
+ - カクヨムのあらすじが取得できなくなっていた
40
44
 
41
45
  #{"*" * 60}
42
46
  EOS
@@ -12,11 +12,12 @@ title_strip_pattern: null
12
12
 
13
13
  # ------------------------------------------------------------
14
14
  # 書籍情報取得設定
15
- title: <h1 id="workTitle"><a href=".+?">(?<title>.+?)</a></h1>
15
+ title: &title |-
16
+ <h1 id="workTitle"><a href=".+?">(?<title>.+?)</a></h1>
16
17
  author: |-
17
18
  (?:<span class="activityName" itemprop="author">(?<author>.+?)</span>)|(?:<span class="screenName.*?">(?<author>.+?)</span>)
18
- story: |-
19
- <p id="introduction" class="ui-truncateText js-work-introduction">(?<story>.+?)(?:</span>|</p>)
19
+ story: &story |-
20
+ <p id="introduction" class="ui-truncateTextButton js-work-introduction">(?<story>.+?)(?:[\n ]*?</span>|[\n ]*?</p>)
20
21
 
21
22
  # ------------------------------------------------------------
22
23
  # 目次取得設定
@@ -47,7 +48,7 @@ postscript_pattern: null
47
48
  novel_info_url: \\k<toc_url>
48
49
 
49
50
  # タイトル
50
- t: <h1 id="workTitle"><a href=".+?">(?<title>.+?)</a></h1>
51
+ t: *title
51
52
 
52
53
  # novel_type 小説種別
53
54
  nt: <dt><span>執筆状況</span></dt>\n <dd>(?<novel_type>.+?)</dd>
@@ -59,8 +60,7 @@ novel_type_string:
59
60
  ga: <dt><span>エピソード</span></dt>\n <dd>(?<general_all_no>\d+)話</dd>
60
61
 
61
62
  # story あらすじ
62
- s: |-
63
- <p id="introduction" class="ui-truncateText js-work-introduction">(?<story>.+?)(?:</span>|</p>)
63
+ s: *story
64
64
 
65
65
  # general_firstup 初回掲載日
66
66
  gf: |-2
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: narou
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.3
4
+ version: 3.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - whiteleaf7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-27 00:00:00.000000000 Z
11
+ date: 2018-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: termcolorlight
@@ -514,11 +514,15 @@ metadata: {}
514
514
  post_install_message: |
515
515
  ************************************************************
516
516
 
517
- 3.2.3: 2018/05/27
517
+ 3.2.4: 2018/07/14
518
518
  ------------------
519
+ #### 追加機能
520
+ - WEB UI の Download ボタンに、DL終了後にメールで送信するオプションを追加
521
+
519
522
  #### 修正内容
520
- - タイトルに ` が含まれていると変換時にエラーが出ていた
521
- - Windows でDL用ブックマークレットを動かすとエラーが出ていた
523
+ - enable_inspect が有効だと変換後にエラーが出ていた
524
+ - 分割して変換した場合にあらすじにURLが含まれていると変換結果がおかしくなる
525
+ - カクヨムのあらすじが取得できなくなっていた
522
526
 
523
527
  ************************************************************
524
528
  rdoc_options: []
@@ -536,7 +540,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
536
540
  version: '0'
537
541
  requirements: []
538
542
  rubyforge_project:
539
- rubygems_version: 2.7.6
543
+ rubygems_version: 2.6.13
540
544
  signing_key:
541
545
  specification_version: 4
542
546
  summary: Narou.rb ― 小説家になろうダウンローダ&縦書用整形スクリプト