imdb-terminal 2.0.1 → 2.1.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/imdb +37 -43
  3. metadata +25 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a835730544b1acf9055d609a37a5727aecb9754878be3ccf1b873502b72fd771
4
- data.tar.gz: 6a9bc9712e20f70d2eceb8169dc32d81263a0a65cf2418815a3774a05399aeda
3
+ metadata.gz: 8d7d7e6701b93e4398983becfcd60d12bc964a71d1e5a50c8a28da010b627c2c
4
+ data.tar.gz: ce7d0a3926c832ee4f6880cb9cea077c7cdcb122507c84ca7302618ffcb0884c
5
5
  SHA512:
6
- metadata.gz: cf5bc22eb1a504498cb0a0843066b32c6fd0aaae995894f01616a27cebc3daac6c1c2bc996f28b7178c53a68dc9993f1dd1b4850118ea84fb42ebc2678b670f8
7
- data.tar.gz: 51ae69f5e824dd50157bb2f770d8536ffb9121957166fb61710d281d09c6041f794b5b41a520b2d6c7aa56359592974ff7e098c5315cd4e8510411086a0bd2a5
6
+ metadata.gz: 682c7dbf08de4a06677cdd5b04f91b1f4530fee204cba4a6d0505bde4b2025620f5b6a8bcda8d982843df29d25c536ac5d2b075647daebcbf304a928395afdfb
7
+ data.tar.gz: ab2ddcd5496e20fb133427833d2790d4ba492a20140e1cd8bff4848eb9bf607839b74f822ea1d8576136410d6ad2b96e9a78d04f2b9a12431a78fdc63c6799c9
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: 2.0.0: Breaking change - requires rcurses 6.0.0+ with explicit init
17
+ # Version: 2.1.0: Modern poster display using termpix gem
18
18
 
19
19
  # REQUIRES AND CONSTANTS {{{1
20
20
  require 'io/console'
@@ -32,6 +32,7 @@ require 'nokogiri'
32
32
  require 'fileutils'
33
33
  require 'concurrent'
34
34
  require 'rcurses'
35
+ require 'termpix'
35
36
 
36
37
  include Rcurses
37
38
  include Rcurses::Cursor
@@ -84,8 +85,9 @@ class IMDBApp
84
85
  @list.border = true
85
86
  @last_poster_id = nil
86
87
  @current_image = nil
88
+ @termpix = Termpix::Display.new unless WINDOWS
87
89
  @last_active_window = nil
88
-
90
+
89
91
  run_loop
90
92
  ensure
91
93
  save_config
@@ -1324,7 +1326,7 @@ class IMDBApp
1324
1326
  help_text << " • Dump list removes items from main view permanently\n".fg(230)
1325
1327
  help_text << " • TMDb provides streaming provider information\n".fg(230)
1326
1328
  unless WINDOWS
1327
- help_text << " • Posters are displayed in the terminal using w3mimgdisplay\n".fg(230)
1329
+ help_text << " • Posters are displayed using termpix (Sixel or w3m protocols)\n".fg(230)
1328
1330
  else
1329
1331
  help_text << " • Poster display not available on Windows\n".fg(230)
1330
1332
  end
@@ -1811,43 +1813,33 @@ class IMDBApp
1811
1813
 
1812
1814
  def show_poster(tconst) #{{{2
1813
1815
  return if WINDOWS # Skip image display on Windows for now
1814
-
1815
- w3m = "/usr/lib/w3m/w3mimgdisplay"
1816
- return unless File.executable?(w3m)
1816
+ return unless @termpix&.supported?
1817
+
1817
1818
  cache = cache_dir
1818
1819
  file = File.join(cache, "#{tconst}.jpg")
1819
1820
 
1820
1821
  begin
1821
1822
  Timeout.timeout(2) do
1822
- info = `xwininfo -id $(xdotool getactivewindow) 2>/dev/null`
1823
- return unless info =~ /Width:\s*(\d+).*Height:\s*(\d+)/m
1824
- term_w, term_h = $1.to_i, $2.to_i
1825
1823
  rows, cols = IO.console.winsize
1826
- cw = term_w.to_f / cols
1827
- ch = term_h.to_f / rows
1828
- px = ((@detail.x - 1) * cw).to_i
1829
- py = (25 * ch).to_i
1830
- max_w = (40 * cw).to_i
1831
- max_h = ((rows - 28) * ch).to_i
1832
1824
 
1833
- `echo "6;#{px};#{py};#{max_w+4};#{max_h+4};\n4;\n3;" | #{w3m} 2>/dev/null`
1825
+ # Always clear previous poster first to prevent overlapping
1826
+ @termpix.clear(
1827
+ x: @detail.x - 1,
1828
+ y: 25,
1829
+ width: 40,
1830
+ height: rows - 27,
1831
+ term_width: cols,
1832
+ term_height: rows)
1834
1833
 
1835
1834
  if File.exist?(file) && File.size?(file) > 0
1836
- iw, ih = `identify -format "%wx%h" #{file}`.split('x').map(&:to_i)
1837
-
1838
- if iw > max_w
1839
- ih = ih * max_w / iw; iw = max_w
1840
- end
1841
- if ih > max_h
1842
- iw = iw * max_h / ih; ih = max_h
1843
- end
1844
-
1845
- `echo "0;1;#{px};#{py};#{iw};#{ih};;;;;\"#{file}\"\n4;\n3;" | #{w3m} 2>/dev/null`
1846
-
1847
- # Track the current image
1835
+ # Display new poster using termpix
1836
+ @termpix.show(file,
1837
+ x: @detail.x - 1,
1838
+ y: 25,
1839
+ max_width: 40,
1840
+ max_height: rows - 28)
1848
1841
  @current_image = file
1849
1842
  else
1850
- # Clear current image if no file exists
1851
1843
  @current_image = nil
1852
1844
  end
1853
1845
  end
@@ -1858,24 +1850,26 @@ class IMDBApp
1858
1850
 
1859
1851
  def check_image_redraw #{{{2
1860
1852
  return if WINDOWS # Skip image redraw on Windows
1853
+ return unless @termpix&.supported?
1861
1854
  # Only check if we have an image currently displayed
1862
1855
  return unless @current_image && File.exist?(@current_image)
1863
-
1856
+
1864
1857
  begin
1865
- # Check if we're in the active window - if not, image overlay might be cleared
1866
- active_window = `xdotool getactivewindow 2>/dev/null`.chomp
1867
- return if active_window.empty?
1868
-
1869
- # Check if this terminal window is the active one
1870
- current_window = `xdotool getwindowfocus 2>/dev/null`.chomp
1871
-
1872
- # Only redraw if we detect a focus change (simple heuristic)
1873
- if @last_active_window && @last_active_window != active_window && current_window == active_window
1874
- # Window focus changed and we're now active - redraw image using last poster id
1875
- show_poster(@last_poster_id) if @last_poster_id
1858
+ # For w3m protocol, check if image overlay was cleared
1859
+ if @termpix.protocol == :w3m
1860
+ active_window = `xdotool getactivewindow 2>/dev/null`.chomp
1861
+ return if active_window.empty?
1862
+
1863
+ current_window = `xdotool getwindowfocus 2>/dev/null`.chomp
1864
+
1865
+ # Only redraw if we detect a focus change
1866
+ if @last_active_window && @last_active_window != active_window && current_window == active_window
1867
+ show_poster(@last_poster_id) if @last_poster_id
1868
+ end
1869
+
1870
+ @last_active_window = active_window
1876
1871
  end
1877
-
1878
- @last_active_window = active_window
1872
+ # Sixel images persist, no redraw needed
1879
1873
  rescue
1880
1874
  # Silently fail - we don't want focus checking to break anything
1881
1875
  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: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-19 00:00:00.000000000 Z
11
+ date: 2025-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '6.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: termpix
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: nokogiri
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,12 +80,11 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '13.0'
69
- description: 'Discover and manage movies and TV series from IMDb''s Top 250 lists.
70
- Features smart search with preview mode, advanced filtering by rating/year/genre,
83
+ description: 'IMDB v2.1.0: Modern poster display using termpix gem with Sixel and
84
+ w3m protocol support. Discover and manage movies and TV series from IMDb''s Top
85
+ 250 lists. Features smart search with preview mode, advanced filtering by rating/year/genre,
71
86
  streaming information via TMDb, wish lists, and terminal poster display. Enhanced
72
- with jump-to-existing items, duplicate management, and robust data handling. Version
73
- 2.0.1: Added Windows support - all core functionality works on Windows with graceful
74
- handling of platform-specific features.'
87
+ with jump-to-existing items, duplicate management, and robust data handling.'
75
88
  email: g@isene.com
76
89
  executables:
77
90
  - imdb
@@ -90,11 +103,11 @@ metadata:
90
103
  post_install_message: "✓ IMDb Terminal Browser installed successfully!\n\nTo get started:\n1.
91
104
  Run: imdb\n2. On first run, the app will scrape IMDb Top 250 lists\n3. Optional:
92
105
  Get a free TMDb API key for streaming info\n4. Press '?' for help once running\n\nExternal
93
- dependencies for full functionality (Linux/macOS only):\n- w3m-img (for poster display):
94
- sudo apt install w3m-img\n- imagemagick (for poster processing): sudo apt install
95
- imagemagick\n- xdotool (for image redraw on workspace switch): sudo apt install
96
- xdotool\n\nNote: Poster display is not available on Windows, but all other \nfunctionality
97
- works normally.\n\nEnjoy discovering your next favorite movie! :-)\n"
106
+ dependencies for full functionality (Linux/macOS only):\n- imagemagick (for image
107
+ processing): sudo apt install imagemagick\n- For w3m protocol: w3m-img, xdotool
108
+ (sudo apt install w3m-img xdotool)\n- For Sixel protocol (mlterm, xterm): imagemagick
109
+ convert command\n\nNote: Poster display is not available on Windows, but all other
110
+ \nfunctionality works normally.\n\nEnjoy discovering your next favorite movie! :-)\n"
98
111
  rdoc_options: []
99
112
  require_paths:
100
113
  - "."