acenko / FLACCue

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

No spund #8

Closed Tigo7 closed 1 year ago

Tigo7 commented 1 year ago

First of all, thanks for your work. I got the fuse system up and running, flac-cues get split and Plex can see the individual files in the mirrored /flaccue dir. So far so good. When I press play, the webclient shows the equalizerbar in front of a track, it’s bouncing. But I get no sound. I get a time out with a 1003 network error at best. On the iPhone apps like Plex or plexAmp, the individual tracks are recognized but no connection is established. Tried all the obvious things such as checking user permission, volume control checks, and transcoding options, but to no avail. Perhaps ffmpeg is cousing trouble? I’m on Syno DSM7 and installed via your pkg.

acenko commented 1 year ago

The first thing I'd try is to run the server manually and see if it provides any extra useful information. It sounds like this is probably ffmpeg related, as you suspect, but this would hopefully be able to confirm that with more details. The following should hopefully get this going:

  1. Go into Package Center and stop the FLACCue package.
  2. Log into a command line for your server. I personally use ssh.
  3. Run the package. For me, this command does it: sudo -u flaccue /var/packages/FLACCue/target/usr/bin/FLACCue / /flaccue

At this point, you should be able to access the files through Plex and get direct feedback from the code. You can also send the output of the command to a file by appending " > junk.txt 2>&1" to that command (sending it to "junk.txt"--use whatever path you want there)--this can make it a little easier to search through. If you can post as much of the error as you can, I may be able to help track it down more.

Tigo72 commented 1 year ago

Thanks for thinking along, Acenko. Much appreciated! The package doesn't start that way. Here's what the terminal and junk.txt have to say:

fuse: bad mount point `/flaccue': Transport endpoint is not connected Traceback (most recent call last): File "/var/packages/FLACCue/target/usr/bin/FLACCue", line 749, in fuse_obj = fuse.FUSE(FLACCue(args.root, args.mount, format=args.format, verbose=args.verbose), File "/volume1/@appstore/FLACCue/usr/bin/./fuse.py", line 714, in init raise RuntimeError(err) RuntimeError: 1

acenko commented 1 year ago

Does the /flaccue directory exist? If so, you may need to force unmount it (sudo umount -f /flaccue) or reboot the machine. If not, it's possible the directory disappeared somehow (it sometimes happens when updating the server). You may need to recreate it with: sudo -i mkdir /flaccue chown flaccue:flaccue /flaccue

It's plausible this is related to Plex trying to scan the directory--you may wish to stop Plex for some of these tests, using some other media player (or even just "cat") to trigger the file reads. Hopefully not necessary but worth keeping in mind if you still run into issues--in particular, Plex may trigger a lot more reads than you want to deal with once the server starts up.

Tigo72 commented 1 year ago

The dir was there; after unmounting I could generate the log. I've attached it - the behavior of my system is the same as before, so this should aptly reflect what is going on...

junk.txt

acenko commented 1 year ago

The main errors I see in there are related to the external Python packages. Did you already run this?

sudo -i
curl -k https://bootstrap.pypa.io/get-pip.py | python3
pip install ffmpeg-python mutagen numpy

If so, try the following in sudo -u flaccue python3:

import mutagen
mutagen.File
import ffmpeg
ffmpeg.input

From the log, both of those should raise an AttributeError but are actually required by the code to run. It's possible this is a permission issue but it's worth checking the versions of those packages. On my system, I get:

sudo pip show mutagen

Name: mutagen Version: 1.46.0 Summary: read and write audio tags for many formats Home-page: https://github.com/quodlibet/mutagen Author: Christoph Reiter Author-email: reiter.christoph@gmail.com License: GPL-2.0-or-later Location: /usr/lib/python3.8/site-packages Requires: Required-by:

sudo pip show ffmpeg-python

Name: ffmpeg-python Version: 0.2.0 Summary: Python bindings for FFmpeg - with complex filtering support Home-page: https://github.com/kkroening/ffmpeg-python Author: Karl Kroening Author-email: karlk@kralnet.us License: UNKNOWN Location: /usr/lib/python3.8/site-packages Requires: future Required-by:

We can also then use the Location value to check the permissions as well. On my system:

ls -lh /usr/lib/python3.8/site-packages/ | grep mutagen

drwxrwxr-x 8 root root 4.0K Oct 14 00:19 mutagen drwxrwxr-x 2 root root 4.0K Oct 14 00:19 mutagen-1.46.0.dist-info

ls -lh /usr/lib/python3.8/site-packages/ | grep ffmpeg

drwxrwxr-x 3 root root 4.0K Oct 14 00:19 ffmpeg drwxrwxr-x 2 root root 4.0K Oct 14 00:19 ffmpeg_python-0.2.0.dist-info

Files within those directories show similar permissions. You could try sudo chmod -R a+rX /usr/lib/python3.8/site-packages/ as a blunt force fix for these permissions, but it's probably better to figure out the specific issue.

Let me know what you find and we can iterate from there.

Tigo72 commented 1 year ago

Again, thanks for your help:

The versions are all the same:

Name: mutagen Version: 1.46.0 Summary: read and write audio tags for many formats Home-page: https://github.com/quodlibet/mutagen Author: Christoph Reiter Author-email: reiter.christoph@gmail.com License: GPL-2.0-or-later Location: /usr/lib/python3.8/site-packages Requires: Required-by:

Name: ffmpeg-python Version: 0.2.0 Summary: Python bindings for FFmpeg - with complex filtering support Home-page: https://github.com/kkroening/ffmpeg-python Author: Karl Kroening Author-email: karlk@kralnet.us License: UNKNOWN Location: /usr/lib/python3.8/site-packages Requires: future Required-by:

After the command /$ ls -lh /usr/lib/python3.8/site-packages/ | grep mutagen I got initially:

drwx------ 8 root root 4.0K Feb 20 14:46 mutagen drwx------ 2 root root 4.0K Feb 20 14:46 mutagen-1.46.0.dist-info

and /$ ls -lh /usr/lib/python3.8/site-packages/ | grep ffmpeg

drwx------ 3 root root 4.0K Feb 20 14:46 ffmpeg drwx------ 2 root root 4.0K Feb 20 14:46 ffmpeg_python-0.2.0.dist-info

I did the brute force and now the rights say:

drwxr-xr-x 8 root root 4.0K Feb 20 14:46 mutagen drwxr-xr-x 2 root root 4.0K Feb 20 14:46 mutagen-1.46.0.dist-info

drwxr-xr-x 3 root root 4.0K Feb 20 14:46 ffmpeg drwxr-xr-x 2 root root 4.0K Feb 20 14:46 ffmpeg_python-0.2.0.dist-info

Yet, no sound at this point.

BTW, I could not run the commands

sudo -u flaccue python3

import mutagen mutagen.File

import ffmpeg ffmpeg.input

After the first line (sudo -u flaccue python3), my terminal freezes, and the import command is not recognized when I try that later. Perhaps I misunderstand what to do at this point...

acenko commented 1 year ago

If you can try manually running the code again, you should get a different error now. The permissions on the Python packages would certainly have been a problem. If we can see a new error, hopefully we can move another step forward!

With regards to the sudo -u flaccue python3, we should be safe to skip that for now. We were just trying to run Python as the same user the server runs as, which shouldn't be needed if the same error isn't still happening. If it is still the same error, try just python3 without the sudo portion--this would run as your user instead of the flaccue user, but that should still detect many issues.

Tigo72 commented 1 year ago

Well, I have a new error indeed. I also faced a system crash last night -- had to restore DSM -- so I get a bit nervous too ;-) No data lost though. Here's the output of junk.txt

fuse: mountpoint is not empty fuse: if you are sure this is safe, use the 'nonempty' mount option Traceback (most recent call last): File "/var/packages/FLACCue/target/usr/bin/FLACCue", line 749, in fuse_obj = fuse.FUSE(FLACCue(args.root, args.mount, format=args.format, verbose=args.verbose), File "/volume1/@appstore/FLACCue/usr/bin/fuse.py", line 714, in init raise RuntimeError(err) RuntimeError: 1

acenko commented 1 year ago

This sounds like a different version of the mount point error, possibly needing sudo umount -f /flaccue to fix. That said, you should first ensure there aren't any residual copies of FLACCue running as 'nonempty' suggests there is already something in the folder--first check the Package Manager but you can also verify with: ps aux | grep FLACCue | grep -v grep flaccue 14371 0.2 1.7 2375968 136040 ? Sl Feb24 3:20 python3 /volume1/@appstore/FLACCue/usr/bin/FLACCue / /flaccue/

With regards to the system restore, that sucks although I'm glad you still have all your data. I don't think anything we're trying here should cause that but it's particularly important to be careful issuing commands using sudo and exiting root access when using sudo -i (or just issuing each separate command through sudo). The sudo command causes commands to run as the "root" superuser and allow you to do basically anything on the system. Also specifying a user in sudo (sudo -u flaccue) is safer, as this only runs as the specified user, although also limits what you're able to do. With great power comes great responsibility!

Tigo72 commented 1 year ago

I works! I had to reboot the Syno once more, but wouldn't you know it! The rights issue on ffmpeg and mutagen must have done the trick (?). Thank you so much for your help and patience - love the fact that you made it possible to use cue sheets in Plex. Just great! Tigo

acenko commented 1 year ago

Great to hear! Give it a try for a few days and let me know if you run into any more issues. If not, we'll close out this issue. Enjoy!

Tigo7 commented 1 year ago

So far so good! Great work. I’ll close this issue.