Taiko2k / Tauon

The music player of today! :city_sunrise:
https://tauonmusicbox.rocks
GNU General Public License v3.0
1.81k stars 71 forks source link

MacOS port #234

Closed ChillHorse closed 3 years ago

ChillHorse commented 4 years ago

Would you consider making .dmg files of Tauon?

Taiko2k commented 4 years ago

Yes as soon as someone buys me a macbook :wink:

Jokes aside, since I don't own a mac, my ability to test and package for macOS is limited.

Inevitably releasing on a platform is going to necessitate platform specific solutions for things, and packaging into a .dmg will likely be a small challenge in of itself.

So... no, I can't really say this is planned.


Just for fun, if anyone is interested in testing/hacking, it may be possible to run Tauon form source under macos, albeit not all features may work out the box.

How to get running:

  1. Install brew as described here https://brew.sh/
  2. Clone Tauon git clone https://github.com/Taiko2k/TauonMusicBox.git
  3. cd TauonMusicBox
  4. Install system deps brew install pygobject3 gtk+3 sdl2 sdl2_image libnotify gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-ffmpeg
  5. Install python deps pip3 install -r requirements.txt
  6. Run Tauon: /usr/local/bin/python3 tauon.py

Issues:

tarasyyyk commented 4 years ago

Yes, it's definitely need a good replaceemnt to default iTunes / Vox player. Unfortunately, there are no good alternatives for macOS, like AIMP for Windows. Standard iTunes sucks and Vox isn't better. There are a lot of Audio editors, audio converters for macOS, but no good audio player. So , creating new good-looking app (like this) is a good point. Currently, the app is running on macOS Mojave but need to change audio output to "Auto" (autoaudiosink). Even FLAC music playing great. Here is how it looks:

Tauon Music Box 2020-02-10 00-13-07

Here are list of bugs I found:

Taiko2k commented 4 years ago

need to change audio output to "Auto" (autoaudiosink).

Okay, I've now set this as the default

BASS not working

Try extract the contents of this zip https://github.com/Taiko2k/TauonMusicBox/releases/download/v5.2.0/basslibsosx.zip to the /lib sub-folder. If you still get the "Playback thread has crashed." error, I currently have errors redirected to a file named crash.log in the user-data sub-folder.

Album cover (images) not showing

It looks like its just gallery thumbnails are not loading? But in side panel and track info they are?

In tauon.py try search for this line print('Image load failed on track: ' and un-comment the raise line just above it. That might reveal the error in the console.

Questions

Does the UI scaling setting work? In Tauon's config file, try set ui-scale to 2.0 and restart the app. The UI should then look normal except everything is twice as big. (The window will still be non-retina, trying to fix that is a later step)

Do mediakey now work? Try git pull to update Tauon to latest commit then pip3 install osxmmkeys

ChillHorse commented 4 years ago

Sorry for the late reply, I'm getting mixed results on MacOS Catalina I couldn't get Gstreamer to work at all. After installing BASS GStreamer suddenly works in Auto mode?

BASS installation is bothersome on Catalina since you manually need to right click >open every .dylib file otherwise the system will complain that it's not verified by Apple.

when trying to run with BASS I immediatly get "Playback thread has crashed" error message, crashlog indicates that OSX blocks the .dylib files even tho there's no longer a System Popup complaining that those files arent verified. Running with sudo didn't help Tauon-log.txt

Artwork worked for me without edits correction; album art appear everywhere except in "gallery" view after uncommenting raise in tauon.py it was fixed for me

UI scaling did not work for me

Taiko2k commented 4 years ago

OSX blocks the .dylib files.... "not valid for use in process using Library Validation: library load disallowed by system policy"

Well that makes things difficult. This issue might also arise when trying to bundle the app as well. :expressionless:

ChillHorse commented 4 years ago

OSX blocks the .dylib files.... "not valid for use in process using Library Validation: library load disallowed by system policy"

Well that makes things difficult. This issue might also arise when trying to bundle the app as well. 😑

Just tried something. I went to system preferences > security than allowed the the Terminal in both sub categories "full system access" and "developer tools"

that pretty much reduced the crash log to:

2020-02-10 12:15:02,361 ERROR root Exception on player thread Traceback (most recent call last): File "tauon.py", line 6542, in bass_player_thread player(pctl, gui, prefs, lfm_scrobbler, star_store) File "/Users/phk/git-repos/TauonMusicBox/t_modules/t_bass.py", line 94, in player BASS_FX_GetVersion = function_type(ctypes.c_ulong)(("BASS_FX_GetVersion", fx_module)) UnboundLocalError: local variable 'fx_module' referenced before assignment

Taiko2k commented 4 years ago

that pretty much reduced the crash log to:

Okay, I've pushed a fix for that.

after uncommenting raise in tauon.py it was fixed for me

That's weird. Did any error show in console after doing that?

ChillHorse commented 4 years ago

BASS now works.

No error message about the artwork, no.

I did mention that setting ui-scale to 2 didn't work for me, noticed it defaulted back to 1. When forcibly change the value to 2 Tauon won't start.

Tauon Music Box v5.2.2 Copyright 2015-2020 Taiko2k captain.gxj@gmail.com Running in portable mode Install directory: /Users/phk/git-repos/TauonMusicBox Dev mode, ignoring single instancing Database loaded in 0.004 seconds. No translation file available Force rerender icons Traceback (most recent call last): File "tauon.py", line 3093, in from t_modules.t_svgout import render_icons File "/Users/phk/git-repos/TauonMusicBox/t_modules/t_svgout.py", line 3, in from gi.repository import Rsvg File "/usr/local/lib/python3.7/site-packages/gi/importer.py", line 133, in load_module 'introspection typelib not found' % namespace) ImportError: cannot import name Rsvg, introspection typelib not found

couldn't find typelib on brew, otherwise I'd test it out

Taiko2k commented 4 years ago

couldn't find typelib on brew, otherwise I'd test it out

I think it might be this it needs https://formulae.brew.sh/formula/librsvg


As for disabling the zooming, it seems setting NSHighResolutionCapable to true in an info_plist file should do it. Would need to be done as part of a bundle package... Seems pyinstaller can do that as mentioned here https://stackoverflow.com/a/40676321

tarasyyyk commented 4 years ago

macOS Mojave P.S. I hope , these error wouldn't frustrated you and you will look at them when have time. Current functionality is enough for me to use the player on daily usage. Moreover, I will start translating the player into my language soon. Enjoying your player!

ChillHorse commented 4 years ago

installing librsvg fixed not being able to launch Tauon when ui-scale is 2; reverting the value to one won't scale back/down svg elements. Can confirm @tarasyyyk 's observation, except the artwork part.

Bildschirmfoto 2020-02-10 um 14 46 23

looks like we're getting closer to an actual OSX release. Yay!

Taiko2k commented 4 years ago

2; reverting the value to one won't scale back/down svg elements.

This was actually an existing bug I forgot about, I've fixed this now.


OK, so... I have a thing: https://github.com/Taiko2k/TauonMusicBox/releases/download/v5.2.0/tauon-osx-testing.zip

Note: Ive disabled the media keys module since it was causing problems

tarasyyyk commented 4 years ago

This error happens when opening app: LSOpenURLsWithRole() failed for the application /Users/tarasyyyk/Downloads/tauon.app with error -10810. It seems something related to macOS's Launch Services framework. Tried also chmod +x but no luck.

Taiko2k commented 4 years ago

This error happens when opening app

What happens if you launch the inner executable ./tauon.app/Contents/MacOS/tauon?

ChillHorse commented 4 years ago

This error happens when opening app: LSOpenURLsWithRole() failed for the application /Users/tarasyyyk/Downloads/tauon.app with error -10810. It seems something related to macOS's Launch Services framework. Tried also chmod +x but no luck.

@tarasyyyk the .app needs to be in the Applications directory, otherwise you can't run it

Taiko2k commented 4 years ago

Dunno if you already did something with the NSHighResolutionCapablesetting but it's currently blurry on retina displays

I did I thought that would work aaaaaaa

BASS audio doesn't work in this test release.

aaaaaaaa

switching system to external GPU wihch is not good.

aaaaaaaa

OSX blocks the .dylib files.... "not valid for use in process using Library Validation: library load disallowed by system policy"

aaaaaaaa

artwork will not load in most views

AAAAAAA

I can't take this confounded operating system anymore :dizzy_face:

ChillHorse commented 4 years ago

Tried giving the tauon.app full system privilliges but it doesn't change anything. Noticed two more things

Let's take a breather and love Lain

Taiko2k commented 4 years ago

If you try run ./tauon.app/Contents/MacOS/tauon it will print output to console, so might give a hint.

visualizer not appearing

This isn't implemented on the GStreamer side, so to be expected if bass isn't working.

Transcode setting seemingly can't find ffmpeg

Ah, I had hoped that would just work. Do you have ffmpeg installed? Does the command which ffmpeg find it?

ChillHorse commented 4 years ago

ffmpeg is installed and cab be found via cli

here's the output

Tauon Music Box v5.2.2 Copyright 2015-2020 Taiko2k captain.gxj@gmail.com

Running in portable mode

Install directory: /Applications/tauon.app/Contents/MacOS PyLast moduel not found, last fm will be disabled. Database loaded in 0.021 seconds. No translation file available Using SDL version: 2.0.10 Using GStreamer as fallback. Some functions disabled

(:3704): GStreamer-WARNING **: 10:48:38.827: Failed to load plugin '/Applications/tauon.app/Contents/MacOS/libtheoraenc.1.dylib': dlopen(/Applications/tauon.app/Contents/MacOS/libtheoraenc.1.dylib, 2): Symbol not found: _th_commentadd Referenced from: /Applications/tauon.app/Contents/MacOS/libtheoraenc.1.dylib Expected in: flat namespace in /Applications/tauon.app/Contents/MacOS/libtheoraenc.1.dylib Config reload theme... Applying external theme: Wasp Theme number: 10 Enabling garbage collecting OPEN URI Writing database to disk. Image load failed on track: /Users/phk/Music/Boris Brechja/Boris Brejcha - DJ Mixes Single Tracks/1 - Boris Brejcha - Amisette Amisette.mp3 Image load failed on track: /Users/phk/Music/Boris Brechja/Boris Brejcha - Boris Brejcha - White Snake EP (MP3 EP)/1 - Boris Brejcha - Arche Noah.mp3 Image load failed on track: /Users/phk/Music/Boris Brechja/Boris Brejcha - Boris Brejcha - Die Maschinen sind Gestrandet (MP3 Album)/1 - Boris Brejcha - Wellenreiter.mp3 Image load failed on track: /Users/phk/Music/Boris Brechja/Boris Brejcha - Bleeding Heart/1 - Boris Brejcha - Bleeding Heart _ Bleeding Heart.mp3 Image load failed on track: /Users/phk/Music/Boris Brechja/Boris Brejcha - Boris Brejcha - Mein Wahres Ich (MP3 Album)/1 - Boris Brejcha - Flying Bird.mp3 Image load failed on track: /Users/phk/Music/Boris Brechja/Boris Brejcha - Boris Brejcha - Lost Memory (MP3 EP)/1 - Boris Brejcha - Lost Memory.mp3 Image load failed on track: /Users/phk/Music/Boris Brechja/Boris Brejcha - Boris Brejcha - Feuerfalter Special Edition (MP3 Album)/1 - Boris Brejcha - Frequenzfett.mp3 Image load failed on track: /Users/phk/Music/Caravan Palace - Wonderland/Caravan Palace - Wonderland.mp3 Traceback (most recent call last): File "tauon.py", line 34085, in File "tauon.py", line 21683, in render File "tauon.py", line 20208, in audio File "tauon.py", line 930, in gen_gst_out KeyError: 'Built-in Output' [3704] Failed to execute script tauon

This time I had no audio from Gstreamer due to a connected USB C display (whihc I hadn't previously connected), when I changed the output in the app it crashed right away

tarasyyyk commented 4 years ago

the .app needs to be in the Applications directory,

the app is not starting for me, because it was build for macOS 10.15. This error explains:

Referenced from: /Applications/tauon.app/Contents/MacOS/gi/../libgio-2.0.0.dylib (which was built for Mac OS X 10.15)

My system is 10.14.6

Taiko2k commented 4 years ago

Unfortunately I don't see a method forward. Too many conflicting Issues:

ChillHorse commented 4 years ago
  • I don't know how to disable zooming on retina displays, but it seems to necessitate creating a binary .app bundle (also needed for desktop launcher?)

Once an .app is inside the application directory it's listed in the launcher, the .app icon is used for it in this case it was probably the pyinstaller icon. On the dock the purple CD is displayed like it should.

Bildschirmfoto 2020-02-13 um 13 27 49

about the scaling, I found a few more tags that can be set for Qt apps https://stackoverflow.com/questions/17211006/optimising-python-qt-apps-on-retina-displays

  • Bundling binary Brew deps doesn't seem to work for different macOS builds.
  • Many Brew deps are LGPL licensed making bundled distributions legally complicated.
  • Bass dll's require signing unless a security setting is changed (apple may remove this setting entirely in the future)
  • It may be possible to package Tauon as a brew package and let Brew take care of the deps, but this doesn't solve the retina or bass issues.

Mac installers are pretty much glorified and fancy .zip files with huge icons that tell you to drag&drop the .app to Applications/ . Some include ReadMe's and shell scripts. So instead of a .dmg you could make a .zip available with a readme.txt, install-deps-via-brew-in-directory-xy.sh and tauon.app. Not the fanciest way but a workaround. Here's an example for a .dmg file Bildschirmfoto 2020-02-13 um 13 36 54

  • A mysterious issue with image loading lingers.

No Idea for that one tho

Taiko2k commented 3 years ago

I'm closing this old issue. If anyone here is still interested in running Tauon on mac, I've made a fresh issue #577