imdb-terminal 1.2.0 → 2.0.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 +6 -0
  3. data/bin/imdb +52 -7
  4. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44360341d112b1115c484d11fcbecc250618c6cbb20791b33d6afe9dac43d269
4
- data.tar.gz: bbfd0e1b1c8a4a2178743bf76786c763591c3ba422e275b403e826cbf1dfada1
3
+ metadata.gz: df8c9e075ec32ec9195b5a468edaafa0cbac1c5b1caae765749e2223219bca50
4
+ data.tar.gz: 128db2671d90b4b7f74b6f521a1185b1c4b58891e18774cd7459062d7d883cd7
5
5
  SHA512:
6
- metadata.gz: d12e3fdc3780aed6392ea05b41f61adc4b3f942cf0dd69971c5fdc479a44581a047251a9c8d810c34fd7d3a6c67166b9031fbe7b0a0bdd0f29db55ad7930056a
7
- data.tar.gz: 15c08b8c4e6bd4b2c7433ef23b2f896366b622246aaf8bf29bb422a6ef55613a938fa562616b3db0c592e069a8ed599b1e97e54ff2988c15a43051e357a5d1f3
6
+ metadata.gz: 0641bfb21f50c83ab60bcdb3873bbbfb3637b3182dcb391481d776e3ac27d8fc88be5e1b7ab27b9ed47e05aec1c7f4cbcc1254c81a3234a05f6289a9b2111bf1
7
+ data.tar.gz: 34429a63cf57f0004cefd5ea23d8912e2b8b460a6c9be78518cb9d2c34438f0623151f22b4d77131cb954e7f6b0a7773339e1a54a290147e8edd6ae613a1eef0
data/README.md CHANGED
@@ -44,6 +44,7 @@ gem install imdb-terminal
44
44
  ### Dependencies
45
45
  - **w3mimgdisplay** (for poster display): `sudo apt install w3m-img`
46
46
  - **ImageMagick** (for poster processing): `sudo apt install imagemagick`
47
+ - **xdotool** (for image redraw on workspace switch): `sudo apt install xdotool`
47
48
 
48
49
  ### Quick Start
49
50
  ```bash
@@ -140,6 +141,10 @@ In the Genres pane:
140
141
  - Ensure w3m-img is installed: `sudo apt install w3m-img`
141
142
  - Check terminal supports images (works best in terminals like urxvt, kitty, iTerm2)
142
143
 
144
+ **Posters disappear after workspace switch:**
145
+ - Ensure xdotool is installed: `sudo apt install xdotool`
146
+ - Version 1.3.0+ includes automatic image redraw for i3 workspace switching
147
+
143
148
  **Encoding errors:**
144
149
  - Fixed automatically with built-in encoding handling
145
150
 
@@ -182,6 +187,7 @@ This enhanced version includes:
182
187
  - **Re-fetch capability** for data correction
183
188
  - **Improved encoding** handling for international content
184
189
  - **Better UX** with compact UI and auto-refresh
190
+ - **Image redraw functionality** for i3 workspace switching (v1.3.0+)
185
191
 
186
192
  ## © License
187
193
 
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: 1.2: Added jump-to for searched&scraped items
17
+ # Version: 2.0.0: Breaking change - requires rcurses 6.0.0+ with explicit init
18
18
 
19
19
  # REQUIRES AND CONSTANTS {{{1
20
20
  require 'io/console'
@@ -37,6 +37,9 @@ include Rcurses
37
37
  include Rcurses::Cursor
38
38
  include Rcurses::Input
39
39
 
40
+ # Initialize rcurses (required for rcurses 6.0.0+)
41
+ Rcurses.init!
42
+
40
43
  Thread.report_on_exception = false
41
44
  CONFIG_FILE = File.join(Dir.home, '.imdb.yml')
42
45
  DATA_DIR = File.join(Dir.home, '.imdb', 'data')
@@ -77,6 +80,8 @@ class IMDBApp
77
80
  rebuild_index
78
81
  @list.border = true
79
82
  @last_poster_id = nil
83
+ @current_image = nil
84
+ @last_active_window = nil
80
85
 
81
86
  run_loop
82
87
  ensure
@@ -1829,6 +1834,12 @@ class IMDBApp
1829
1834
  end
1830
1835
 
1831
1836
  `echo "0;1;#{px};#{py};#{iw};#{ih};;;;;\"#{file}\"\n4;\n3;" | #{w3m} 2>/dev/null`
1837
+
1838
+ # Track the current image
1839
+ @current_image = file
1840
+ else
1841
+ # Clear current image if no file exists
1842
+ @current_image = nil
1832
1843
  end
1833
1844
  end
1834
1845
  rescue Timeout::Error
@@ -1836,15 +1847,38 @@ class IMDBApp
1836
1847
  end
1837
1848
  end
1838
1849
 
1850
+ def check_image_redraw #{{{2
1851
+ # Only check if we have an image currently displayed
1852
+ return unless @current_image && File.exist?(@current_image)
1853
+
1854
+ 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
1866
+ end
1867
+
1868
+ @last_active_window = active_window
1869
+ rescue
1870
+ # Silently fail - we don't want focus checking to break anything
1871
+ end
1872
+ end
1873
+
1839
1874
  # MAIN LOOP {{{1
1840
1875
  def run_loop #{{{2
1841
1876
  @last_poster_id = nil
1877
+ @current_image = nil
1878
+ @last_active_window = nil
1842
1879
  draw_all
1843
1880
  loop do
1844
- ready = IO.select([STDIN], nil, nil, 0.05)
1845
- if ready
1846
- handle_input
1847
- end
1881
+ handle_input
1848
1882
  if defined?(@ui_update_queue) && @ui_update_queue
1849
1883
  begin
1850
1884
  while !@ui_update_queue.empty?
@@ -1966,7 +2000,12 @@ class IMDBApp
1966
2000
 
1967
2001
  # Handle help mode input separately
1968
2002
  if @help_mode != :hidden # {{{3
1969
- case getchr
2003
+ key = getchr(1) # 1 second timeout for help mode
2004
+ unless key # If timeout occurred (no key pressed)
2005
+ check_image_redraw # Check if image needs redraw after workspace switch
2006
+ return
2007
+ end
2008
+ case key
1970
2009
  when 'UP' # {{{4
1971
2010
  if @help_mode == :search
1972
2011
  # Scroll content only, header stays fixed
@@ -2197,7 +2236,13 @@ class IMDBApp
2197
2236
  end
2198
2237
  end
2199
2238
 
2200
- case getchr
2239
+ key = getchr(1) # 1 second timeout for normal input
2240
+ unless key # If timeout occurred (no key pressed)
2241
+ check_image_redraw # Check if image needs redraw after workspace switch
2242
+ return
2243
+ end
2244
+
2245
+ case key
2201
2246
  when 'c' # {{{3
2202
2247
  @cancel_scrape.make_true if defined?(@cancel_scrape)
2203
2248
  return
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: 1.2.0
4
+ version: 2.0.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-06-15 00:00:00.000000000 Z
11
+ date: 2025-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.8'
19
+ version: '6.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.8'
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -70,8 +70,8 @@ description: 'Discover and manage movies and TV series from IMDb''s Top 250 list
70
70
  Features smart search with preview mode, advanced filtering by rating/year/genre,
71
71
  streaming information via TMDb, wish lists, and terminal poster display. Enhanced
72
72
  with jump-to-existing items, duplicate management, and robust data handling. Version
73
- 1.1: A full rewrite using rcurses - with lots of new functionality. 1.2: Added jump-to
74
- for searched&scraped items.'
73
+ 2.0.0: Breaking change - requires rcurses 6.0.0+ with explicit initialization for
74
+ Ruby 3.4+ compatibility.'
75
75
  email: g@isene.com
76
76
  executables:
77
77
  - imdb
@@ -99,6 +99,7 @@ post_install_message: |
99
99
  External dependencies for full functionality:
100
100
  - w3m-img (for poster display): sudo apt install w3m-img
101
101
  - imagemagick (for poster processing): sudo apt install imagemagick
102
+ - xdotool (for image redraw on workspace switch): sudo apt install xdotool
102
103
 
103
104
  Enjoy discovering your next favorite movie! :-)
104
105
  rdoc_options: []