andresch / trackfs Goto Github PK
View Code? Open in Web Editor NEWA FUSE filesystem that splits FLAC+CUE files into individual tracks
License: Other
A FUSE filesystem that splits FLAC+CUE files into individual tracks
License: Other
Hi,
This is a very neat tool. Congratulations and thanks!
I have been able to mount a single WAV+CUE file as a list of individual FLAC tracks and it plays just fine! ;-)
However, when I try to do the same with the single FLAC+CUE file (for the same album, the FLAC file being derived from the above WAV file), I get this error as soon as I try to play one track with ffplay from another terminal.
Any help or idea is welcome!
Cheers
Tested on Ubuntu 20.04 and with trackfs built using pip3.
$ trackfs /home/beuguissime/riptest /home/beuguissime/ripfs
Type "flac" for a usage summary or "flac --help" for all options
failed to extract track #1 from file "/home/beuguissime/riptest/WZi7lDz2DeUOBowkh8DNLwHcH5A-.flac"
Uncaught exception from FUSE operation open, returning errno.EINVAL.
Traceback (most recent call last):
File "/home/beuguissime/.local/lib/python3.8/site-packages/fuse.py", line 734, in _wrapper
return func(*args, **kwargs) or 0
File "/home/beuguissime/.local/lib/python3.8/site-packages/fuse.py", line 834, in open
fi.fh = self.operations('open', path.decode(self.encoding),
File "/home/beuguissime/.local/lib/python3.8/site-packages/trackfs/fuseops.py", line 60, in __call__
return super(TrackFSOps, self).__call__(op, self.root + path, *args)
File "/home/beuguissime/.local/lib/python3.8/site-packages/fuse.py", line 1076, in __call__
return getattr(self, op)(*args)
File "/home/beuguissime/.local/lib/python3.8/site-packages/trackfs/fuseops.py", line 94, in open
path = self.tracks.prepare_track(path, fp)
File "/home/beuguissime/.local/lib/python3.8/site-packages/trackfs/flactracks.py", line 273, in prepare_track
return self._extract_flac_track(path, fp, album_info)
File "/home/beuguissime/.local/lib/python3.8/site-packages/trackfs/flactracks.py", line 196, in _extract_flac_track
raise FlacSplitException(err_msg)
trackfs.flactracks.FlacSplitException: failed to extract track #1 from file "/home/beuguissime/riptest/WZi7lDz2DeUOBowkh8DNLwHcH5A-.flac"
Hello,
the default file-names are
{album-file}.#-#.{tracknumber}.{track-title}.flac
That produces very long file-names though. Would it be possible to specify to have something like
{tracknumber}.{track-title}.flac
?
As a beginner I tried to give a look into trackfs/fusepath.py and editing 53, but with no results.
This looks like a good feature, I will implement that in FFmpegfs so that the mp3's or whatever get created in the same step, see nschlia/ffmpegfs#66
While playback on via foobar2000 works nicely, when playing the same tracks from my streaming server I get sporadic audio glitches.
docker run -d --name trackfs --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined -v /mnt/sdb2/test:/src:ro -v /mnt/mdisc:/dst:rshared andresch/trackfs --root-allowed
how can I get this problem fixed,thank you very much.
Many of the files in my music library are .wav which would be great if possible. I'm not sure how difficult it would be, but .wav support would be nice.
First of all, thank you so much for this container! I got it working perfectly fine for CD FLAC rips but I noticed for some reason rips that are sourced from vinyl records do not split. The CUE files work fine in Foobar2000 + other apps but this doesn't split them. I thought it was maybe because most vinyl record rips have at least 2 FLAC files (one for each side of the LP, sometimes multiple LPs per album) index by 1 CUE file. As a test I modified a CUE file to get rid of the second FLAC but it didn't have any effect.
Thanks!
Audio files without cue-sheet no longer appear in the virtual file system
from #13:
Is it possible to add a rule to match XX.flac.cue and XX.flac ?
I am trying to install TrackFS on my Raspberry PI 4 but it cannot find an Arm 7 image. Is there one?
see discussion at end of gh-4
Extracting a track might take up to a few seconds. If your media player doesn't prefetch the next track early enough, then gapless playback might not work. By extracting the next track already towards the end of the previous track, it would already wait for being streamed on the cash and reduce the lead time for reading the next track to the time it takes frackfs to open the file from cache.
Hello.
Thank you for the excellent program!
I use it to distribute a small music collection (FLAC Image+CUE) via DLNA (minidlna) for playback on LG TV.
Mostly everything works fine, but after dividing some albums into tracks, trackfs reports the wrong file sizes for individual tracks.
Here is the track information from the Fuse file system and the mediainfo output for one of the tracks:
server /mnt/raid/Музыка/Pink Floyd - Dark Side Of The Moon 1973 ( SomeWax 2002г. ) # ls -l
total 0
-rw-rw-r-- 1 p2p p2p 2989 дек 10 2022 'Dark Side Of The Moon.log'
-rw-rw-r-- 1 p2p p2p 1062 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.cue'
-rw-rw-r-- 1 p2p p2p 31834908 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.001.Speak To M.flac'
-rw-rw-r-- 1 p2p p2p 37622592 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.002.On The Run.flac'
-rw-rw-r-- 1 p2p p2p 75372192 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.003.Time.flac'
-rw-rw-r-- 1 p2p p2p 50169924 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.004.The Great .flac'
-rw-rw-r-- 1 p2p p2p 69222888 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.005.Money.flac'
-rw-rw-r-- 1 p2p p2p 81401544 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.006.Us And The.flac'
-rw-rw-r-- 1 p2p p2p 36359568 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.007.Any Colour.flac'
-rw-rw-r-- 1 p2p p2p 40681368 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.008.Brain Dama.flac'
-rw-rw-r-- 1 p2p p2p 21928284 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.009.Eclipse.flac'
drwxrwxr-x 2 p2p p2p 4096 дек 10 2022 Диск
server /mnt/raid/Музыка/Pink Floyd - Dark Side Of The Moon 1973 ( SomeWax 2002г. ) #
server /mnt/raid/Музыка/Pink Floyd - Dark Side Of The Moon 1973 ( SomeWax 2002г. ) # mediainfo Pink\ Floyd\ -\ Dark\ Side\ Of\ The\ Moon.flac.009.Eclipse.flac
General
Complete name : Pink Floyd - Dark Side Of The Moon.flac.009.Eclipse.flac
Format : FLAC
Format/Info : Free Lossless Audio Codec
File size : 20.9 MiB
Duration : 2 min 4 s
Overall bit rate mode : Variable
Overall bit rate : 1 410 kb/s
Album : Dark Side Of The Moon
Album/Performer : Pink Floyd
Track name : Eclipse
Track name/Position : 9
Track name/Total : 9
Performer : Pink Floyd
Composer : Pink Floyd
DISCID : 6F0A1509
Audio
Format : FLAC
Format/Info : Free Lossless Audio Codec
Duration : 2 min 4 s
Bit rate mode : Variable
Bit rate : 1 410 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 44.1 kHz
Bit depth : 16 bits
Compression mode : Lossless
Stream size : 20.9 MiB (100%)
Writing library : libFLAC 1.3.3 (2019-08-04)
MD5 of the unencoded content : 40F74FD99EC4C887785C3947D1DFEDF0
server /mnt/raid/Музыка/Pink Floyd - Dark Side Of The Moon 1973 ( SomeWax 2002г. ) #
This file gives an error when played (here is part of the minidlna log):
[2023/10/05 07:11:35] minidlna.c:170: debug: HTTP connection from 192.168.2.56:56860
[2023/10/05 07:11:35] upnphttp.c:264: debug: Range Start-End: 12713984 - -1
[2023/10/05 07:11:35] clients.c:357: debug: Client found in cache. [LG/entry 0]
[2023/10/05 07:11:35] upnphttp.c:916: debug: HTTP REQUEST: GET /MediaItems/39384.flac HTTP/1.1
Host: 192.168.2.1:8200
User-Agent: Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 WebAppManager
Connection: close
icy-metadata: 1
Range: bytes=12713984-
[2023/10/05 07:11:35] upnphttp.c:1998: info: Serving DetailID: 39384 [/mnt/raid/Музыка/Pink Floyd - Dark Side Of The Moon 1973 ( SomeWax 2002г. )/Pink Floyd - Dark Side Of The Moon.flac.009.Eclipse.flac]
[2023/10/05 07:11:35] upnphttp.c:2064: warn: Specified range was invalid!
[2023/10/05 07:11:35] upnphttp.c:1277: debug: HTTP RESPONSE: HTTP/1.1 400 Bad Request
Content-Type: text/html
Connection: close
Content-Length: 136
Server: 6.1.41-gentoo DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.3.3
Date: Thu, 05 Oct 2023 04:11:35 GMT
EXT:
<HTML>
<HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD>
<BODY>
<H1>Bad Request</H1>The request is invalid for this HTTP version.</BODY>
</HTML>
If I copy the same files from the Fuse file system to a real hard drive, then the copied files are smaller in size, mediainfo shows a smaller size and a different bitrate:
server /mnt/1/torrents/Pink Floyd - Dark Side Of The Moon 1973 ( SomeWax 2002г. ) # ls -l
total 265476
-rw-rw-r-- 1 p2p p2p 2989 дек 10 2022 'Dark Side Of The Moon.log'
-rw-rw-r-- 1 p2p p2p 1062 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.cue'
-rw-rw-r-- 1 p2p p2p 23214518 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.001.Speak To M.flac'
-rw-rw-r-- 1 p2p p2p 21382110 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.002.On The Run.flac'
-rw-rw-r-- 1 p2p p2p 44669457 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.003.Time.flac'
-rw-rw-r-- 1 p2p p2p 26696409 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.004.The Great .flac'
-rw-rw-r-- 1 p2p p2p 46425658 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.005.Money.flac'
-rw-rw-r-- 1 p2p p2p 49211303 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.006.Us And The.flac'
-rw-rw-r-- 1 p2p p2p 22555369 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.007.Any Colour.flac'
-rw-rw-r-- 1 p2p p2p 25073379 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.008.Brain Dama.flac'
-rw-rw-r-- 1 p2p p2p 12587210 дек 10 2022 'Pink Floyd - Dark Side Of The Moon.flac.009.Eclipse.flac'
drwxrwxr-x 2 p2p p2p 4096 дек 10 2022 Диск
server /mnt/1/torrents/Pink Floyd - Dark Side Of The Moon 1973 ( SomeWax 2002г. ) #
server /mnt/1/torrents/Pink Floyd - Dark Side Of The Moon 1973 ( SomeWax 2002г. ) # mediainfo Pink\ Floyd\ -\ Dark\ Side\ Of\ The\ Moon.flac.009.Eclipse.flac
General
Complete name : Pink Floyd - Dark Side Of The Moon.flac.009.Eclipse.flac
Format : FLAC
Format/Info : Free Lossless Audio Codec
File size : 12.0 MiB
Duration : 2 min 4 s
Overall bit rate mode : Variable
Overall bit rate : 809 kb/s
Album : Dark Side Of The Moon
Album/Performer : Pink Floyd
Track name : Eclipse
Track name/Position : 9
Track name/Total : 9
Performer : Pink Floyd
Composer : Pink Floyd
DISCID : 6F0A1509
Audio
Format : FLAC
Format/Info : Free Lossless Audio Codec
Duration : 2 min 4 s
Bit rate mode : Variable
Bit rate : 809 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 44.1 kHz
Bit depth : 16 bits
Compression mode : Lossless
Stream size : 12.0 MiB (100%)
Writing library : libFLAC 1.3.3 (2019-08-04)
MD5 of the unencoded content : 40F74FD99EC4C887785C3947D1DFEDF0
server /mnt/raid/Музыка/Pink Floyd - Dark Side Of The Moon 1973 ( SomeWax 2002г. ) #
These files play normally.
Here is a link to the original files to check (FLAC Image+CUE):
https://drive.google.com/file/d/11Dp453WCW6Lk3jD_7Cwiku6pJ2_2Tocp/view?usp=sharing
Hello. I don't see an option to save the cue sheet (file) that tracksf creates. My goal is to actually split the flac into its tracks (for which I can use one of several tools). I just found trackfs which I see can read the embedded cue sheet. If there is currently an option to save it, I did not see it.
If that option does not exist please consider it as a new feature. Alternatively, if you recommend some other Linux tools for this, could you let me know?
What are your thoughts? Thank you.
currently trackfs would only match ".wav" and ".flac", but not ".WAV" or ":FLAC"
Current trackfs shows all attributes including methods of CueSheet
object as tags. Here are excerpts from "metaflac --list" for a track file.
comment[41]: __ANNOTATIONS__={'tracks': typing.List[ForwardRef('Track')], 'albumartists': typing.List[str], 'album': <class 'str'>, 'composers': typing.List[str], 'catalog': <class 'str'>, 'discid': <class 'str'>, 'year': <class 'str'>, 'discnumber': <class 'str'>, 'totaldiscs': <class 'str'>}
comment[42]: __CLASS__=<class 'trackfs.cuesheet.CueSheet'>
...
comment[50]: __FORMAT__=<built-in method __format__ of CueSheet object at 0x7f9106e90580>
comment[51]: __GE__=<method-wrapper '__ge__' of CueSheet object at 0x7f9106e90580>
This is caused by the following code in the CueSheet
class.
def tags(self):
return TagTools.object_tags(self, dir(self).remove('tracks'))
Please note that the list's remove()
method always returns None
. TagTools.object_tags()
calls dir(o)
when names
argument is None
, which results in names
to be all attributes/methods of CueSheet
object.
IsADirectoryError: [Errno 21] Is a directory: '/src/Rod.Stewart-The.Best.Of.Rod.Stewart.1971.Flac'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/fuse.py", line 734, in _wrapper
return func(*args, **kwargs) or 0
File "/usr/local/lib/python3.8/site-packages/fuse.py", line 960, in readdir
for item in self.operations('readdir', self._decode_optional_path(path),
File "/usr/local/lib/python3.8/site-packages/trackfs/fuseops.py", line 60, in call
return super(TrackFSOps, self).call(op, self.root + path, *args)
File "/usr/local/lib/python3.8/site-packages/fuse.py", line 1076, in call
return getattr(self, op)(*args)
File "/usr/local/lib/python3.8/site-packages/trackfs/fuseops.py", line 127, in readdir
return self._fusepath(path).readdir()
File "/usr/local/lib/python3.8/site-packages/trackfs/fusepath.py", line 145, in readdir
trx = albuminfo.get(os.path.join(self.source, filename)).tracks()
File "/usr/local/lib/python3.8/site-packages/trackfs/albuminfo.py", line 78, in tracks
return self.cue.tracks if self.cue is not None else []
File "/usr/local/lib/python3.8/functools.py", line 967, in get
val = self.func(instance)
File "/usr/local/lib/python3.8/site-packages/trackfs/albuminfo.py", line 63, in cue
meta = self.meta
File "/usr/local/lib/python3.8/functools.py", line 967, in get
val = self.func(instance)
File "/usr/local/lib/python3.8/site-packages/trackfs/albuminfo.py", line 37, in meta
return File(self.path)
File "/usr/local/lib/python3.8/site-packages/mutagen/_util.py", line 162, in wrapper_func
with _openfile(None, filething, filename, fileobj,
File "/usr/local/lib/python3.8/contextlib.py", line 113, in enter
return next(self.gen)
File "/usr/local/lib/python3.8/site-packages/mutagen/_util.py", line 272, in _openfile
raise MutagenError(e)
mutagen.MutagenError: [Errno 21] Is a directory: '/src/Rod.Stewart-The.Best.Of.Rod.Stewart.1971.Flac'
INFO Dummy-3 getattr for (/src/autorun.inf) [None]
DEBUG Dummy-3 no track file in "/src/autorun.inf"
DEBUG Dummy-3 FusePath(source_root='/src/autorun', extension='.inf', is_track=False, num=None, title=None, factory=Factory(track_separator='.#-#.', max_title_len=20, album_extension='(?i:\.flac|\.wav)', valid_filename_chars='-() abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', keep_album=False, track_extension='.flac'))
DEBUG Dummy-3 FUSE operation getattr raised a <class 'FileNotFoundError'>, returning errno 2.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/fuse.py", line 734, in _wrapper
return func(*args, **kwargs) or 0
File "/usr/local/lib/python3.8/site-packages/fuse.py", line 774, in getattr
return self.fgetattr(path, buf, None)
File "/usr/local/lib/python3.8/site-packages/fuse.py", line 1027, in fgetattr
attrs = self.operations('getattr', self._decode_optional_path(path), fh)
File "/usr/local/lib/python3.8/site-packages/trackfs/fuseops.py", line 60, in call
return super(TrackFSOps, self).call(op, self.root + path, *args)
File "/usr/local/lib/python3.8/site-packages/fuse.py", line 1076, in call
return getattr(self, op)(*args)
File "/usr/local/lib/python3.8/site-packages/trackfs/fuseops.py", line 69, in getattr
st = os.lstat(fp.source)
FileNotFoundError: [Errno 2] No such file or directory: '/src/autorun.inf'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.