Closed boostrap closed 9 years ago
Do you have an example command you run for your splitting
shntool split -f .cue -o flac .flac ; cuetag .cue split-track.flac
This usually works, except in the case of very high bitrate files which often give the following error.. (shnsplit: error: m:ss.ff format can only be used with CD-quality files) It seems that shnsplit expects an extra digit (mm:ss:nnn) for high bitrate files.
The nnn problem could be addressed with a little math, where nnn = (ff / 75) * 1000
I've worked around the problem by feeding the times out of the cue file as parameters into the flac binary (not my work btw).
[[ ! -f "${1}" && ! -f "${2}" ]] && return 1
cue_file="${1}" aud_file="${2}"
time[0]="00:00.00" c=1 for ts in $(cuebreakpoints "${cue_file}"); do time[${c}]=${ts} c=$((c+1)) done time[${c}]='-0' for ((i=0;i<$((${#time[@]}-1));i++)); do trackno=$(($i+1)) TRACKNUMBER="$(printf %02d ${trackno})" title="$(cueprint --track-number ${trackno} -t '%t' "${cue_file}")" flac --silent --exhaustive-model-search --skip=${time[$i]} --until=${time[$(($i+1))]} --tag=ARTIST="${ARTIST}" --tag=ALBUM="${ALBUM}" --tag=DATE="${DATE}" --tag=TITLE="${title}" --tag=TRACKNUMBER="${TRACKNUMBER}" "${aud_file}" --output-name="${TRACKNUMBER}-${title}.flac" done
Post processing (develop branch) will now try and auto split the track based on the cue, if it fails then the folder will be set to unprocessed. The splitting requires shntool with flac or xld (OS X) to be installed. I don't get many of these single file/cue so this could do with some testing, are you able to give it a try?
Here's one I just tried,
2014-10-25 22:37:06 WARNING Cue not split: inconsistent CUE sheet, TRACK expected at line 3 2014-10-25 22:37:06 INFO Attempting to split audio files by cue 2014-10-25 22:37:06 INFO Found "Cell - Phonic Peace, @NMR@" in nzb download folder. Verifying.... 2014-10-25 22:37:06 INFO Checking if /home/htpc/Downloads/Headphones files/Cell - Phonic Peace, @NMR@ exists
CUE file as follows..
PERFORMER "Cell" TITLE "Phonic Peace" FILE "Cell - Phonic Peace.flac" FLAC TRACK 01 AUDIO TITLE "Sensitiv'Garden" PERFORMER "Cell" INDEX 01 00:00:00 TRACK 02 AUDIO TITLE "Mister Ayatih" PERFORMER "Cell" INDEX 01 05:21:53 TRACK 03 AUDIO TITLE "Zaz" PERFORMER "Cell" INDEX 01 16:47:50 TRACK 04 AUDIO TITLE "Magic Karma" PERFORMER "Cell" INDEX 01 26:25:35 TRACK 05 AUDIO TITLE "Soon" PERFORMER "Cell" INDEX 01 32:09:28 TRACK 06 AUDIO TITLE "Lord If Silk" PERFORMER "Cell" INDEX 01 39:13:44 TRACK 07 AUDIO TITLE "White Call" PERFORMER "Cell" INDEX 01 44:45:35 TRACK 08 AUDIO TITLE "Phonic Peace for Tibet" PERFORMER "Cell" INDEX 01 53:14:60 TRACK 09 AUDIO TITLE "Orange" PERFORMER "Cell" INDEX 01 61:13:15
I've seen it work a few times too! :+1:
Here's one, it went on to process disc two, and then re-encode them per my settings. Before I erm deleted the files, I listened to the break points and they're all spot on :)
25-Oct-2014 23:49:06 - INFO :: Thread-23 : Checking if /home/htpc/Downloads/Headphones files/Pink Floyd - Echoes - The Best Of Pink Floyd - 2001 exists 25-Oct-2014 23:49:06 - INFO :: Thread-23 : Found "Pink Floyd - Echoes - The Best Of Pink Floyd - 2001" in torrent download folder. Verifying.... 25-Oct-2014 23:49:06 - INFO :: Thread-23 : Attempting to split audio files by cue 25-Oct-2014 23:49:06 - INFO :: Thread-23 : CUE Sheet found: Pink Floyd - Echoes The Best Of Pink Floyd Disc 1 of 2.cue 25-Oct-2014 23:49:06 - INFO :: Thread-23 : Music file found: Pink Floyd - Echoes The Best Of Pink Floyd Disc 1 of 2.flac 25-Oct-2014 23:49:06 - INFO :: Thread-23 : Splitting Pink Floyd - Echoes The Best Of Pink Floyd Disc 1 of 2.flac... 25-Oct-2014 23:49:06 - DEBUG :: Thread-23 : shntool split -f split.dat -o flac "Pink Floyd - Echoes The Best Of Pink Floyd Disc 1 of 2.flac" 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Split success Pink Floyd - Echoes The Best Of Pink Floyd Disc 1 of 2.flac 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track05.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track12.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track10.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track01.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track04.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track09.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track02.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track13.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track03.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track07.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track08.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track11.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Tagging split-track06.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track05.flac to 05 - Echoes.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track12.flac to 12 - Sheep.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track10.flac to 10 - Money.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track01.flac to 01 - Astronomy Domine.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track04.flac to 04 - Another Brick In The Wall (Part 2).flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track09.flac to 09 - Set The Controls For The Heart Of The Sun.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track02.flac to 02 - See Emily Play.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track13.flac to 13 - Sorrow.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track03.flac to 03 - The Happiest Days Of Our Lives.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track07.flac to 07 - Marooned.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track08.flac to 08 - The Great Gig In The Sky.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track11.flac to 11 - Keep Talking.flac... 25-Oct-2014 23:50:18 - INFO :: Thread-23 : Renaming split-track06.flac to 06 - Hey You.flac...
Hi, thanks for testing, have made a small change in develop, can you give it another go with the 'Cell - Phonic Peace' and any others that failed
Different non positive result now..
26-Oct-2014 19:44:58 - INFO :: Thread-13 : Attempting to split audio files by cue 26-Oct-2014 19:44:58 - INFO :: Thread-13 : CUE Sheet found: Cell - Phonic Peace.cue 26-Oct-2014 19:44:58 - INFO :: Thread-13 : Music file found: Cell - Phonic Peace.flac 26-Oct-2014 19:44:58 - INFO :: Thread-13 : Splitting Cell - Phonic Peace.flac... 26-Oct-2014 19:44:58 - DEBUG :: Thread-13 : shntool split -f split.dat -o flac "Cell - Phonic Peace.flac" 26-Oct-2014 19:46:03 - INFO :: Thread-13 : Split success Cell - Phonic Peace.flac 26-Oct-2014 19:46:03 - INFO :: Thread-13 : Tagging split-track05.flac... 26-Oct-2014 19:46:03 - WARNING :: Thread-13 : Cue not split: 'date'
However when I investigated the directory, all the split files were completed.
So I cleaned the files and tried to execute 'shntool split -f .cue -o flac .flac ; cuetag .cue split-track.flac', the split worked and the tagging broke with the following lines repeated 9 times.
bad character 'F' bad character 'L' bad character 'A' bad character 'C' 4: syntax error 4: no file specified for track 8: no file specified for track 12: no file specified for track 16: no file specified for track 20: no file specified for track 24: no file specified for track 28: no file specified for track 32: no file specified for track 36: no file specified for track
Presumably a bad cue sheet, if I edit it and change FLAC to WAVE it works. Also noted that the cuetag shellscript above relies on cueprint, which also produces a similar error.
To add to my last comment, editing the cue sheet allowed it to work with cuetag, but re-processing with Headphones results in the same error. Another download failed with the same error.
Looks like it's splitting ok but fails on the tagging, probably due to an expected sheet value such as date, will look at this later
On 27/10/2014, at 9:48 am, boostrap notifications@github.com wrote:
To add to my last comment, editing the cue sheet allowed it to work with cuetag, but re-processing with Headphones results in the same error. Another download failed with the same error.
— Reply to this email directly or view it on GitHub.
OK, made another change
I tried another couple with no problems, and it is also now working for the 'Cell - Phonic Peace' album. Will you be adding a config option for it? I can imagine fans of classical music would find it annoying to have their files split. Great work, I'm pleased with this.
Makes sense to have a config option, any thoughts on what to call it and where it should go?
I guess something in he Post-Processing options like.. "Split single file albums into multiple tracks (if cue metadata present)"?
It's in master now.
I am running headphones on Synology, and I installed shntool via ipkg. Unfortunately, headphones does not see it as being installed...
2014-12-07 17:35:48 WARNING Cue not split: Command not found, ensure shntools with FLAC or xld (OS X) installed
Here is the information from shntool
DiskStation> shntool -h Usage: shntool mode ... shntool [OPTIONS]
Options:
-m show detailed mode module information -f show detailed format module information -a show default format module arguments -v show version information -h show this help screen
DiskStation> shntool -v shntool 3.0.10 Copyright (C) 2000-2009 Jason Jordan shnutils@freeshell.org
shorten utilities pages:
http://www.etree.org/shnutils/ http://shnutils.freeshell.org/
This is free software. You may redistribute copies of it under the terms of the GNU General Public License http://www.gnu.org/licenses/gpl.html. There is NO WARRANTY, to the extent permitted by law.
DiskStation> shntool -m shntool 3.0.10 supported modes:
mode description
len Displays length, size and properties of PCM WAVE data fix Fixes sector-boundary problems with CD-quality PCM WAVE data hash Computes the MD5 or SHA1 fingerprint of PCM WAVE data pad Pads CD-quality files not aligned on sector boundaries with silence join Joins PCM WAVE data from multiple files into one split Splits PCM WAVE data from one file into multiple files cat Writes PCM WAVE data from one or more files to the terminal cmp Compares PCM WAVE data in two files cue Generates a CUE sheet or split points from a set of files conv Converts files from one format to another info Displays detailed information about PCM WAVE data strip Strips extra RIFF chunks and/or writes canonical headers gen Generates CD-quality PCM WAVE data files containing silence trim Trims PCM WAVE silence from the ends of files
For help with any of the above modes, type: 'shntool mode -h'
DiskStation> shntool -f shntool 3.0.10 supported file formats:
format ext input output description
wav .wav shntool shntool RIFF WAVE file format aiff .aiff sox sox Audio Interchange File Format shn .shn shorten shorten Shorten low complexity waveform coder flac .flac flac flac Free Lossless Audio Codec ape .ape mac mac Monkey's Audio Compressor alac - alac - Apple Lossless Audio Codec tak .tak takc takc (T)om's lossless (A)udio (K)ompressor ofr .ofr ofr ofr OptimFROG Lossless WAVE Audio Coder tta .tta ttaenc ttaenc TTA Lossless Audio Codec als .als mp4als mp4als MPEG-4 Audio Lossless Coding wv .wv wvunpack wavpack WavPack Hybrid Lossless Audio Compression lpac - lpac - Lossless Predictive Audio Compression la - la - Lossless Audio Compresser mkw .mkw mkwcon mkwcon MKW Audio Compression format bonk .bonk bonk bonk Bonk lossy/lossless audio compressor kxs - kexis - Kexis lossless WAV file compressor cust - - shntool Custom output format module term - - shntool Sends output to the terminal null - - shntool Sends output to /dev/null
DiskStation> which shntool /opt/bin/shntool DiskStation> echo $PATH /sbin:/bin:/usr/sbin:/usr/bin:/opt/bin:/opt/sbin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin
Obviously, the shtool installed is compatible, it is just not found by cuesplit.py
@WolfieNuke I'm guessing headphones is running from some sort of startup script that sets it's own PATH and doesn't use the Environment PATH? Can this be changed at all to include opt/bin? You will also need to install flac and add that location. Might be that we need to have a couple of config options to specify the paths to shntool and flac
I think the easiest solution (and most flexible), is to put a form for shtool path - similar to the ffmpeg path form.
I don't mind making a symlink, as long as I know what paths are searched for shtool. That is a adequate workaround that will suffice for now.
Added a couple of config options in develop for paths to shntool and flac, e.g.
cue_split_shntool_path = /usr/local/bin
cue_split_flac_path = /opt/local/bin
No web interface options for these yet so shutdown headphones and then make the changes to config.ini
Thanks... That will work for now
I have verified that this now works with synology with both shntool and flac installed via ipkg and "/opt/bin" used as the configured path in config.ini.
Thank you @AdeHub
Sorry for this, but how one would make this to work with Windows?
Download the win32 version from here then follow the instructions from the install.txt
, if it's working then download the flac win32 and install in the same location as shntool. That should be enough to get it working with headphones
I have HP set to download lossless files and then re-encode them to ALAC (via the very useful advanced encoding feature).
I find however that I get quite a lot of single file album releases with a CUE file and HP continues post-processing and deletes the leftover files.
Since I like my albums stored as individual tracks, I repeat the download manually and process the files with cuebreakpoints and shnsplit, before feeding them in to the HP download directory and forcing a post-process.
Can we have an option to mark such downloads as 'unprocessed' so I can intervene as appropriate?