Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Amgine0 opened this issue Feb 16, 2017 · 7 comments · May be fixed by #384
Open

Comments

@Amgine0
Copy link

Amgine0 commented Feb 16, 2017

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}
@DarwinAwardWinner
Copy link

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

@DarwinAwardWinner
Copy link

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.

@pjwerneck
Copy link

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.

@nkoep
Copy link

nkoep commented Nov 30, 2017

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.

@oei
Copy link

oei commented Aug 9, 2018

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

@MightyCreak
Copy link
Contributor

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

@davebiffuk
Copy link

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 davebiffuk linked a pull request Feb 26, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants