aniview 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aniview.rb +72 -35
- data/lib/aniview/interface/animeio/animefile.rb +2 -1
- data/lib/aniview/interface/animeio/animeio.rb +2 -1
- data/lib/aniview/interface/animeio/animeseries.rb +2 -1
- data/lib/aniview/interface/deluge/delugec.rb +34 -0
- data/lib/aniview/interface/deluge/torrentitem.rb +16 -0
- data/lib/aniview/interface/item.rb +17 -0
- data/lib/aniview/{util → interface/pref}/pref.rb +25 -26
- data/lib/aniview/interface/pref/prefitem.rb +18 -0
- data/lib/aniview/util/{logger.rb → alogger.rb} +1 -1
- data/lib/aniview/util/format.rb +4 -0
- data/lib/aniview/view/aiomenu.rb +4 -5
- data/lib/aniview/view/delugemenu.rb +28 -0
- data/lib/aniview/view/menu.rb +109 -40
- data/lib/aniview/view/prefmenu.rb +1 -1
- metadata +49 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28e7f572e02fc282a0fad72f7309b120930838da
|
4
|
+
data.tar.gz: 3acb283170492f2abf8d3fcb012250b5f5b3a190
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d1b14652e56f0419711f6c4ad4299f83150f6d2799871ed8a4acaa33055604de8877532941de18d52309be69786678dc173ec275d3c499ac7e7bbf0b46468c2
|
7
|
+
data.tar.gz: 25b773fb7c112579f96b2806caaaa006839cd8cfc610300b192cf72cecaf78e3beb3a4e2b789391d6e3b7593b3f38bdc8157715c25dbff4cced30c96753bacd6
|
data/lib/aniview.rb
CHANGED
@@ -3,16 +3,20 @@ require 'highline/import'
|
|
3
3
|
require 'json'
|
4
4
|
require 'thread'
|
5
5
|
require 'io/console'
|
6
|
+
require 'warning'
|
7
|
+
|
8
|
+
Warning.ignore([:fixnum, :bignum])
|
6
9
|
|
7
10
|
require_relative 'aniview/view/aiomenu'
|
11
|
+
require_relative 'aniview/view/delugemenu'
|
8
12
|
require_relative 'aniview/view/prefmenu'
|
9
13
|
require_relative 'aniview/interface/animeio/animeio'
|
10
|
-
require_relative 'aniview/interface/
|
14
|
+
require_relative 'aniview/interface/deluge/delugec'
|
15
|
+
require_relative 'aniview/interface/pref/pref'
|
11
16
|
|
12
17
|
require_relative 'aniview/util/command'
|
13
|
-
require_relative 'aniview/util/
|
18
|
+
require_relative 'aniview/util/alogger'
|
14
19
|
require_relative 'aniview/util/term'
|
15
|
-
require_relative 'aniview/util/pref'
|
16
20
|
|
17
21
|
$stdout.sync = true
|
18
22
|
|
@@ -37,11 +41,16 @@ class AniView
|
|
37
41
|
"prefmenu" => {
|
38
42
|
"title" => "preferences_title_format_str",
|
39
43
|
"parent" => "preferences_item_format_str",
|
44
|
+
},
|
45
|
+
"delugemenu" => {
|
46
|
+
"title" => "deluge_title_format_str",
|
47
|
+
"parent" => "deluge_item_format_str",
|
40
48
|
}
|
41
49
|
}
|
42
50
|
|
43
51
|
@aio = AnimeIO.new(@pref)
|
44
|
-
|
52
|
+
@delugec = DelugeC.new()
|
53
|
+
@l = ALogger.new(@pref.get "log_file")
|
45
54
|
@aiomenu = AioMenu.new(
|
46
55
|
:getAll,
|
47
56
|
@aio,
|
@@ -50,14 +59,30 @@ class AniView
|
|
50
59
|
@format_["aiomenu_all"],
|
51
60
|
@term
|
52
61
|
)
|
53
|
-
|
54
|
-
|
62
|
+
@prefmenu = PrefMenu.new(
|
63
|
+
:getAll,
|
64
|
+
@pref,
|
65
|
+
@pref.get("menu_titles")["0"],
|
66
|
+
@pref,
|
67
|
+
@format_["prefmenu"],
|
68
|
+
@term
|
69
|
+
)
|
70
|
+
@delugemenu = DelugeMenu.new(
|
71
|
+
:getTorrents,
|
72
|
+
@delugec,
|
73
|
+
@pref.get("menu_titles")["7"],
|
74
|
+
@pref,
|
75
|
+
@format_["delugemenu"],
|
76
|
+
@term
|
77
|
+
)
|
78
|
+
|
55
79
|
|
56
80
|
@term.save.hide_cursor.echo_off
|
57
81
|
|
58
82
|
end
|
59
83
|
|
60
84
|
def cleanup
|
85
|
+
@mthread.exit if @mthread != nil
|
61
86
|
@term.reset
|
62
87
|
exit
|
63
88
|
end
|
@@ -80,50 +105,62 @@ class AniView
|
|
80
105
|
|
81
106
|
def run
|
82
107
|
|
83
|
-
view = @aiomenu
|
108
|
+
@view = @aiomenu
|
84
109
|
|
85
110
|
mutex = Mutex.new
|
86
111
|
Signal.trap('SIGWINCH', proc {
|
87
|
-
Thread.new { mutex.synchronize { view.
|
112
|
+
Thread.new { mutex.synchronize { @view.change_screen_size } }
|
88
113
|
} )
|
89
114
|
|
90
115
|
key = ""
|
91
|
-
view.refresh
|
92
|
-
|
116
|
+
@view.refresh
|
117
|
+
@shoulddraw = true
|
118
|
+
|
119
|
+
Thread.abort_on_exception = true
|
120
|
+
@mthread = Thread.new do
|
121
|
+
while true
|
122
|
+
if @shoulddraw
|
123
|
+
@view.draw
|
124
|
+
@view.refresh
|
125
|
+
end
|
126
|
+
sleep 1/45.0
|
127
|
+
end
|
128
|
+
end
|
93
129
|
|
94
130
|
while true
|
95
|
-
view.draw if key != "skip"
|
96
|
-
|
131
|
+
#@view.draw if key != "skip"
|
132
|
+
@shoulddraw = true
|
97
133
|
key = @term.getKey
|
134
|
+
@shoulddraw = false
|
98
135
|
|
99
|
-
if key == "
|
100
|
-
@
|
101
|
-
view
|
102
|
-
view.
|
103
|
-
view.
|
104
|
-
view.setRfunc(:getUnwatched)
|
136
|
+
if key == @pref.get("keybindings")["goto unwatched"]
|
137
|
+
@view = @aiomenu
|
138
|
+
@view.setName(@pref.get("menu_titles")["1"])
|
139
|
+
@view.setFormat(@format_["aiomenu_uw"])
|
140
|
+
@view.setRfunc(:getUnwatched)
|
105
141
|
|
106
|
-
elsif key == "
|
107
|
-
@
|
108
|
-
view
|
109
|
-
view.
|
110
|
-
view.
|
111
|
-
view.setRfunc(:getAll)
|
142
|
+
elsif key == @pref.get("keybindings")["goto all anime"]
|
143
|
+
@view = @aiomenu
|
144
|
+
@view.setName(@pref.get("menu_titles")["2"])
|
145
|
+
@view.setFormat(@format_["aiomenu_all"])
|
146
|
+
@view.setRfunc(:getAll)
|
112
147
|
|
113
148
|
elsif key == "3"
|
114
|
-
@
|
115
|
-
view
|
116
|
-
view.
|
117
|
-
|
149
|
+
#@view = @anilistmenu
|
150
|
+
#@view.setName(@pref.get("menu_titles")[key])
|
151
|
+
#@view.setRfunc(:getCompleted)
|
152
|
+
|
153
|
+
elsif key == @pref.get("keybindings")["goto torrents"]
|
154
|
+
@view = @delugemenu
|
155
|
+
@view.setName(@pref.get("menu_titles")["7"])
|
156
|
+
@view.setRfunc(:getTorrents)
|
118
157
|
|
119
|
-
elsif key == "
|
120
|
-
@
|
121
|
-
view
|
122
|
-
view.
|
123
|
-
view.setRfunc(:getAll)
|
158
|
+
elsif key == @pref.get("keybindings")["goto preferences"]
|
159
|
+
@view = @prefmenu
|
160
|
+
@view.setName(@pref.get("menu_titles")["0"])
|
161
|
+
@view.setRfunc(:getAll)
|
124
162
|
|
125
163
|
elsif key == ":"
|
126
|
-
|
127
164
|
cmd = Command.read(@term, ":")
|
128
165
|
self.runCommand cmd
|
129
166
|
|
@@ -131,7 +168,7 @@ class AniView
|
|
131
168
|
self.cleanup
|
132
169
|
end
|
133
170
|
|
134
|
-
view.control(key)
|
171
|
+
@view.control(key)
|
135
172
|
end
|
136
173
|
end
|
137
174
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'mkmf'
|
1
2
|
require 'base64'
|
2
3
|
require_relative 'animefile'
|
3
4
|
require_relative 'animeseries'
|
@@ -186,6 +187,6 @@ class AnimeIO
|
|
186
187
|
|
187
188
|
#run mpv
|
188
189
|
def watch(file)
|
189
|
-
pid = spawn("
|
190
|
+
pid = spawn("#{@pref.get "watch_command"} '#{file}'")
|
190
191
|
end
|
191
192
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'deluge'
|
2
|
+
require_relative 'torrentitem'
|
3
|
+
|
4
|
+
class DelugeC
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@client = Deluge::Rpc::Client.new(
|
8
|
+
host: 'localhost',
|
9
|
+
port: 58846,
|
10
|
+
login: 'localclient',
|
11
|
+
password: '1df1520eb580f2f569f4c3e846c83da2cc7a222d'
|
12
|
+
)
|
13
|
+
@client.connect
|
14
|
+
end
|
15
|
+
|
16
|
+
def getTorrents
|
17
|
+
return @client.core.get_torrents_status({}, ['name', 'progress', 'eta'])
|
18
|
+
end
|
19
|
+
|
20
|
+
def makeHash(arr)
|
21
|
+
ret = {}
|
22
|
+
arr.each{ |t|
|
23
|
+
tinfo = t[1]
|
24
|
+
torrent = TorrentItem.new(
|
25
|
+
name: tinfo["name"],
|
26
|
+
progress: tinfo["progress"],
|
27
|
+
eta: tinfo["eta"],
|
28
|
+
)
|
29
|
+
ret.merge!(torrent => torrent)
|
30
|
+
}
|
31
|
+
return ret
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../../util/format'
|
2
|
+
require_relative '../item'
|
3
|
+
|
4
|
+
class TorrentItem < Item
|
5
|
+
def initialize(name:, progress:, eta:)
|
6
|
+
@attr = {
|
7
|
+
"n" => name,
|
8
|
+
"p" => Format.format_progress(progress),
|
9
|
+
"e" => Format.format_duration(eta),
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
def attributes
|
14
|
+
return @attr
|
15
|
+
end
|
16
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fileutils'
|
2
|
+
require_relative 'prefitem'
|
2
3
|
|
3
4
|
class Pref
|
4
5
|
def initialize
|
@@ -18,14 +19,26 @@ class Pref
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def defaults
|
21
|
-
@pref =
|
22
|
+
@pref = {
|
23
|
+
"keybindings" => {
|
24
|
+
"goto preferences" => "0",
|
25
|
+
"goto unwatched" => "1",
|
26
|
+
"goto all anime" => "2",
|
27
|
+
"goto torrents" => "7",
|
28
|
+
"anime_set watched" => "Z",
|
29
|
+
"anime_set unwatched" => "u",
|
30
|
+
"anime_unwatch last watched" => "z",
|
31
|
+
"menu_nav_up" => "up",
|
32
|
+
"menu_nav_down" => "down",
|
33
|
+
"menu_nav_expand" => "space",
|
34
|
+
},
|
22
35
|
"anime_locations" => @home + "/airing/shows/" + ":" + @home + "/anime/",
|
23
|
-
"clr" =>
|
36
|
+
"clr" => {
|
24
37
|
"main" => "blue",
|
25
38
|
"primary" => "white",
|
26
39
|
"secondary"=> "cyan",
|
27
40
|
"selected" => "red"
|
28
|
-
|
41
|
+
},
|
29
42
|
"menu_titles" => {
|
30
43
|
"1" => "unwatched",
|
31
44
|
"2" => "anime library",
|
@@ -42,16 +55,19 @@ class Pref
|
|
42
55
|
"anime_library_unwatched_title_format_str" => " %t@ $q@ %D %S ",
|
43
56
|
"anime_library_unwatched_title_show_format_str" => " %t - %c@ %D %S ",
|
44
57
|
"anime_library_unwatched_title_episode_format_str" => " %t@ %D %S %r ",
|
45
|
-
|
46
|
-
"
|
47
|
-
"
|
58
|
+
"deluge_title_format_str" => " %t",
|
59
|
+
"deluge_item_format_str" => " %n@ %p ",
|
60
|
+
"preferences_title_format_str" => " %t",
|
61
|
+
"preferences_item_format_str" => " %t@.%v",
|
48
62
|
|
49
63
|
#"watch_file" => @conf + "/watched",
|
50
64
|
"log_file" => @conf + "/aw.log",
|
51
65
|
"watch_log" => @conf + "/watchlog",
|
52
66
|
|
67
|
+
"watch_command" => "mpv -alang jpn -slang eng -msg-level=all=fatal -ass",
|
68
|
+
|
53
69
|
"local_anime" => nil
|
54
|
-
|
70
|
+
}
|
55
71
|
self.save
|
56
72
|
end
|
57
73
|
|
@@ -96,11 +112,11 @@ class Pref
|
|
96
112
|
subtitle = title + "_" + subitem[0]
|
97
113
|
subval = subitem[1]
|
98
114
|
|
99
|
-
r.merge!(PrefItem.new(subtitle, subval, []) => PrefItem.new("", "", [item[0], subitem[0]]))
|
115
|
+
r.merge!(PrefItem.new(subtitle, subval, []) => [PrefItem.new("", "", [item[0], subitem[0]])])
|
100
116
|
}
|
101
117
|
next
|
102
118
|
end
|
103
|
-
r.merge!(PrefItem.new(title, val, []) => PrefItem.new("", "", [item[0]]))
|
119
|
+
r.merge!(PrefItem.new(title, val, []) => [ PrefItem.new("", "", [item[0]]) ] )
|
104
120
|
}
|
105
121
|
return r
|
106
122
|
end
|
@@ -118,20 +134,3 @@ class Pref
|
|
118
134
|
File.open(@pref_file, "r") {|f| @pref = JSON.parse(f.read)}
|
119
135
|
end
|
120
136
|
end
|
121
|
-
|
122
|
-
class PrefItem
|
123
|
-
def initialize(title, value, path_ = [])
|
124
|
-
@path = path_
|
125
|
-
@attr = {
|
126
|
-
"t" => title,
|
127
|
-
"v" => value,
|
128
|
-
}
|
129
|
-
end
|
130
|
-
|
131
|
-
def attributes
|
132
|
-
return @attr
|
133
|
-
end
|
134
|
-
def path
|
135
|
-
return @path
|
136
|
-
end
|
137
|
-
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative '../item'
|
2
|
+
|
3
|
+
class PrefItem < Item
|
4
|
+
def initialize(title, value, path_ = [])
|
5
|
+
@path = path_
|
6
|
+
@attr = {
|
7
|
+
"t" => title,
|
8
|
+
"v" => value,
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
def attributes
|
13
|
+
return @attr
|
14
|
+
end
|
15
|
+
def path
|
16
|
+
return @path
|
17
|
+
end
|
18
|
+
end
|
data/lib/aniview/util/format.rb
CHANGED
data/lib/aniview/view/aiomenu.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require_relative 'menu'
|
2
2
|
require_relative '../util/format'
|
3
3
|
|
4
|
-
|
5
4
|
class AioMenu < Menu
|
6
5
|
|
7
6
|
def setmal malanime
|
@@ -40,7 +39,7 @@ class AioMenu < Menu
|
|
40
39
|
def customControl(key, sel)
|
41
40
|
path = @items.values[sel["out"]][sel["in"]].path
|
42
41
|
|
43
|
-
if key == "
|
42
|
+
if key == @pref.get("keybindings")["menu_nav_expand"]
|
44
43
|
expand(sel["out"])
|
45
44
|
elsif key == "r"
|
46
45
|
refresh
|
@@ -53,13 +52,13 @@ class AioMenu < Menu
|
|
53
52
|
#@malanime.update(path)
|
54
53
|
|
55
54
|
refresh
|
56
|
-
elsif key == "
|
55
|
+
elsif key == @pref.get("keybindings")["anime_set watched"]
|
57
56
|
@interface.addWatched(path)
|
58
57
|
refresh
|
59
|
-
elsif key == "
|
58
|
+
elsif key == @pref.get("keybindings")["anime_set unwatch last watched"]
|
60
59
|
@interface.rmWatched()
|
61
60
|
refresh
|
62
|
-
elsif key == "
|
61
|
+
elsif key == @pref.get("keybindings")["anime_set unwatched"]
|
63
62
|
@interface.rmWatched(path)
|
64
63
|
|
65
64
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'menu'
|
2
|
+
require_relative '../util/format'
|
3
|
+
require_relative '../util/command'
|
4
|
+
|
5
|
+
|
6
|
+
class DelugeMenu < Menu
|
7
|
+
|
8
|
+
def refresh
|
9
|
+
@items = @interface.makeHash @interface.send(@refresh_func)
|
10
|
+
|
11
|
+
@attributes = {
|
12
|
+
"t" => @attributes["t"],
|
13
|
+
}
|
14
|
+
|
15
|
+
@expanded = -1 if @items.values[@expanded] == nil
|
16
|
+
fixCursor
|
17
|
+
end
|
18
|
+
|
19
|
+
def customControl(key, sel)
|
20
|
+
if key == "space"
|
21
|
+
|
22
|
+
elsif key == "r"
|
23
|
+
refresh
|
24
|
+
elsif key == "enter"
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/aniview/view/menu.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require_relative 'emote'
|
2
|
+
require 'benchmark'
|
3
|
+
require_relative '../util/alogger'
|
4
|
+
require 'digest/bubblebabble'
|
2
5
|
|
3
6
|
class Menu
|
4
7
|
|
@@ -14,20 +17,34 @@ class Menu
|
|
14
17
|
@expanded = -1
|
15
18
|
@selected = 0
|
16
19
|
@scrollup = false
|
17
|
-
|
20
|
+
@items_formatted = {}
|
21
|
+
@items_hash = {}
|
22
|
+
@hashmap = {}
|
23
|
+
@lu = 0
|
24
|
+
|
18
25
|
refresh
|
19
26
|
@lastcount = getLen
|
27
|
+
|
28
|
+
@l = ALogger.new(Dir.home + "/desktop/menu.log")
|
20
29
|
|
21
30
|
end
|
22
31
|
|
23
32
|
def setRfunc(name)
|
24
33
|
@refresh_func = name
|
34
|
+
@items_formatted = {}
|
35
|
+
@items_hash = {}
|
36
|
+
@lu = 0
|
25
37
|
refresh
|
38
|
+
refreshFormats
|
26
39
|
end
|
27
40
|
|
28
|
-
def
|
41
|
+
def change_screen_size
|
29
42
|
#@term.rows = lines
|
30
43
|
#@term.cols = cols
|
44
|
+
@items_formatted = {}
|
45
|
+
@items_hash = {}
|
46
|
+
@lu = 0
|
47
|
+
refresh
|
31
48
|
draw
|
32
49
|
end
|
33
50
|
|
@@ -105,9 +122,84 @@ class Menu
|
|
105
122
|
end
|
106
123
|
end
|
107
124
|
|
125
|
+
def refreshFormats
|
126
|
+
now = Integer(DateTime.now.strftime('%Q'))
|
127
|
+
return if now - @lu < 100
|
128
|
+
@lu = now
|
129
|
+
|
130
|
+
@cl = {
|
131
|
+
"s" => $clr[@pref.get("clr")["selected"]],
|
132
|
+
"1" => $clr[@pref.get("clr")["primary"]],
|
133
|
+
"2" => $clr[@pref.get("clr")["secondary"]],
|
134
|
+
"m" => $clr[@pref.get("clr")["main"]],
|
135
|
+
}
|
136
|
+
|
137
|
+
#@items_formatted = {}
|
138
|
+
new_items_formatted = {}
|
139
|
+
new_items_hash = {}
|
140
|
+
new_hashmap = {}
|
141
|
+
@items.each_with_index { |item, i|
|
142
|
+
|
143
|
+
#@l.log @items.keys[i]
|
144
|
+
#
|
145
|
+
babble = item[0].cereal #Digest::SHA256.bubblebabble String(item[0])
|
146
|
+
|
147
|
+
if @items_hash.key? babble
|
148
|
+
val = @items_hash[babble]
|
149
|
+
new_items_hash.merge!(babble => val)
|
150
|
+
new_items_formatted.merge!(@hashmap[babble] => @items_formatted[@hashmap[babble]])
|
151
|
+
new_hashmap.merge!(babble => @hashmap[babble])
|
152
|
+
next
|
153
|
+
end
|
154
|
+
|
155
|
+
parent = printmf(
|
156
|
+
@pref.get(@format_["parent"]),
|
157
|
+
item[0].attributes,
|
158
|
+
)
|
159
|
+
|
160
|
+
children = []
|
161
|
+
children_hash = []
|
162
|
+
|
163
|
+
item[1].each { |subitem|
|
164
|
+
|
165
|
+
child_babble = subitem.cereal
|
166
|
+
|
167
|
+
if @items_hash.key? child_babble
|
168
|
+
val = @items_hash[babble]
|
169
|
+
new_items_hash.merge!(child_babble => val)
|
170
|
+
children<<@hashmap[babble]
|
171
|
+
new_hashmap.merge!(babble => @hashmap[babble])
|
172
|
+
next
|
173
|
+
end
|
174
|
+
|
175
|
+
children << printmf(
|
176
|
+
@pref.get(@format_["child"]),
|
177
|
+
subitem.attributes,
|
178
|
+
)
|
179
|
+
children_hash << subitem.hash
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
new_items_hash.merge!(babble => children_hash)
|
184
|
+
new_items_formatted.merge!(parent => children)
|
185
|
+
new_hashmap.merge!(babble => parent)
|
186
|
+
}
|
187
|
+
|
188
|
+
@items_formatted = new_items_formatted
|
189
|
+
@items_hash = new_items_hash
|
190
|
+
@hashmap = new_hashmap
|
191
|
+
|
192
|
+
@title_formatted = printmf(
|
193
|
+
@pref.get(@format_["title"]),
|
194
|
+
@attributes,
|
195
|
+
)
|
196
|
+
|
197
|
+
end
|
198
|
+
|
108
199
|
def draw
|
109
200
|
#the number of lines to preview
|
110
201
|
buffer = 3
|
202
|
+
refreshFormats
|
111
203
|
|
112
204
|
#@term.rows-2 is used because 2 lines are reserved for
|
113
205
|
#the command line (the bottom line)
|
@@ -128,13 +220,8 @@ class Menu
|
|
128
220
|
|
129
221
|
def drawFrom(line_on, lines_to_draw)
|
130
222
|
#print menu header
|
131
|
-
|
132
|
-
|
133
|
-
1,
|
134
|
-
false,
|
135
|
-
@attributes,
|
136
|
-
"title"
|
137
|
-
)
|
223
|
+
lo="\e[1;1H"
|
224
|
+
print lo + @cl["m"] + @title_formatted + "\e[K"
|
138
225
|
|
139
226
|
resolved_start_position = resolveSelected line_on
|
140
227
|
|
@@ -151,49 +238,31 @@ class Menu
|
|
151
238
|
|
152
239
|
in_outer_region = ! (line_on >= getLen)
|
153
240
|
in_expanded_region = resolveSelected(line_on)["in_expanded"]
|
154
|
-
|
241
|
+
line = line_on-offset+1
|
155
242
|
selected = line_on == @selected
|
156
243
|
|
244
|
+
cl = ""
|
245
|
+
cl = @cl["s"] if selected
|
246
|
+
lo = "\e[#{line};1H" + cl
|
247
|
+
|
157
248
|
if in_expanded_region
|
158
|
-
|
159
|
-
@pref.get(@format_["child"]),
|
160
|
-
real_line_on,
|
161
|
-
selected,
|
162
|
-
@items.values[@expanded][ inner_index ].attributes,
|
163
|
-
"inside"
|
164
|
-
)
|
249
|
+
print @cl["2"] + lo + String(@items_formatted.values[@expanded][inner_index])
|
165
250
|
inner_index+=1
|
166
251
|
elsif in_outer_region
|
167
|
-
|
168
|
-
|
169
|
-
real_line_on,
|
170
|
-
selected,
|
171
|
-
@items.keys[outer_index].attributes,
|
172
|
-
"outside"
|
173
|
-
)
|
252
|
+
#@l.log "#{@attributes["t"]} #{line_on} #{starter} #{String(@items_formatted.keys[outer_index])} - #{String(@cl["1"])} #{String(lo)}"
|
253
|
+
print @cl["1"] + lo + String(@items_formatted.keys[outer_index])
|
174
254
|
outer_index+=1
|
175
255
|
else
|
176
|
-
print "\e[2K\n"
|
256
|
+
print "\e[#{line};1H\e[2K\n"
|
177
257
|
end
|
178
258
|
|
179
259
|
line_on+=1
|
180
260
|
end
|
181
261
|
end
|
182
262
|
|
183
|
-
def printmf(string,
|
184
|
-
lo = "\e[#{line};1H"
|
263
|
+
def printmf(string, d)
|
185
264
|
le = "\e[K\n"
|
186
265
|
|
187
|
-
if loc == "outside"
|
188
|
-
cl = $clr[@pref.get("clr")["primary"]]
|
189
|
-
elsif loc == "inside"
|
190
|
-
cl = $clr[@pref.get("clr")["secondary"]]
|
191
|
-
elsif loc == "title"
|
192
|
-
cl = $clr[@pref.get("clr")["main"]]
|
193
|
-
end
|
194
|
-
|
195
|
-
cl = $clr[@pref.get("clr")["selected"]] if selected
|
196
|
-
|
197
266
|
pstr = []
|
198
267
|
add_to = ""
|
199
268
|
buffer_char = []
|
@@ -264,14 +333,14 @@ class Menu
|
|
264
333
|
}
|
265
334
|
midstr += pstr[pstr.length - 1]
|
266
335
|
|
267
|
-
|
336
|
+
return midstr
|
268
337
|
end
|
269
338
|
|
270
339
|
def control(key)
|
271
340
|
sel = resolveSelected
|
272
|
-
if key == "
|
341
|
+
if key == @pref.get("keybindings")["menu_nav_up"]
|
273
342
|
moveCursor("up")
|
274
|
-
elsif key == "
|
343
|
+
elsif key == @pref.get("keybindings")["menu_nav_down"]
|
275
344
|
moveCursor("down")
|
276
345
|
else
|
277
346
|
customControl(key, sel)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aniview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- annacrombie
|
@@ -50,6 +50,46 @@ dependencies:
|
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 1.7.8
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: deluge-rpc
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.1'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.1.3
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.1'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 0.1.3
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: warning
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0.10'
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.10.0
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.10'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 0.10.0
|
53
93
|
description: Browse local anime, based on cmus
|
54
94
|
email: meotleft@gmail.com
|
55
95
|
executables:
|
@@ -62,12 +102,17 @@ files:
|
|
62
102
|
- lib/aniview/interface/animeio/animefile.rb
|
63
103
|
- lib/aniview/interface/animeio/animeio.rb
|
64
104
|
- lib/aniview/interface/animeio/animeseries.rb
|
105
|
+
- lib/aniview/interface/deluge/delugec.rb
|
106
|
+
- lib/aniview/interface/deluge/torrentitem.rb
|
107
|
+
- lib/aniview/interface/item.rb
|
108
|
+
- lib/aniview/interface/pref/pref.rb
|
109
|
+
- lib/aniview/interface/pref/prefitem.rb
|
110
|
+
- lib/aniview/util/alogger.rb
|
65
111
|
- lib/aniview/util/command.rb
|
66
112
|
- lib/aniview/util/format.rb
|
67
|
-
- lib/aniview/util/logger.rb
|
68
|
-
- lib/aniview/util/pref.rb
|
69
113
|
- lib/aniview/util/term.rb
|
70
114
|
- lib/aniview/view/aiomenu.rb
|
115
|
+
- lib/aniview/view/delugemenu.rb
|
71
116
|
- lib/aniview/view/emote.rb
|
72
117
|
- lib/aniview/view/menu.rb
|
73
118
|
- lib/aniview/view/prefmenu.rb
|
@@ -83,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
128
|
requirements:
|
84
129
|
- - ">"
|
85
130
|
- !ruby/object:Gem::Version
|
86
|
-
version: 2.
|
131
|
+
version: 2.3.99
|
87
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
133
|
requirements:
|
89
134
|
- - ">="
|