sonerezh icon indicating copy to clipboard operation
sonerezh copied to clipboard

Run importError: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'track_number' at row 1

Open Amgine0 opened this issue 8 years ago • 7 comments

I do not know what might cause this error.

Welcome to CakePHP v2.8.1 Console
---------------------------------------------------------------
App : app
Path: /raid/www/sonerezh/app/
---------------------------------------------------------------
[INFO] Scan [path]/Music/...
[INFO] Found 22105 audio files (780 already in the database). Continue? (yes/no) 
[yes] > 
[INFO] Run importError: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'track_number' at row 1
#0 /raid/www/sonerezh/lib/Cake/Model/Datasource/DboSource.php(461): PDOStatement->execute(Array)
#1 /raid/www/sonerezh/lib/Cake/Model/Datasource/DboSource.php(427): DboSource->_execute('INSERT INTO `So...', Array)
#2 /raid/www/sonerezh/lib/Cake/Model/Datasource/DboSource.php(1019): DboSource->execute('INSERT INTO `So...')
#3 /raid/www/sonerezh/lib/Cake/Model/Model.php(1933): DboSource->create(Object(Song), Array, Array)
#4 /raid/www/sonerezh/lib/Cake/Model/Model.php(1751): Model->_doSave(Array, Array)
#5 /raid/www/sonerezh/app/Console/Command/SonerezhShell.php(128): Model->save(Array)
#6 /raid/www/sonerezh/lib/Cake/Console/Shell.php(458): SonerezhShell->import()
#7 /raid/www/sonerezh/lib/Cake/Console/ShellDispatcher.php(212): Shell->runCommand('import', Array)
#8 /raid/www/sonerezh/lib/Cake/Console/ShellDispatcher.php(66): ShellDispatcher->dispatch()
#9 /raid/www/sonerezh/app/Console/cake.php(36): ShellDispatcher::run(Array)
#10 {main}

Amgine0 avatar Feb 16 '17 04:02 Amgine0

I'm seeing this same error, and I have narrowed it down to a few files that are causing it.

DarwinAwardWinner avatar Feb 25 '17 22:02 DarwinAwardWinner

This seems to be caused when the track number and track total in a FLAC file are stored together in the "tracknumber" tag as e.g. "1/16", instead of storing them separately in the "tracknumber" and "tracktotal" tags. Removing and re-adding the track numbers with a tool that sets these tags correctly allows the track to be imported.

DarwinAwardWinner avatar Feb 25 '17 22:02 DarwinAwardWinner

Had the same problem with mp3 files. I tried removing and re-adding the tags and track numbers with several different tools, but nothing worked. After looking into the offending files closely with mp3diags, I found out they had an Ape tag with a Tracks=num/num value. I removed the Ape tag and it works, but maybe the app should either ignore Ape tags completely, or handle the "num/num" format.

pjwerneck avatar Sep 06 '17 04:09 pjwerneck

I'm facing the same problem. At the very least, the error message should indicate which file caused the problem, but mainly the importer should simply skip the file instead of aborting the entire import process.

nkoep avatar Nov 30 '17 17:11 nkoep

I have changed the column into a varchar(10) it looks it does the trick.

oei avatar Aug 09 '18 21:08 oei

You could try to use the @gs11's fork which is more advanced and may have fixed this issue already: https://github.com/gs11/sonerezh

MightyCreak avatar Aug 09 '18 23:08 MightyCreak

In Lib/SongManager/SongManager.php the code to handle the "track" tag needs the same ability to handle xx/yy format as the code to handle the "track_number" tag does. I hand-patched my copy to look like this (around line 69) and I don't get that error any more. I will make a pull request.

        // Song track number
        if (!empty($file_infos['comments']['track'])) {              // MP3 Tag
            //$metadata['track_number'] = (string)end($file_infos['comments']['track']);
            $track = explode('/', (string)end($file_infos['comments']['track']));
            $metadata['track_number'] = intval($track[0]);
        } elseif (!empty($file_infos['comments']['track_number'])) { // MP3 Tag
            // Some tags look like '1/10'
            $track_number = explode('/', (string)end($file_infos['comments']['track_number']));
            $metadata['track_number'] = intval($track_number[0]);
        } elseif(!empty($file_infos['comments']['tracknumber'])){   // OGG Tag
            $metadata['track_number'] = end($file_infos['comments']['tracknumber']);
        }

davebiffuk avatar Feb 26 '20 23:02 davebiffuk