imdb-terminal 0.1 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -19
  3. data/bin/imdb +32 -42
  4. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 668a4e977795d0075d70382890a72e911688c452d67cb02ba432f1cfefdacd01
4
- data.tar.gz: 4d1ac685489c8b509349841fc55e00285576ed9be0815802740731e5762cb954
3
+ metadata.gz: 5900c22d081fb8cc49e3b657f2380246d4984245698fe7f997ce725a5d94a363
4
+ data.tar.gz: 7fa4905d7d01d3753d53639db6b6f432a4424c5e5224fffd4065c47d7647af52
5
5
  SHA512:
6
- metadata.gz: 627fbd556497607248a0ebb78012d0ce9b5577eab31a0b8f8446c0b65b1aaba6bb78cc25216d0c115db672a6b179e21b468f86727ce09a2f397d98a0a8ceb893
7
- data.tar.gz: 87531c704b0b7b1d5bea5d2a8bd91b656f08a6ded7d4639c2441ca3923a6c282920bdbe74c430a70615e117e58c272fa468f7f27bda0a7c1735ec5f8e4a6fbb8
6
+ metadata.gz: 8545ab5fc7c8655ad3e9541517899e4ce761cb15d7ce4ceb24e6949048b160af96fe2b7e211b39896897aed54fa3b75871a295da9d903e120467b91eb1df8cba
7
+ data.tar.gz: 359a3cfd14dd7d03f93ef40da0b5e3d0addabeee12cee86f8354e5d791ef52589424b9d91522c5b0a6146415843564575ddac55a55f2cd682915e37415084912
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
  ![Ruby](https://img.shields.io/badge/language-Ruby-red) [![Gem Version](https://badge.fury.io/rb/imdb-terminal.svg)](https://badge.fury.io/rb/imdb-terminal) ![Unlicense](https://img.shields.io/badge/license-Unlicense-green) ![Stay Amazing](https://img.shields.io/badge/Stay-Amazing-important)
3
3
 
4
4
  # IMDB for the terminal
5
-
6
5
  Finding the right moviie to watch or series to binge can be time consuming. My
7
6
  girlfriend asked if I could create an application that would cut down the time
8
7
  spent on searching in favor of time spent watching and cuddling. Meet
@@ -34,24 +33,23 @@ The screenshot gives you an overview of the layout of the panes:
34
33
  ![IMDB-terminal screenshot](img/screenshot.png)
35
34
 
36
35
  # Keymap
37
-
38
- Keys | Function
39
- -----------|--------------------
40
- TAB | Cycle the panes (active pane is gray)
41
- Shift-TAB | Cycle backward
42
- Arrow keys | UP, DOWN, PgUP, PgDOWN, HOME, END in lists
43
- \+ or - | Depends on pane (intuitive)
44
- I | Load fresh IMDB data (be patient)
45
- m or s | Show MOVIES or SERIES
46
- r | Select MINimum IMDB rating (in bottom line)
47
- y or Y | Select MINimum or MAXimum production year
48
- / or \\ | Enter or clear search for movie/series title
49
- G | Set genres to match every movie/series
50
- d | Get details on selected movie/series
51
- D | Show where you can stream the movie/series
52
- R | Refresh all panes
53
- w or W | Write changes to config or save IMDB data
54
- q or Q | Quit w/saving config or w/o saving config
36
+ Keys | Function
37
+ -------------|--------------------
38
+ TAB or S-TAB | Cycle panes (active is gray) or backwards
39
+ Arrow keys | UP, DOWN, PgUP, PgDOWN, HOME, END in lists
40
+ \+ or - | Depends on pane (intuitive)
41
+ I | Load fresh IMDB data (be patient)
42
+ m or s | Show MOVIES or SERIES
43
+ r | Select MINimum IMDB rating (in bottom line)
44
+ y or Y | Select MINimum or MAXimum production year
45
+ / or \\ | Enter or clear search for movie/series title
46
+ G | Set genres to match every movie/series
47
+ d | Get details on selected movie/series
48
+ D | Show where you can stream the movie/series
49
+ R | Refresh all panes
50
+ v | Show version (and latest RybyGems version)
51
+ w or W | Write changes to config or save IMDB data
52
+ q or Q | Quit w/saving config or w/o saving config
55
53
 
56
54
  # Suggestions and improvements
57
55
  If you have any suggestions for improvement or cool features, create an issue
data/bin/imdb CHANGED
@@ -14,28 +14,29 @@
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.3"
17
18
 
18
19
  # PRELIMINARIES
19
20
  @help = <<HELPTEXT
20
21
  IMDB-term (https://github.com/isene/IMDB) Help text:
21
22
 
22
- Keys | Function
23
- -----------+--------------------
24
- TAB | Cycle the panes (active pane is gray)
25
- Shift-TAB | Cycle backward
26
- Arrow keys | UP, DOWN, PgUP, PgDOWN, HOME, END in lists
27
- + or - | Depends on pane (intuitive)
28
- I | Load fresh IMDB data (be patient)
29
- m or s | Show MOVIES or SERIES
30
- r | Select MINimum IMDB rating (in bottom line)
31
- y or Y | Select MINimum or MAXimum production year
32
- / or \\ | Enter or clear search for movie/series title
33
- G | Set genres to match every movie/series
34
- d | Get details on selected movie/series
35
- D | Show where you can stream the movie/series
36
- R | Refresh all panes
37
- w or W | Write changes to config or save IMDB data
38
- q or Q | Quit w/saving config or w/o saving config
23
+ Keys | Function
24
+ -------------+--------------------
25
+ TAB or S-TAB | Cycle panes (active is gray) or backwards
26
+ Arrow keys | UP, DOWN, PgUP, PgDOWN, HOME, END in lists
27
+ + or - | Depends on pane (intuitive)
28
+ I | Load fresh IMDB data (be patient)
29
+ m or s | Show MOVIES or SERIES
30
+ r | Select MINimum IMDB rating (in bottom line)
31
+ y or Y | Select MINimum or MAXimum production year
32
+ / or \\ | Enter or clear search for movie/series title
33
+ G | Set genres to match every movie/series
34
+ d | Get details on selected movie/series
35
+ D | Show where you can stream the movie/series
36
+ R | Refresh all panes
37
+ v | Show version (and latest RybyGems version)
38
+ w or W | Write changes to config or save IMDB data
39
+ q or Q | Quit w/saving config or w/o saving config
39
40
  HELPTEXT
40
41
  begin # BASIC SETUP
41
42
  require 'net/http'
@@ -331,6 +332,8 @@ def getkey # GET KEY FROM USER
331
332
  w_b("Error: #{e.inspect}")
332
333
  end
333
334
  @w_b.update = false
335
+ when 'v'
336
+ w_b("Version = #{@version} (latest RubyGems version is #{Gem.latest_version_for("imdb-terminal").version} - https://github.com/isene/IMDB)")
334
337
  when 'w'
335
338
  saveconf
336
339
  when 'W'
@@ -510,7 +513,7 @@ def w_list(win) # LIST IN WINDOW
510
513
  win.fill
511
514
  ix = 0
512
515
  ix = win.index - win.maxy/2 if win.index > win.maxy/2 and win.list.size > win.maxy - 1
513
- while ix < win.list.size and ix < win.maxy do
516
+ while ix < win.list.size
514
517
  str = win.list[ix][0]
515
518
  str = win.list[ix] if win == @w_g
516
519
  if ix == win.index and win == @active
@@ -594,7 +597,13 @@ def w_d(ext = 0) # SHOW INFO IN @w_d and @w_p
594
597
  # Display the poster
595
598
  poster = det["Poster"]
596
599
  `curl -s "#{poster}" > /tmp/imdb.jpg`
597
- image = "/tmp/imdb.jpg"
600
+ imageshow("/tmp/imdb.jpg")
601
+ return unless ext > 1 # Skip if no outlets are to be displayed
602
+ otl.each{|o| outlets += "#{o} "}
603
+ @w_d.text += "Outlets: " + outlets
604
+ @w_d.write
605
+ end
606
+ def imageshow(image)
598
607
  begin
599
608
  terminfo = `xwininfo -id $(xdotool getactivewindow)`
600
609
  term_w = terminfo.match(/Width: (\d+)/)[1].to_i
@@ -603,10 +612,11 @@ def w_d(ext = 0) # SHOW INFO IN @w_d and @w_p
603
612
  char_h = term_h / Curses.lines
604
613
  img_x = char_w * 105
605
614
  img_y = char_h * (Curses.lines / 2 + 2)
606
- img_max_w = char_w * (Curses.cols - width - 2)
615
+ img_max_w = char_w * (Curses.cols - (Curses.cols - 104) - 2)
607
616
  img_max_h = char_h * (@w_d.maxy - 2)
608
617
  # Clear previous images
609
618
  `echo "6;#{img_x};#{img_y};#{img_max_w+2};#{img_max_h+2};\n4;\n3;" | #{@w3mimgdisplay} 2>/dev/null`
619
+ return if image == ""
610
620
  img_w,img_h = `identify -format "%[fx:w]x%[fx:h]" #{image} 2>/dev/null`.split('x')
611
621
  img_w = img_w.to_i
612
622
  img_h = img_h.to_i
@@ -622,26 +632,6 @@ def w_d(ext = 0) # SHOW INFO IN @w_d and @w_p
622
632
  rescue
623
633
  w_b("Error showing image")
624
634
  end
625
- return unless ext > 1 # Skip if no outlets are to be displayed
626
- otl.each{|o| outlets += "#{o} "}
627
- @w_d.text += "Outlets: " + outlets
628
- @w_d.write
629
- end
630
- def imageclear
631
- begin
632
- terminfo = `xwininfo -id $(xdotool getactivewindow)`
633
- term_w = terminfo.match(/Width: (\d+)/)[1].to_i
634
- term_h = terminfo.match(/Height: (\d+)/)[1].to_i
635
- char_w = term_w / Curses.cols
636
- char_h = term_h / Curses.lines
637
- img_x = char_w * 105
638
- img_y = char_h * (Curses.lines / 2 + 2)
639
- img_max_w = char_w * (Curses.cols - (Curses.cols - 104) - 2)
640
- img_max_h = char_h * (@w_d.maxy - 2)
641
- `echo "6;#{img_x};#{img_y};#{img_max_w+2};#{img_max_h+2};\n4;\n3;" | #{@w3mimgdisplay} 2>/dev/null`
642
- rescue
643
- w_b("Error clearing image")
644
- end
645
635
  end
646
636
 
647
637
  # BOTTOM WINDOW FUNCTIONS
@@ -770,7 +760,7 @@ loop do # OUTER LOOP - (catching refreshes via 'r')
770
760
  @w_d.fill
771
761
  w_d
772
762
  end
773
- imageclear if @w_d.update
763
+ imageshow("") if @w_d.update
774
764
  @w_d.update = true
775
765
  w_b(nil) if @w_b.update
776
766
  @w_b.update = true
@@ -779,7 +769,7 @@ loop do # OUTER LOOP - (catching refreshes via 'r')
779
769
  break if Curses.cols != maxx or Curses.lines != maxy # break on terminal resize
780
770
  end
781
771
  ensure # On exit: clear image, close curses
782
- image_show("clear")
772
+ imageshow("")
783
773
  close_screen
784
774
  end
785
775
  end
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.1'
4
+ version: '0.3'
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-01 00:00:00.000000000 Z
11
+ date: 2023-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -30,10 +30,11 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.3.2
33
- description: Narrow down your preferences from a 1000 movies and almost 500 series.
33
+ description: 'Narrow down your preferences from a 1000 movies and almost 500 series.
34
34
  Select a minimum IMDB rating, range of production years, genres you like and dislike
35
35
  to get your preferred list. Get detailed information on movies and series and where
36
- you can stream them. Even the movie poster in the terminal.
36
+ you can stream them. Even the movie poster in the terminal. New in 0.2: Added ''v''
37
+ to show version and RubyGem version. Code cleanup. 0.3: Major bug fix on listing'
37
38
  email: g@isene.com
38
39
  executables:
39
40
  - imdb