imdb-terminal 0.5 → 0.7
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 +4 -4
- data/bin/imdb +56 -85
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49d1463e6d7d634832abf6bb61c0ca13331ecb9d7b89f41bde2ecf04678d7fcc
|
4
|
+
data.tar.gz: c7e321c588a243cf2e3e4e4ac576f5626bf70e6e728b52b8f8355b703700d7d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1302d99ad816c594c32a641e4941dff4580823902fd47908d27b654bc7da9077848dda04e0aa1598937e23c9efb7481f4207dfa19a5e6d608091b93412590b5
|
7
|
+
data.tar.gz: b56b7a4c708c097f389272057e56b77c4437967ac49894256a027cd5b9714b0f6239384b089fd2bdc39333f540326b830f3fbff7e562e7423847618df0949c6c
|
data/bin/imdb
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# for any damages resulting from its use. Further, I am under no
|
15
15
|
# obligation to maintain or extend this software. It is provided
|
16
16
|
# on an 'as is' basis without any expressed or implied warranty.
|
17
|
-
@version = "0.
|
17
|
+
@version = "0.7"
|
18
18
|
|
19
19
|
# PRELIMINARIES
|
20
20
|
@help = <<HELPTEXT
|
@@ -173,29 +173,16 @@ class Curses::Window # CLASS EXTENSION
|
|
173
173
|
self.refresh
|
174
174
|
self.setpos(y, x)
|
175
175
|
end
|
176
|
-
def
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
cp = Curses::Window.pair(self.fg, self.bg)
|
181
|
-
self.attron(color_pair(cp) | self.attr) { self << self.text }
|
182
|
-
self.refresh
|
183
|
-
end
|
184
|
-
def p(text) # Puts text to window
|
185
|
-
self.attr = 0 if self.attr == nil
|
186
|
-
self.bg = 0 if self.bg == nil
|
187
|
-
self.fg = 255 if self.fg == nil
|
188
|
-
cp = Curses::Window.pair(self.fg, self.bg)
|
189
|
-
self.attron(color_pair(cp) | attr) { self << text }
|
190
|
-
self.refresh
|
191
|
-
end
|
192
|
-
def pa(fg = self.fg, bg = self.bg, attr = self.attr, text) # Puts text to window with full set of attributes
|
176
|
+
def p(fg = self.fg, bg = self.bg, attr = self.attr, text) # Puts text to window with full set of attributes
|
177
|
+
fg = 255 if self.fg == nil
|
178
|
+
bg = 0 if self.bg == nil
|
179
|
+
attr = 0 if self.attr == nil
|
193
180
|
cp = Curses::Window.pair(fg, bg)
|
194
181
|
self.attron(color_pair(cp) | attr) { self << text }
|
195
182
|
self.refresh
|
196
183
|
end
|
197
|
-
def
|
198
|
-
return "\n" + text.gsub(/(.{1,#{self.maxx}})( +|$\n?)|(.{1,#{self.maxx}})/, "\\1\\3\n")
|
184
|
+
def format(text) # Format text so that it linebreaks neatly inside window
|
185
|
+
return "\n" + text.gsub(/(.{1,#{self.maxx-1}})( +|$\n?)|(.{1,#{self.maxx-1}})/, "\\1\\3\n")
|
199
186
|
end
|
200
187
|
alias :puts :p
|
201
188
|
end
|
@@ -265,8 +252,7 @@ def getkey # GET KEY FROM USER
|
|
265
252
|
case chr
|
266
253
|
when '?' # Show helptext in right window
|
267
254
|
@w_d.fill
|
268
|
-
@w_d.
|
269
|
-
@w_d.write
|
255
|
+
@w_d.p(@help)
|
270
256
|
@w_d.update = false
|
271
257
|
when 'UP'
|
272
258
|
@active.index = @active.index <= 0 ? @active.list.size - 1 : @active.index - 1
|
@@ -277,7 +263,7 @@ def getkey # GET KEY FROM USER
|
|
277
263
|
@active.index = 0 if @active.index < 0
|
278
264
|
when 'PgDOWN'
|
279
265
|
@active.index += @active.maxy - 2
|
280
|
-
@active.index = @active.list.size - 1 if @active.index > @active.list.size
|
266
|
+
@active.index = @active.list.size - 1 if @active.index > @active.list.size - 1
|
281
267
|
when 'HOME'
|
282
268
|
@active.index = 0
|
283
269
|
when 'END'
|
@@ -372,9 +358,8 @@ def getkey # GET KEY FROM USER
|
|
372
358
|
when '@' # Enter "Ruby debug"
|
373
359
|
cmd = w_b_getstr("◆ ", "")
|
374
360
|
begin
|
375
|
-
@w_b.text = eval(cmd)
|
376
361
|
@w_b.fill
|
377
|
-
@w_b.
|
362
|
+
@w_b.p(eval(cmd))
|
378
363
|
rescue StandardError => e
|
379
364
|
w_b("Error: #{e.inspect}")
|
380
365
|
end
|
@@ -454,7 +439,7 @@ def imdbmovies
|
|
454
439
|
arr.sort_by! {|m| m[0]}
|
455
440
|
end
|
456
441
|
@w_i.list = @imdbsel
|
457
|
-
@w_i.index = 0 if @w_i.index > @w_i.list.size -
|
442
|
+
@w_i.index = 0 if @w_i.index > @w_i.list.size - 1
|
458
443
|
@w_m.list = @myMYsel
|
459
444
|
@w_n.list = @myMN
|
460
445
|
@myN = @myMN
|
@@ -505,7 +490,7 @@ def getstreaming(id) # Returns array of outlets
|
|
505
490
|
res["result"]["streamingInfo"][@country].each{|k,v| outlets.push(k)}
|
506
491
|
return outlets
|
507
492
|
rescue
|
508
|
-
return [
|
493
|
+
return [outlets.to_s]
|
509
494
|
end
|
510
495
|
end
|
511
496
|
def saveconf
|
@@ -552,68 +537,54 @@ end
|
|
552
537
|
# BASIC WINDOW FUNCTIONS
|
553
538
|
def w_t # SHOW INFO IN @w_t
|
554
539
|
@w_t.clr
|
555
|
-
@movies ?
|
556
|
-
|
557
|
-
|
558
|
-
@w_t.
|
540
|
+
@movies ? text = " MOVIES :: " : text = " SERIES :: "
|
541
|
+
text += "Rating MIN: #{@rating} - Year MIN: #{@yearMin} - Year MAX: #{@yearMax} :: Selection = #{@imdbsel.size}"
|
542
|
+
text += " " * (@w_t.maxx - text.length) if text.length < @w_t.maxx
|
543
|
+
@w_t.p(text)
|
559
544
|
end
|
560
545
|
def w_list(win) # LIST IN WINDOW
|
546
|
+
win.attr = 0
|
561
547
|
win == @active ? win.bg = WAbg : win.bg = WIbg
|
562
548
|
win.fill
|
563
|
-
ix = 0
|
549
|
+
ix = 0; t = 0
|
564
550
|
ix = win.index - win.maxy/2 if win.index > win.maxy/2 and win.list.size > win.maxy - 1
|
565
|
-
while ix < win.list.size
|
551
|
+
while ix < win.list.size and t < win.maxy do
|
566
552
|
str = win.list[ix][0]
|
567
553
|
str = win.list[ix] if win == @w_g
|
568
554
|
if ix == win.index and win == @active
|
569
|
-
win.
|
570
|
-
win.write
|
555
|
+
win.p("→ ")
|
571
556
|
else
|
572
|
-
win.
|
573
|
-
win.text = " "
|
574
|
-
win.write
|
557
|
+
win.p(" ")
|
575
558
|
end
|
576
559
|
if win == @w_g
|
577
560
|
if @genY.include?(str)
|
578
|
-
win.text = "+"
|
579
561
|
win.fg = WgYfg
|
580
562
|
win.attr = Curses::A_BOLD
|
581
|
-
win.
|
563
|
+
win.p("+")
|
582
564
|
elsif @genN.include?(str)
|
583
|
-
win.text = "-"
|
584
565
|
win.fg = WgNfg
|
585
|
-
win.
|
566
|
+
win.p("-")
|
586
567
|
else
|
587
|
-
win.text = " "
|
588
|
-
win.write
|
589
568
|
win.fg = Wgfg
|
569
|
+
win.p(" ")
|
590
570
|
end
|
591
571
|
end
|
592
572
|
win.attr = win.attr | Curses::A_UNDERLINE if ix == win.index
|
593
573
|
str = str[0..(win.maxx - 6)] + "…" if str.length > win.maxx - 4
|
594
|
-
win.
|
595
|
-
win.write
|
574
|
+
win.p(str)
|
596
575
|
win.attr = 0
|
597
|
-
|
598
|
-
|
599
|
-
win.
|
600
|
-
ix += 1
|
576
|
+
fill = " " * (win.maxx - str.length - 2)
|
577
|
+
fill = fill[0..-2] if win == @w_g
|
578
|
+
win.p(fill)
|
579
|
+
ix += 1; t += 1
|
601
580
|
end
|
602
581
|
if win.index > win.maxy/2
|
603
582
|
win.setpos(0, win.maxx - 1)
|
604
|
-
win.
|
605
|
-
fg0 = win.fg
|
606
|
-
win.fg = Mark
|
607
|
-
win.write
|
608
|
-
win.fg = fg0
|
583
|
+
win.p(Mark,"∆")
|
609
584
|
end
|
610
585
|
if win.list.length > win.maxy - 1 and win.list.length > win.index + win.maxy/2 - 1
|
611
586
|
win.setpos(win.maxy - 1, win.maxx - 1)
|
612
|
-
win.
|
613
|
-
fg0 = win.fg
|
614
|
-
win.fg = Mark
|
615
|
-
win.write
|
616
|
-
win.fg = fg0
|
587
|
+
win.p(Mark,"∇")
|
617
588
|
end
|
618
589
|
end
|
619
590
|
def w_d(ext = 0) # SHOW INFO IN @w_d and @w_p
|
@@ -622,36 +593,37 @@ def w_d(ext = 0) # SHOW INFO IN @w_d and @w_p
|
|
622
593
|
return if list.empty? # Skip if list is empty
|
623
594
|
id = list[@active.index][4]
|
624
595
|
@w_d.clr
|
625
|
-
@w_d.text = "#{list[@active.index][0]}\n\n"
|
626
596
|
@w_d.attr = Curses::A_BOLD
|
627
|
-
@w_d.
|
597
|
+
@w_d.p("#{list[@active.index][0]}\n\n")
|
628
598
|
@w_d.attr = 0
|
629
|
-
@w_d.
|
630
|
-
@w_d.write
|
599
|
+
@w_d.p(153,232,Curses::A_BOLD,"Rating: " + list[@active.index][1].to_s.ljust(14) + "Genres: #{list[@active.index][3]}\n")
|
631
600
|
return unless ext > 0 # Skip if no details are to be displayed
|
632
601
|
det = getomdb(id)
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
@w_d.text
|
638
|
-
|
639
|
-
|
640
|
-
@w_d.
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
602
|
+
text = "\nRated: " + det["Rated"].ljust(14) + "Runtime: #{det["Runtime"]}"
|
603
|
+
text += " (#{det["totalSeasons"]})" unless det["totalSeasons"] == nil
|
604
|
+
text += "\n"
|
605
|
+
text += "Released: " + det["Released"].ljust(14)
|
606
|
+
@w_d.p(230,text)
|
607
|
+
@w_d.p(244,"(#{id})\n")
|
608
|
+
width = Curses.cols - 104
|
609
|
+
@w_d.p(228,@w_d.format(det["Plot"]))
|
610
|
+
text = "\n"
|
611
|
+
text += "Awards: " + det["Awards"] + "\n"
|
612
|
+
text += "Director: " + det["Director"] + "\n"
|
613
|
+
text += "Actors: " + det["Actors"] + "\n\n"
|
614
|
+
@w_d.p(223,text)
|
615
|
+
text = "Metascore: " + det["Metascore"] + "\n\n"
|
616
|
+
@w_d.p(230,text)
|
647
617
|
# Display the poster
|
648
618
|
poster = det["Poster"]
|
649
619
|
`curl -s "#{poster}" > /tmp/imdb.jpg`
|
650
620
|
imageshow("/tmp/imdb.jpg")
|
651
621
|
return unless ext > 1 # Skip if no outlets are to be displayed
|
622
|
+
outlets = ""
|
623
|
+
otl = getstreaming(id)
|
652
624
|
otl.each{|o| outlets += "#{o} "}
|
653
|
-
|
654
|
-
@w_d.
|
625
|
+
text = "Outlets: " + outlets
|
626
|
+
@w_d.p(112,text)
|
655
627
|
end
|
656
628
|
def imageshow(image)
|
657
629
|
begin
|
@@ -690,8 +662,7 @@ def w_b(info) # SHOW INFO IN @W_B
|
|
690
662
|
info = "Choose window: i=IMDB list (+/- to add/remove from My list), g=Genres (+/- to add/remove), m=My list. " if info == nil
|
691
663
|
info = info[1..(@w_b.maxx - 3)] + "…" if info.length + 3 > @w_b.maxx
|
692
664
|
info += " " * (@w_b.maxx - info.length) if info.length < @w_b.maxx
|
693
|
-
@w_b.
|
694
|
-
@w_b.write
|
665
|
+
@w_b.p(info)
|
695
666
|
@w_b.update = false
|
696
667
|
end
|
697
668
|
def w_b_getstr(pretext, text) # A SIMPLE READLINE-LIKE ROUTINE
|
@@ -702,9 +673,9 @@ def w_b_getstr(pretext, text) # A SIMPLE READLINE-LIKE ROUTINE
|
|
702
673
|
chr = ""
|
703
674
|
while chr != "ENTER"
|
704
675
|
@w_b.setpos(0,0)
|
705
|
-
|
706
|
-
|
707
|
-
@w_b.
|
676
|
+
text = pretext + text
|
677
|
+
text += " " * (@w_b.maxx - text.length) if text.length < @w_b.maxx
|
678
|
+
@w_b.p(text)
|
708
679
|
@w_b.setpos(0,pretext.length + pos)
|
709
680
|
@w_b.refresh
|
710
681
|
chr = getchr
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imdb-terminal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geir Isene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -48,7 +48,8 @@ description: 'Narrow down your preferences from a 1000 movies and almost 500 ser
|
|
48
48
|
Select a minimum IMDB rating, range of production years, genres you like and dislike
|
49
49
|
to get your preferred list. Get detailed information on movies and series and where
|
50
50
|
you can stream them. Even the movie poster in the terminal. New in 0.2: Added ''v''
|
51
|
-
to show version and RubyGem version. Code cleanup. 0.
|
51
|
+
to show version and RubyGem version. Code cleanup. 0.7: Rewrite according to curses
|
52
|
+
extension upgrade.'
|
52
53
|
email: g@isene.com
|
53
54
|
executables:
|
54
55
|
- imdb
|