acenko / FLACCue

FLAC with cuesheet support for Plex.
MIT License
54 stars 3 forks source link

How to install on debian 11/12 with plex 1.40.1 #9

Closed jpieren closed 6 months ago

jpieren commented 7 months ago

Hi,

Any advice how to install this on a Linux/Debian? Seems the directory structure has change it's now:

root@nas:~/FLACCue-master# ls -al /usr/lib/plexmediaserver
total 36012
drwxr-xr-x  5 root root     4096 Mar 27 17:36  .
drwxr-xr-x 85 root root     4096 Mar 27 17:35  ..
-rwxrwxr-x  1 root root  1561408 Mar 15 02:18  CrashUploader
-rwxr-xr-x  1 root root   275720 Mar 15 01:29 'Plex Commercial Skipper'
-rwxrwxr-x  1 root root  3399080 Mar 15 02:18 'Plex DLNA Server'
-rwxr-xr-x  1 root root   118720 Mar 15 01:29 'Plex Media Fingerprinter'
-rwxrwxr-x  1 root root  4955296 Mar 15 02:18 'Plex Media Scanner'
-rwxrwxr-x  1 root root 19660608 Mar 15 02:18 'Plex Media Server'
-rwxr-xr-x  1 root root  3408944 Mar 15 01:29 'Plex Relay'
-rwxrwxr-x  1 root root    11168 Mar 15 02:18 'Plex SQLite'
-rwxr-xr-x  1 root root    11048 Mar 15 01:29 'Plex Script Host'
-rwxr-xr-x  1 root root   327784 Mar 15 01:29 'Plex Transcoder'
-rwxr-xr-x  1 root root  3104984 Mar 15 01:29 'Plex Tuner Service'
drwxrwxr-x 11 root root     4096 Mar 27 17:36  Resources
drwxrwxr-x  2 root root     4096 Mar 27 17:36  etc
drwxrwxr-x  2 root root     4096 Mar 27 17:36  lib
root@nas:~/FLACCue-master# 

thanks and kind regards Jay

acenko commented 7 months ago

With regards to installing under Linux/Debian, the Plex directory structure shouldn't matter for the latest version--it is no longer reliant on a Plex Scanner.

The two main steps you'll need are:

  1. Run the FLACCue process.
  2. Point the Plex Scanner of your choice to the mount point created by the FLACCue process.

For point 1, you'll need to run something like: python flaccue.py / /flaccue/ This will mirror your entire system into the /flaccue/ mount point. You'll need the /flaccue directory to exist and be empty before running this and the process will need to be run by a user with access to the files you care about. You'll also need to be sure the version of Python used for this has the necessary packages (likely ffmpeg-python, mutagen, numpy, fuse). While most should work fine installed through pip, you may wish to use the copy of fuse.py and fuse.conf provided in the Synology package folders of this repository.

Point 2 should be the easy part. If your music lives in /music, you should see a mirror of this in /flaccue/music when running as above. Any folder that contains a .cue file will automatically show a bunch of .wav files matching the tracks specified in the .cue file. You can see this using ls and copy these files normally if desired, but you'll mostly just want to configure Plex to look in /flaccue/music instead of /music. The rest should be transparent.

Hope that helps!

jpieren commented 7 months ago

Hi Acenko,

thank you that help. However it seems there is an issue:


root@nas:~/FLACCue-master# python3 flaccue.py  /export/Music/  /flaccue &
[1] 3502633
root@nas:~/FLACCue-master# ls /flaccue/

bin   data  etc     flaccue  initrd.img      lib    lost+found  mnt  proc  run   srv  tmp  var      vmlinuz.old       yacht
boot  dev   export  home     initrd.img.old  lib64  media       opt  root  sbin  sys  usr  vmlinuz  webmin-setup.out
root@nas:~/FLACCue-master# 

ls does not result showing the Music directory but root of the system.

I tried the code from Stavros https://www.stavros.io/posts/python-fuse-filesystem/ and that gives the correct view but of course no cue handling.

root@nas:~/FLACCue-master# python3 stavros.py  /export/Music/  /flaccue &
[1] 3507975
root@nas:~/FLACCue-master# ls /flaccue/
 A-Ha                                                                               'Katie Melua'
 ACDC                                                                               'Keane - Discografia completa'
....

any idea what might cause this in the flaccue.py code? I run python 3.11.2 and fusepy 3.0.1 My knowledge of python is a bit limited.

How do you debug something like in VScodium?

cheers Jay

jpieren commented 7 months ago

Hi Acenko,

thank you that help. However it seems there is an issue:


root@nas:~/FLACCue-master# python3 flaccue.py  /export/Music/  /flaccue &
[1] 3502633
root@nas:~/FLACCue-master# ls /flaccue/

bin   data  etc     flaccue  initrd.img      lib    lost+found  mnt  proc  run   srv  tmp  var      vmlinuz.old       yacht
boot  dev   export  home     initrd.img.old  lib64  media       opt  root  sbin  sys  usr  vmlinuz  webmin-setup.out
root@nas:~/FLACCue-master# 

ls does not result showing the Music directory but root of the system.

I tried the code from Stavros https://www.stavros.io/posts/python-fuse-filesystem/ and that gives the correct view but of course no cue handling.

root@nas:~/FLACCue-master# python3 stavros.py  /export/Music/  /flaccue &
[1] 3507975
root@nas:~/FLACCue-master# ls /flaccue/
 A-Ha                                                                               'Katie Melua'
 ACDC                                                                               'Keane - Discografia completa'
....

any idea what might cause this in the flaccue.py code? I run python 3.11.2 and fusepy 3.0.1 My knowledge of python is a bit limited.

How do you debug something like this script in VScodium?

cheers Jay

acenko commented 7 months ago

Looking at the code, it appears I may have never implemented the alternate path handling--apparently I never tested for anything other than / as I run it that way for convenience (as long as you aren't running as root, the standard file permissions should still protect things). I think you could fix this by changing line 409 from: path = path[len(self.mount):] to path = path.replace(self.mount, self.root, 1) but I don't have time to fully test this right now. If you try this and it works, let me know and I can update the code. If it doesn't work, my recommendation would be to just mirror / until I get a chance to look at this more closely...

jpieren commented 6 months ago

thank you for this, however I still see / and not f.ex /export/Music with all music folders.

I run Plex on Debian12 with a direct install (no VM/docker).

acenko commented 6 months ago

If you download the latest copy, it should work mounting arbitrary folders. I haven't tested extensively so please let me know if you run into any issues.

jpieren commented 6 months ago

Thank you for this. Works perfectly. Only issue I have are some of the long filename have "." in it. Nothing some renames can not fix. Great work!