lib/command/send.rb in narou-1.5.11 vs lib/command/send.rb in narou-1.6.0
- old
+ new
@@ -7,34 +7,35 @@
require_relative "../helper"
require_relative "../device"
module Command
class Send < CommandBase
- def oneline_help
+ def self.oneline_help
"変換したEPUB/MOBIを電子書籍端末に送信します"
end
def initialize
- super("<device> [<target1> <target2> ...]")
+ super("<device> [<target1> ...] [options]")
@opt.separator <<-EOS
・<target>で指定した小説の電子書籍データ(#{Device::DEVICES.map{|_,d| d::EBOOK_FILE_EXT}.join(", ")})を<device>で指定した端末に送信します。
<device>には現在 #{Device::DEVICES.keys.join(", ")} が指定出来ます。
・narou setting device=<device>としておけば、<device>の入力を省略できます。
また、convertコマンドで変換時に(端末がPCに接続されていれば)自動でデータを送信するようになります。
・<target>を省略した場合、管理している小説全てのファイルのタイムスタンプを端末のものと比べて新しければ送信します。
- Example:
+ Examples:
narou send kindle 6
narou send kobo 6
# <device>の省略
narou setting device=kindle
narou send 6
narou send # 端末のファイルより新しいファイルがあれば送信
narou send --without-freeze # 凍結済は対象外に
+ narou s send.without-freeze=true # 常に凍結済みを対象外に設定
Options:
EOS
@opt.on("--without-freeze", "一括送信時に凍結された小説は対象外にする") {
@@ -48,11 +49,10 @@
end
Narou.get_device
end
def execute(argv)
- load_local_settings
super
device = get_device(argv)
unless device
error "デバイス名が指定されていないか、間違っています。\n" +
"narou setting device=デバイス名 で指定出来ます。\n" +
@@ -75,10 +75,11 @@
next if @options["without-freeze"] && Narou.novel_frozen?(id)
argv << id
titles[id] = data["title"]
end
end
+ tagname_to_ids(argv)
argv.each do |target|
ebook_path = Narou.get_ebook_file_path(target, device.ebook_file_ext)
unless ebook_path
error "#{target} は存在しません"
next
@@ -87,10 +88,10 @@
error "まだファイル(#{File.basename(ebook_path)})が無いようです" unless send_all
next
end
if send_all
if device.ebook_file_old?(ebook_path)
- puts "<green>ID:#{target} #{TermColor.escape(titles[target])}</green>".termcolor
+ puts "<bold><green>ID:#{target} #{TermColor.escape(titles[target])}</green></bold>".termcolor
else
next
end
end
print "#{device.name}へ送信しています"