mytunes-pro 1.8.1__py3-none-any.whl → 1.8.4__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.1"
38
+ APP_VERSION = "1.8.4"
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"])
@@ -743,21 +744,9 @@ class MyTunesApp:
743
744
  if self.is_remote():
744
745
  self.show_copy_dialog("YouTube", url)
745
746
  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..."
747
+ # v1.8.4 - Use standard webbrowser library for maximum stability on F7
748
+ self.status_msg = "🌐 Opening YouTube in Browser..."
749
+ threading.Thread(target=webbrowser.open, args=(url,), daemon=True).start()
761
750
 
762
751
  # Open Live Station: F8
763
752
  elif key == curses.KEY_F8:
@@ -766,35 +755,24 @@ class MyTunesApp:
766
755
  self.show_copy_dialog("Live Station", live_url)
767
756
  return
768
757
 
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
758
+ # App Mode Flags
774
759
  flags = [
775
760
  f"--app={live_url}",
776
761
  "--window-size=712,800",
777
762
  "--window-position=100,100",
778
- f"--user-data-dir={temp_user_data}",
763
+ "--new-window",
779
764
  "--no-first-run",
780
- "--disable-extensions",
781
- "--disable-default-apps",
782
- "--disable-features=Translation",
783
- "--disable-save-password-bubble",
784
- "--disable-translate"
765
+ "--disable-extensions"
785
766
  ]
786
767
 
787
768
  launched = False
788
- # 1. macOS (Avoid AppleScript to prevent permission prompts)
769
+ # v1.8.4 - Subprocess Isolation (start_new_session) to prevent crashes on WSL/Linux
770
+ # 1. macOS
789
771
  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
- ]
772
+ browsers = ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"]
794
773
  for b_path in browsers:
795
774
  if os.path.exists(b_path):
796
775
  try:
797
- # Use 'open -na' but without AppleScript to stay 'standard' and avoid prompts
798
776
  subprocess.Popen(["open", "-na", b_path, "--args"] + flags, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
799
777
  launched = True; break
800
778
  except: pass
@@ -802,53 +780,37 @@ class MyTunesApp:
802
780
  # 2. Windows Native
803
781
  elif sys.platform == 'win32':
804
782
  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'),
783
+ os.path.join(os.environ.get('PROGRAMFILES', ''), 'Google\\Chrome\\Application\\chrome.exe'),
784
+ os.path.join(os.environ.get('PROGRAMFILES(X86)', ''), 'Google\\Chrome\\Application\\chrome.exe'),
807
785
  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
- # v1.8.1 - Precise: No internal quotes around URL to avoid misparsing as literal parts of URI
813
- win_flags = [
814
- f'--app={live_url}',
815
- '--window-size=712,800',
816
- '--window-position=100,100',
817
- '--new-window',
818
- '--no-first-run',
819
- '--disable-extensions'
820
786
  ]
821
787
  for p in win_paths:
822
- if os.path.exists(p):
788
+ if p and os.path.exists(p):
823
789
  try:
824
- # Use list-based Popen for native Windows
825
- subprocess.Popen([p] + win_flags, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
790
+ subprocess.Popen([p] + flags, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
826
791
  launched = True; break
827
792
  except: pass
828
793
 
829
- # 3. WSL (Run Windows Chrome via cmd.exe)
794
+ # 3. WSL / Linux (Direct path with session isolation)
830
795
  elif self.is_wsl():
831
- try:
832
- # v1.8.1 - Pure and Precise for WSL->CMD
833
- # 1. No internal quotes for the URL (prevents "Empty URL" / navigation failure)
834
- # 2. Use start "" chrome (Prevents 'start' from hijacking the first flag as a title)
835
- # 3. Combined flags for maximum compatibility
836
- c_args = [
837
- f'--app={live_url}',
838
- '--window-size=712,800',
839
- '--window-position=100,100',
840
- '--new-window',
841
- '--no-first-run',
842
- '--disable-extensions'
843
- ]
844
- # Direct call to chrome via cmd start
845
- full_cmd = f'start "" chrome {" ".join(c_args)}'
846
- subprocess.Popen(["cmd.exe", "/c", full_cmd], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
847
- launched = True
848
- except:
849
- # Fallback to general start
796
+ wsl_paths = [
797
+ "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe",
798
+ "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
799
+ "/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe",
800
+ ]
801
+ for p in wsl_paths:
802
+ if os.path.exists(p):
803
+ try:
804
+ # CRITICAL: start_new_session=True isolates the browser from the TUI process group
805
+ # This prevents the TUI from dying when navigating or if the browser has shell issues.
806
+ subprocess.Popen([p] + flags, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, start_new_session=True)
807
+ launched = True; break
808
+ except: pass
809
+
810
+ if not launched:
850
811
  try:
851
- subprocess.Popen(["cmd.exe", "/c", "start", live_url], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
812
+ # Fallback for WSL to CMD
813
+ subprocess.Popen(["cmd.exe", "/c", f"start chrome --app={live_url}"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, start_new_session=True)
852
814
  launched = True
853
815
  except: pass
854
816
 
@@ -1454,11 +1416,20 @@ class MyTunesApp:
1454
1416
 
1455
1417
  def run(self):
1456
1418
  while self.running:
1457
- self.loop_count = (self.loop_count + 1) % 1000
1458
- self.update_playback_state()
1459
- self.check_autoplay()
1460
- self.draw()
1461
- self.handle_input()
1419
+ try:
1420
+ self.loop_count = (self.loop_count + 1) % 1000
1421
+ self.update_playback_state()
1422
+ self.check_autoplay()
1423
+ self.draw()
1424
+ self.handle_input()
1425
+ except Exception as e:
1426
+ # v1.8.4 - Global resilience: Catch and log loop errors instead of crashing
1427
+ try:
1428
+ with open("/tmp/mytunes_error.log", "a") as f:
1429
+ f.write(f"[{time.ctime()}] Loop Error: {str(e)}\n")
1430
+ except: pass
1431
+ # Small sleep to prevent infinite tight loop on persistent error
1432
+ time.sleep(0.1)
1462
1433
 
1463
1434
  if self.stop_on_exit:
1464
1435
  self.player.stop()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mytunes-pro
3
- Version: 1.8.1
3
+ Version: 1.8.4
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.8.1)**
22
+ **현대적인 CLI 유튜브 뮤직 플레이어 (v1.8.4)**
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.8.1)**
211
+ **Modern CLI YouTube Music Player (v1.8.4)**
212
212
  A lightweight, keyboard-centric terminal player for streaming YouTube music.
213
213
 
214
214
  ---
@@ -296,7 +296,20 @@ sudo apt install mpv python3 python3-pip pipx python3-venv -y
296
296
 
297
297
  ## 🔄 Changelog
298
298
 
299
- ### v1.8.1 (Latest)
299
+ ### v1.8.4 (Latest)
300
+
301
+ - **Python Crash Fix (WSL)**: Eliminated premature termination by implementing `start_new_session=True` for browser launches, isolating them from the TUI process group.
302
+ - **Hybrid Browser Strategy**: Switched to the standard `webbrowser` library for F7 (YouTube links) for maximum internal stability.
303
+ - **Global Error Protection**: Wrapped the main application loop in an exception guard to catch and log transient OS errors without crashing the entire app.
304
+ - **Refined Process Cleanup**: Specialized the `pkill` logic to prevent accidental self-termination while maintaining reliable MPV management.
305
+
306
+ ### v1.8.3
307
+
308
+ - **Direct Binary Execution (WSL)**: Resolved shell parsing issues by bypassing `cmd.exe` and directly executing Windows browser binaries via `/mnt/c/` paths.
309
+ - **App Mode Reliability**: Guaranteed 712x800 popup mode by ensuring flags are delivered directly to the browser process without intermediate shell mangling.
310
+ - **Fixed URL Resolution**: Eliminated the "Empty URL" bug by standardizing argument passing between WSL and Windows.
311
+
312
+ ### v1.8.1
300
313
 
301
314
  - **Fixed App Mode (WSL/Win)**: Guaranteed the browser opens in a clean "App Mode" popup by fixing shell quoting issues in the launch command.
302
315
  - **URL Resolution Fix**: Resolved the "Empty URL" bug on WSL/Windows by ensuring the `--app` flag is correctly parsed by the native Windows shell.
@@ -0,0 +1,8 @@
1
+ mytunes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ mytunes/app.py,sha256=l9KMZxjy_BvLGI9Pphk5E1QYBMFWQ2ICWijCjWYM3ks,59186
3
+ mytunes_pro-1.8.4.dist-info/licenses/LICENSE,sha256=lOrP0EIjxcgJia__W3f3PVDZkRd2oRzFkyH2g3LRRCg,1063
4
+ mytunes_pro-1.8.4.dist-info/METADATA,sha256=tHjXf9El5TQnO2Ty-uq-ARJB2Yya4sR4puj5QAWIL_8,17271
5
+ mytunes_pro-1.8.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
6
+ mytunes_pro-1.8.4.dist-info/entry_points.txt,sha256=6-MsC13nIgzLvrREaGotc32FgxHx_Iuu1z2qCzJs1_4,65
7
+ mytunes_pro-1.8.4.dist-info/top_level.txt,sha256=KWzdFyNNG_sO7GT83-sN5fYArP4_DL5I8HYIwgazXyY,8
8
+ mytunes_pro-1.8.4.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- mytunes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- mytunes/app.py,sha256=cMlDP9j0M7AtoJtgCQiYDysG9TmoDknq-yZG3Th76Oc,60962
3
- mytunes_pro-1.8.1.dist-info/licenses/LICENSE,sha256=lOrP0EIjxcgJia__W3f3PVDZkRd2oRzFkyH2g3LRRCg,1063
4
- mytunes_pro-1.8.1.dist-info/METADATA,sha256=WMwanWpyV1OEIPMJJHgiHjSqZ0RhY9Yrf1NcOwjvqpw,16208
5
- mytunes_pro-1.8.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
6
- mytunes_pro-1.8.1.dist-info/entry_points.txt,sha256=6-MsC13nIgzLvrREaGotc32FgxHx_Iuu1z2qCzJs1_4,65
7
- mytunes_pro-1.8.1.dist-info/top_level.txt,sha256=KWzdFyNNG_sO7GT83-sN5fYArP4_DL5I8HYIwgazXyY,8
8
- mytunes_pro-1.8.1.dist-info/RECORD,,