mytunes-pro 1.8.0__py3-none-any.whl → 1.9.3__py3-none-any.whl

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.
mytunes/app.py CHANGED
@@ -35,7 +35,7 @@ MPV_SOCKET = "/tmp/mpv_socket"
35
35
  LOG_FILE = "/tmp/mytunes_mpv.log"
36
36
  PID_FILE = "/tmp/mytunes_mpv.pid"
37
37
  APP_NAME = "MyTunes Pro"
38
- APP_VERSION = "1.8.0"
38
+ APP_VERSION = "1.9.3"
39
39
 
40
40
  # === [Strings & Localization] ===
41
41
  STRINGS = {
@@ -245,10 +245,12 @@ class Player:
245
245
  # self.cleanup_orphaned_mpv() # Moved to play() per user request
246
246
 
247
247
  def cleanup_orphaned_mpv(self):
248
- # User requested revert to aggressive pkill for reliability
249
- # This ensures any previous background instances are killed
248
+ # Precise pkill to avoid matching the main TUI process
249
+ # Matches 'mpv ' (with space) or 'mpv' as exact process name
250
250
  try:
251
- subprocess.run(["pkill", "-f", "mpv"], stderr=subprocess.DEVNULL)
251
+ subprocess.run(["pkill", "-x", "mpv"], stderr=subprocess.DEVNULL)
252
+ # Second pass for variants or sub-arguments if needed
253
+ subprocess.run(["pkill", "-f", "mpv --video=no"], stderr=subprocess.DEVNULL)
252
254
  except: pass
253
255
 
254
256
  def play(self, url, start_pos=0):
@@ -331,7 +333,6 @@ class Player:
331
333
  try:
332
334
  self.current_proc.terminate()
333
335
  self.current_proc.wait(timeout=1)
334
- self.current_proc.wait(timeout=1)
335
336
  except:
336
337
  # If terminate fails, try socket quit
337
338
  try: self.send_cmd(["quit"])
@@ -619,14 +620,24 @@ class MyTunesApp:
619
620
  if self.selection_idx > 0:
620
621
  self.selection_idx -= 1
621
622
  if self.selection_idx < self.scroll_offset: self.scroll_offset = self.selection_idx
623
+ elif current_list:
624
+ # v1.8.5 - Wrapping: Top to Bottom
625
+ self.selection_idx = len(current_list) - 1
626
+ h, _ = self.stdscr.getmaxyx()
627
+ # Maintain scroll consistency (h - 10 matches draw() layout)
628
+ list_area_height = h - 10
629
+ self.scroll_offset = max(0, self.selection_idx - list_area_height + 1)
622
630
  elif key == curses.KEY_DOWN or k_char in ['j', 'ㅓ']:
623
631
  if self.selection_idx < len(current_list) - 1:
624
632
  self.selection_idx += 1
625
633
  h, _ = self.stdscr.getmaxyx()
626
- # Use h - 10 to match inner_h in draw() (h - footer_h(5) - header_top(3) - borders(2))
627
634
  list_area_height = h - 10
628
635
  if self.selection_idx >= self.scroll_offset + list_area_height:
629
636
  self.scroll_offset = self.selection_idx - list_area_height + 1
637
+ elif current_list:
638
+ # v1.8.5 - Wrapping: Bottom to Top
639
+ self.selection_idx = 0
640
+ self.scroll_offset = 0
630
641
 
631
642
  # Enter / Select: Enter Only (L moved to Forward)
632
643
  elif key == '\n' or key == 10 or key == 13:
@@ -743,58 +754,56 @@ class MyTunesApp:
743
754
  if self.is_remote():
744
755
  self.show_copy_dialog("YouTube", url)
745
756
  else:
746
- try:
747
- # Robust multi-platform open
748
- if sys.platform == 'darwin':
749
- subprocess.Popen(["open", url], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
750
- elif sys.platform == 'win32':
751
- os.startfile(url)
752
- elif self.is_wsl():
753
- # In WSL, call the Windows shell to open the URL in Windows browser
754
- subprocess.Popen(["cmd.exe", "/c", "start", url.replace("&", "^&")], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
755
- else:
756
- webbrowser.open(url)
757
- self.status_msg = "🌐 Opening YouTube in Browser..."
758
- except:
759
- webbrowser.open(url)
760
- self.status_msg = "🌐 Opening YouTube..."
757
+ # v1.8.4 - Use standard webbrowser library for maximum stability on F7
758
+ self.status_msg = "🌐 Opening YouTube in Browser..."
759
+ threading.Thread(target=webbrowser.open, args=(url,), daemon=True).start()
761
760
 
762
- # Open Live Station: F8
761
+ # Open Live Station (F8): App Mode with Optimized Flags (v1.8.6)
763
762
  elif key == curses.KEY_F8:
764
763
  live_url = "https://mytunes.postgresql.co.kr/live/"
765
764
  if self.is_remote():
766
765
  self.show_copy_dialog("Live Station", live_url)
767
766
  return
768
767
 
769
- # Add timestamp to user-data-dir to force size/position flags to be respected (prevents "remembering")
770
- # Using int(time.time() / 3600) to keep it stable within the same hour but fresh enough for new versions
771
- temp_user_data = os.path.join(tempfile.gettempdir(), f"mytunes_v174_{int(time.time() / 10)}")
772
-
773
- # Universal flags
768
+ # v1.9.2 - Critical WSL Fix: Disable Profile Isolation
769
+ # Executing cmd.exe or managing paths in WSL has proven unstable due to environment differences.
770
+ # We explicitly DISABLE profile isolation in WSL, using the default Chrome profile data.
771
+ # This ensures stability at the cost of session isolation.
772
+ if self.is_wsl():
773
+ temp_user_data = None
774
+ else:
775
+ temp_user_data = os.path.join(tempfile.gettempdir(), f"mytunes_v190_{int(time.time() / 10)}")
776
+
777
+ # Optimized Flag Set (Context7 Research)
774
778
  flags = [
775
779
  f"--app={live_url}",
776
780
  "--window-size=712,800",
777
781
  "--window-position=100,100",
778
- f"--user-data-dir={temp_user_data}",
779
782
  "--no-first-run",
780
- "--disable-extensions",
783
+ "--no-default-browser-check",
781
784
  "--disable-default-apps",
785
+ "--disable-infobars",
786
+ "--disable-translate",
782
787
  "--disable-features=Translation",
783
788
  "--disable-save-password-bubble",
784
- "--disable-translate"
789
+ "--autoplay-policy=no-user-gesture-required",
790
+ "--new-window",
791
+ "--disable-extensions"
785
792
  ]
786
793
 
794
+ # Only add user-data-dir if we have a valid path (Non-WSL)
795
+ if temp_user_data:
796
+ flags.append(f"--user-data-dir={temp_user_data}")
797
+
787
798
  launched = False
788
- # 1. macOS (Avoid AppleScript to prevent permission prompts)
799
+ # v1.8.4 - Subprocess Isolation (start_new_session) to prevent crashes on WSL/Linux
800
+ # 1. macOS
789
801
  if sys.platform == 'darwin':
790
- browsers = [
791
- "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
792
- "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
793
- ]
802
+ browsers = ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"]
794
803
  for b_path in browsers:
795
804
  if os.path.exists(b_path):
796
805
  try:
797
- # Use 'open -na' but without AppleScript to stay 'standard' and avoid prompts
806
+ # Use -na to open a fresh instance
798
807
  subprocess.Popen(["open", "-na", b_path, "--args"] + flags, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
799
808
  launched = True; break
800
809
  except: pass
@@ -802,52 +811,37 @@ class MyTunesApp:
802
811
  # 2. Windows Native
803
812
  elif sys.platform == 'win32':
804
813
  win_paths = [
805
- os.path.join(os.environ.get('PROGRAMFILES', 'C:\\Program Files'), 'Google\\Chrome\\Application\\chrome.exe'),
806
- os.path.join(os.environ.get('PROGRAMFILES(X86)', 'C:\\Program Files (x86)'), 'Google\\Chrome\\Application\\chrome.exe'),
814
+ os.path.join(os.environ.get('PROGRAMFILES', ''), 'Google\\Chrome\\Application\\chrome.exe'),
815
+ os.path.join(os.environ.get('PROGRAMFILES(X86)', ''), 'Google\\Chrome\\Application\\chrome.exe'),
807
816
  os.path.join(os.environ.get('LOCALAPPDATA', ''), 'Google\\Chrome\\Application\\chrome.exe'),
808
- os.path.join(os.environ.get('PROGRAMFILES', 'C:\\Program Files'), 'BraveSoftware\\Brave-Browser\\Application\\brave.exe'),
809
- os.path.join(os.environ.get('PROGRAMFILES(X86)', 'C:\\Program Files (x86)'), 'Microsoft\\Edge\\Application\\msedge.exe'),
810
- os.path.join(os.environ.get('PROGRAMFILES', 'C:\\Program Files'), 'Microsoft\\Edge\\Application\\msedge.exe'),
811
- ]
812
- # In native Windows, we remove user-data-dir to avoid permission/expansion errors
813
- # app mode + new-window + window-size is sufficient.
814
- win_flags = [
815
- f'--app="{live_url}"',
816
- '--window-size=712,800',
817
- '--window-position=100,100',
818
- '--new-window',
819
- '--no-first-run',
820
- '--disable-extensions'
821
817
  ]
822
818
  for p in win_paths:
823
- if os.path.exists(p):
819
+ if p and os.path.exists(p):
824
820
  try:
825
- # Use list-based Popen for native Windows
826
- subprocess.Popen([p] + win_flags, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
821
+ subprocess.Popen([p] + flags, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
827
822
  launched = True; break
828
823
  except: pass
829
824
 
830
- # 3. WSL (Run Windows Chrome via cmd.exe)
825
+ # 3. WSL / Linux (Direct path with session isolation)
831
826
  elif self.is_wsl():
832
- try:
833
- # Pure CMD start without user-data-dir to avoid expansion/path issues.
834
- # Window sizing works reliably with just these flags.
835
- c_args = [
836
- f'--app=\"{live_url}\"',
837
- '--window-size=712,800',
838
- '--window-position=100,100',
839
- '--new-window',
840
- '--no-first-run',
841
- '--disable-extensions'
842
- ]
843
- # Direct call to chrome via cmd start
844
- full_cmd = f'start chrome {" ".join(c_args)}'
845
- subprocess.Popen(["cmd.exe", "/c", full_cmd], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
846
- launched = True
847
- except:
848
- # Fallback to general start
827
+ wsl_paths = [
828
+ "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe",
829
+ "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
830
+ "/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe",
831
+ ]
832
+ for p in wsl_paths:
833
+ if os.path.exists(p):
834
+ try:
835
+ # CRITICAL: start_new_session=True isolates the browser from the TUI process group
836
+ # This prevents the TUI from dying when navigating or if the browser has shell issues.
837
+ subprocess.Popen([p] + flags, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, start_new_session=True)
838
+ launched = True; break
839
+ except: pass
840
+
841
+ if not launched:
849
842
  try:
850
- subprocess.Popen(["cmd.exe", "/c", "start", live_url], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
843
+ # Fallback for WSL to CMD (path is already converted upstream)
844
+ subprocess.Popen(["cmd.exe", "/c", f"start chrome --app={live_url} --user-data-dir={temp_user_data}"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, start_new_session=True)
851
845
  launched = True
852
846
  except: pass
853
847
 
@@ -1453,11 +1447,20 @@ class MyTunesApp:
1453
1447
 
1454
1448
  def run(self):
1455
1449
  while self.running:
1456
- self.loop_count = (self.loop_count + 1) % 1000
1457
- self.update_playback_state()
1458
- self.check_autoplay()
1459
- self.draw()
1460
- self.handle_input()
1450
+ try:
1451
+ self.loop_count = (self.loop_count + 1) % 1000
1452
+ self.update_playback_state()
1453
+ self.check_autoplay()
1454
+ self.draw()
1455
+ self.handle_input()
1456
+ except Exception as e:
1457
+ # v1.8.4 - Global resilience: Catch and log loop errors instead of crashing
1458
+ try:
1459
+ with open("/tmp/mytunes_error.log", "a") as f:
1460
+ f.write(f"[{time.ctime()}] Loop Error: {str(e)}\n")
1461
+ except: pass
1462
+ # Small sleep to prevent infinite tight loop on persistent error
1463
+ time.sleep(0.1)
1461
1464
 
1462
1465
  if self.stop_on_exit:
1463
1466
  self.player.stop()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mytunes-pro
3
- Version: 1.8.0
3
+ Version: 1.9.3
4
4
  Summary: A lightweight, keyboard-centric terminal player for streaming YouTube music.
5
5
  Author-email: loxo <loxo5432@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/postgresql-co-kr/mytunes
@@ -19,7 +19,7 @@ Dynamic: license-file
19
19
 
20
20
  # 🎵 MyTunes Pro (Korean)
21
21
 
22
- **현대적인 CLI 유튜브 뮤직 플레이어 (v1.7.9)**
22
+ **현대적인 CLI 유튜브 뮤직 플레이어 (v1.9.3)**
23
23
  터미널 환경에서 **YouTube 음악을 검색하여 듣는** 가볍고 빠른 키보드 중심의 플레이어입니다.
24
24
  한국어 입력 환경에서도 **숫자 키(1~5)**를 통해 지연 없는 쾌적한 조작이 가능합니다.
25
25
 
@@ -208,7 +208,7 @@ Windows 환경에서 한글 검색이 안 되거나 설치가 어려운 분들
208
208
 
209
209
  # 🎵 MyTunes Pro (English)
210
210
 
211
- **Modern CLI YouTube Music Player (v1.7.9)**
211
+ **Modern CLI YouTube Music Player (v1.9.3)**
212
212
  A lightweight, keyboard-centric terminal player for streaming YouTube music.
213
213
 
214
214
  ---
@@ -296,7 +296,70 @@ sudo apt install mpv python3 python3-pip pipx python3-venv -y
296
296
 
297
297
  ## 🔄 Changelog
298
298
 
299
- ### v1.7.9 (Latest)
299
+ ### v1.9.3 (Hotfix)
300
+
301
+ - **Hotfix for Startup**: Fixed a syntax error introduced in v1.9.2 that prevented the application from starting.
302
+
303
+ ### v1.9.2
304
+
305
+ - **Disable WSL Profile Isolation**: To ensure maximum stability and prevent `cmd.exe` conflicts, MyTunes now temporarily disables profile isolation (forced window size/position) on WSL. It runs using the default Chrome profile, guaranteeing reliable launching.
306
+
307
+ ### v1.9.1
308
+
309
+ - **Fix CMD Output Pollution (WSL)**: Resolved an issue where `cmd.exe` printed "UNC paths are not supported" warnings when executed from a WSL directory, corrupting the temporary path retrieval. Now parses output safely and executes from `/mnt/c` to prevent warnings.
310
+
311
+ ### v1.9.0
312
+
313
+ - **Fix WSL Profile Error**: Switched to using the **native Windows TEMP directory** (e.g., `C:\Users\...\AppData\Local\Temp`) for the browser profile in WSL. This prevents file locking issues caused by Chrome treating `\\wsl$\` paths as network drives.
314
+
315
+ ### v1.8.9
316
+
317
+ - **Robust WSL Path Fix**: Resolved an issue where direct browser launching (non-fallback) in WSL was still using Linux paths for the profile, causing "User Data Directory" creation errors. Path conversion is now applied globally before launch.
318
+
319
+ ### v1.8.8
320
+
321
+ - **WSL Path Conversion**: Implemented `wslpath -w` logic to correctly convert Linux-style temp paths to Windows format when launching Chrome via `cmd.exe` on WSL.
322
+
323
+ ### v1.8.7
324
+
325
+ - **Syntax Fix (WSL)**: Corrected a typo in the browser launch command that caused a crash on Linux/WSL systems.
326
+
327
+ ### v1.8.6
328
+
329
+ - **Browser Popup Optimization (Context7)**: Improved Live Station (F8) experience with optimized CLI flags for a perfectly minimalist UI.
330
+ - **Forced Window Dimensions**: Implemented profile isolation using a timestamped `user-data-dir` to ensure window size and position are always respected, overriding session memory.
331
+ - **UI Cleanup**: Automatically hides distraction-bars (translation, password, automation infobars) and enables instant autoplay for live streams.
332
+
333
+ ### v1.8.5
334
+
335
+ - **Looping Navigation (Menu Wrapping)**: Pressing UP at the first item now wraps to the last item, and pressing DOWN at the last item wraps to the first.
336
+ - **Improved UI Flow**: Enhanced keyboard navigation experience across all list views (Main, Search, Favorites, History).
337
+
338
+ ### v1.8.4
339
+
340
+ - **Python Crash Fix (WSL)**: Eliminated premature termination by implementing `start_new_session=True` for browser launches, isolating them from the TUI process group.
341
+ - **Hybrid Browser Strategy**: Switched to the standard `webbrowser` library for F7 (YouTube links) for maximum internal stability.
342
+ - **Global Error Protection**: Wrapped the main application loop in an exception guard to catch and log transient OS errors without crashing the entire app.
343
+ - **Refined Process Cleanup**: Specialized the `pkill` logic to prevent accidental self-termination while maintaining reliable MPV management.
344
+
345
+ ### v1.8.3
346
+
347
+ - **Direct Binary Execution (WSL)**: Resolved shell parsing issues by bypassing `cmd.exe` and directly executing Windows browser binaries via `/mnt/c/` paths.
348
+ - **App Mode Reliability**: Guaranteed 712x800 popup mode by ensuring flags are delivered directly to the browser process without intermediate shell mangling.
349
+ - **Fixed URL Resolution**: Eliminated the "Empty URL" bug by standardizing argument passing between WSL and Windows.
350
+
351
+ ### v1.8.1
352
+
353
+ - **Fixed App Mode (WSL/Win)**: Guaranteed the browser opens in a clean "App Mode" popup by fixing shell quoting issues in the launch command.
354
+ - **URL Resolution Fix**: Resolved the "Empty URL" bug on WSL/Windows by ensuring the `--app` flag is correctly parsed by the native Windows shell.
355
+ - **Reliable Popup UI**: Standardized on `start "" chrome` for WSL to ensure flags are never misidentified as window titles.
356
+
357
+ ### v1.8.0
358
+
359
+ - **Stabilized Browser Launch (Windows/WSL)**: Completely removed the `--user-data-dir` flag for all Windows-based environments. This permanently resolves the "cannot read or write" directory errors while maintaining reliable 712x800 window sizing through pure app-mode flags.
360
+ - **Clean CMD Execution**: Simplified the WSL-to-Windows transition by using standard `cmd.exe` calls without complex path or variable expansion, ensuring consistent behavior across all systems.
361
+
362
+ ### v1.7.9
300
363
 
301
364
  - **Pure CMD-based Launch (WSL/Win)**: Final fix for WSL-to-Windows browser launch using `cmd.exe /c` with native `%LOCALAPPDATA%` expansion.
302
365
  - **Directory Reliability**: Ensured Chrome data directory creation and access by using native Windows shell commands, eliminating the "cannot read or write" errors seen in v1.7.8.
@@ -0,0 +1,8 @@
1
+ mytunes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ mytunes/app.py,sha256=MNnNKbPLBfuEfkfJ_S0G-j_3n0s5pkI99GsOinwrp-0,60887
3
+ mytunes_pro-1.9.3.dist-info/licenses/LICENSE,sha256=lOrP0EIjxcgJia__W3f3PVDZkRd2oRzFkyH2g3LRRCg,1063
4
+ mytunes_pro-1.9.3.dist-info/METADATA,sha256=fef3gK31RAtSKUV99CkGzMWnnoVkyyvrp558wccHysE,19554
5
+ mytunes_pro-1.9.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
6
+ mytunes_pro-1.9.3.dist-info/entry_points.txt,sha256=6-MsC13nIgzLvrREaGotc32FgxHx_Iuu1z2qCzJs1_4,65
7
+ mytunes_pro-1.9.3.dist-info/top_level.txt,sha256=KWzdFyNNG_sO7GT83-sN5fYArP4_DL5I8HYIwgazXyY,8
8
+ mytunes_pro-1.9.3.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- mytunes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- mytunes/app.py,sha256=EBMpGbTzRmynKsNHk1P-5qKH43LZn6KHgRM1SVKKedQ,60855
3
- mytunes_pro-1.8.0.dist-info/licenses/LICENSE,sha256=lOrP0EIjxcgJia__W3f3PVDZkRd2oRzFkyH2g3LRRCg,1063
4
- mytunes_pro-1.8.0.dist-info/METADATA,sha256=ihPxSaFC7mLvJfJrIXqY6v55M3h8Qm2yts71GJuBjCg,15294
5
- mytunes_pro-1.8.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
6
- mytunes_pro-1.8.0.dist-info/entry_points.txt,sha256=6-MsC13nIgzLvrREaGotc32FgxHx_Iuu1z2qCzJs1_4,65
7
- mytunes_pro-1.8.0.dist-info/top_level.txt,sha256=KWzdFyNNG_sO7GT83-sN5fYArP4_DL5I8HYIwgazXyY,8
8
- mytunes_pro-1.8.0.dist-info/RECORD,,