imdb-terminal 2.0.0 → 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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -2
  3. data/bin/imdb +46 -42
  4. metadata +28 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df8c9e075ec32ec9195b5a468edaafa0cbac1c5b1caae765749e2223219bca50
4
- data.tar.gz: 128db2671d90b4b7f74b6f521a1185b1c4b58891e18774cd7459062d7d883cd7
3
+ metadata.gz: 8d7d7e6701b93e4398983becfcd60d12bc964a71d1e5a50c8a28da010b627c2c
4
+ data.tar.gz: ce7d0a3926c832ee4f6880cb9cea077c7cdcb122507c84ca7302618ffcb0884c
5
5
  SHA512:
6
- metadata.gz: 0641bfb21f50c83ab60bcdb3873bbbfb3637b3182dcb391481d776e3ac27d8fc88be5e1b7ab27b9ed47e05aec1c7f4cbcc1254c81a3234a05f6289a9b2111bf1
7
- data.tar.gz: 34429a63cf57f0004cefd5ea23d8912e2b8b460a6c9be78518cb9d2c34438f0623151f22b4d77131cb954e7f6b0a7773339e1a54a290147e8edd6ae613a1eef0
6
+ metadata.gz: 682c7dbf08de4a06677cdd5b04f91b1f4530fee204cba4a6d0505bde4b2025620f5b6a8bcda8d982843df29d25c536ac5d2b075647daebcbf304a928395afdfb
7
+ data.tar.gz: ab2ddcd5496e20fb133427833d2790d4ba492a20140e1cd8bff4848eb9bf607839b74f822ea1d8576136410d6ad2b96e9a78d04f2b9a12431a78fdc63c6799c9
data/README.md CHANGED
@@ -41,11 +41,13 @@ The screenshot gives you an overview of the layout of the panes:
41
41
  gem install imdb-terminal
42
42
  ```
43
43
 
44
- ### Dependencies
44
+ ### Dependencies (Linux/macOS)
45
45
  - **w3mimgdisplay** (for poster display): `sudo apt install w3m-img`
46
46
  - **ImageMagick** (for poster processing): `sudo apt install imagemagick`
47
47
  - **xdotool** (for image redraw on workspace switch): `sudo apt install xdotool`
48
48
 
49
+ **Windows**: All core functionality works on Windows, but poster display is not available due to terminal limitations.
50
+
49
51
  ### Quick Start
50
52
  ```bash
51
53
  git clone <repository>
@@ -138,8 +140,9 @@ In the Genres pane:
138
140
  ### Common Issues
139
141
 
140
142
  **No posters displayed:**
141
- - Ensure w3m-img is installed: `sudo apt install w3m-img`
143
+ - **Linux/macOS**: Ensure w3m-img is installed: `sudo apt install w3m-img`
142
144
  - Check terminal supports images (works best in terminals like urxvt, kitty, iTerm2)
145
+ - **Windows**: Poster display is not supported due to terminal limitations
143
146
 
144
147
  **Posters disappear after workspace switch:**
145
148
  - Ensure xdotool is installed: `sudo apt install xdotool`
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
@@ -46,6 +47,9 @@ DATA_DIR = File.join(Dir.home, '.imdb', 'data')
46
47
  CACHE_MUTEX = Mutex.new
47
48
  MAX_FETCH_RETRIES = 3
48
49
 
50
+ # Platform detection
51
+ WINDOWS = Gem.win_platform?
52
+
49
53
  # MAIN CLASS {{{1
50
54
  class IMDBApp
51
55
  # INITIALIZATION {{{1
@@ -81,8 +85,9 @@ class IMDBApp
81
85
  @list.border = true
82
86
  @last_poster_id = nil
83
87
  @current_image = nil
88
+ @termpix = Termpix::Display.new unless WINDOWS
84
89
  @last_active_window = nil
85
-
90
+
86
91
  run_loop
87
92
  ensure
88
93
  save_config
@@ -1320,7 +1325,11 @@ class IMDBApp
1320
1325
  help_text << " • Use genre filters to find specific types of content\n".fg(230)
1321
1326
  help_text << " • Dump list removes items from main view permanently\n".fg(230)
1322
1327
  help_text << " • TMDb provides streaming provider information\n".fg(230)
1323
- help_text << " • Posters are displayed in the terminal using w3mimgdisplay\n".fg(230)
1328
+ unless WINDOWS
1329
+ help_text << " • Posters are displayed using termpix (Sixel or w3m protocols)\n".fg(230)
1330
+ else
1331
+ help_text << " • Poster display not available on Windows\n".fg(230)
1332
+ end
1324
1333
 
1325
1334
  help_text
1326
1335
  end
@@ -1803,42 +1812,34 @@ class IMDBApp
1803
1812
  end
1804
1813
 
1805
1814
  def show_poster(tconst) #{{{2
1806
- w3m = "/usr/lib/w3m/w3mimgdisplay"
1807
- return unless File.executable?(w3m)
1815
+ return if WINDOWS # Skip image display on Windows for now
1816
+ return unless @termpix&.supported?
1817
+
1808
1818
  cache = cache_dir
1809
1819
  file = File.join(cache, "#{tconst}.jpg")
1810
1820
 
1811
1821
  begin
1812
1822
  Timeout.timeout(2) do
1813
- info = `xwininfo -id $(xdotool getactivewindow) 2>/dev/null`
1814
- return unless info =~ /Width:\s*(\d+).*Height:\s*(\d+)/m
1815
- term_w, term_h = $1.to_i, $2.to_i
1816
1823
  rows, cols = IO.console.winsize
1817
- cw = term_w.to_f / cols
1818
- ch = term_h.to_f / rows
1819
- px = ((@detail.x - 1) * cw).to_i
1820
- py = (25 * ch).to_i
1821
- max_w = (40 * cw).to_i
1822
- max_h = ((rows - 28) * ch).to_i
1823
1824
 
1824
- `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)
1825
1833
 
1826
1834
  if File.exist?(file) && File.size?(file) > 0
1827
- iw, ih = `identify -format "%wx%h" #{file}`.split('x').map(&:to_i)
1828
-
1829
- if iw > max_w
1830
- ih = ih * max_w / iw; iw = max_w
1831
- end
1832
- if ih > max_h
1833
- iw = iw * max_h / ih; ih = max_h
1834
- end
1835
-
1836
- `echo "0;1;#{px};#{py};#{iw};#{ih};;;;;\"#{file}\"\n4;\n3;" | #{w3m} 2>/dev/null`
1837
-
1838
- # 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)
1839
1841
  @current_image = file
1840
1842
  else
1841
- # Clear current image if no file exists
1842
1843
  @current_image = nil
1843
1844
  end
1844
1845
  end
@@ -1848,24 +1849,27 @@ class IMDBApp
1848
1849
  end
1849
1850
 
1850
1851
  def check_image_redraw #{{{2
1852
+ return if WINDOWS # Skip image redraw on Windows
1853
+ return unless @termpix&.supported?
1851
1854
  # Only check if we have an image currently displayed
1852
1855
  return unless @current_image && File.exist?(@current_image)
1853
-
1856
+
1854
1857
  begin
1855
- # Check if we're in the active window - if not, image overlay might be cleared
1856
- active_window = `xdotool getactivewindow 2>/dev/null`.chomp
1857
- return if active_window.empty?
1858
-
1859
- # Check if this terminal window is the active one
1860
- current_window = `xdotool getwindowfocus 2>/dev/null`.chomp
1861
-
1862
- # Only redraw if we detect a focus change (simple heuristic)
1863
- if @last_active_window && @last_active_window != active_window && current_window == active_window
1864
- # Window focus changed and we're now active - redraw image using last poster id
1865
- 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
1866
1871
  end
1867
-
1868
- @last_active_window = active_window
1872
+ # Sixel images persist, no redraw needed
1869
1873
  rescue
1870
1874
  # Silently fail - we don't want focus checking to break anything
1871
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.0
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-15 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.0: Breaking change - requires rcurses 6.0.0+ with explicit initialization for
74
- Ruby 3.4+ compatibility.'
87
+ with jump-to-existing items, duplicate management, and robust data handling.'
75
88
  email: g@isene.com
76
89
  executables:
77
90
  - imdb
@@ -87,21 +100,14 @@ metadata:
87
100
  source_code_uri: https://github.com/isene/imdb
88
101
  homepage_uri: https://isene.com/
89
102
  documentation_uri: https://github.com/isene/imdb#readme
90
- post_install_message: |
91
- IMDb Terminal Browser installed successfully!
92
-
93
- To get started:
94
- 1. Run: imdb
95
- 2. On first run, the app will scrape IMDb Top 250 lists
96
- 3. Optional: Get a free TMDb API key for streaming info
97
- 4. Press '?' for help once running
98
-
99
- External dependencies for full functionality:
100
- - w3m-img (for poster display): sudo apt install w3m-img
101
- - imagemagick (for poster processing): sudo apt install imagemagick
102
- - xdotool (for image redraw on workspace switch): sudo apt install xdotool
103
-
104
- Enjoy discovering your next favorite movie! :-)
103
+ post_install_message: "✓ IMDb Terminal Browser installed successfully!\n\nTo get started:\n1.
104
+ Run: imdb\n2. On first run, the app will scrape IMDb Top 250 lists\n3. Optional:
105
+ Get a free TMDb API key for streaming info\n4. Press '?' for help once running\n\nExternal
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"
105
111
  rdoc_options: []
106
112
  require_paths:
107
113
  - "."