clementine-player / Clementine

:tangerine: Clementine Music Player
https://www.clementine-player.org/
GNU General Public License v3.0
3.74k stars 675 forks source link

Error adding folders to library. #5187

Open rnc opened 8 years ago

rnc commented 8 years ago

Using Fedora 23 and build from http://builds.clementine-player.org/fedora-23/

I see errors like

11:24:38.835 ERROR Database:573                     db error:  QSqlError(19, "Unable to fetch row", "NOT NULL constraint failed: songs.mtime") 
11:24:38.835 ERROR Database:574                     faulty query:  "INSERT INTO songs (title, album, artist, albumartist, composer, track, disc, bpm, year, genre, comment, compilation, bitrate, samplerate, directory, filename, mtime, ctime, filesize, sampler, art_automatic, art_manual, filetype, playcount, lastplayed, rating, forced_compilation_on, forced_compilation_off, effective_compilation, skipcount, score, beginning, length, cue_path, unavailable, effective_albumartist, etag, performer, grouping, lyrics, originalyear, effective_originalyear) VALUES (:title, :album, :artist, :albumartist, :composer, :track, :disc, :bpm, :year, :genre, :comment, :compilation, :bitrate, :samplerate, :directory, :filename, :mtime, :ctime, :filesize, :sampler, :art_automatic, :art_manual, :filetype, :playcount, :lastplayed, :rating, :forced_compilation_on, :forced_compilation_off, :effective_compilation, :skipcount, :score, :beginning, :length, :cue_path, :unavailable, :effective_albumartist, :etag, :performer, :grouping, :lyrics, :originalyear, :effective_originalyear)" 
11:24:38.835 ERROR Database:575                     bound values:  QMap((":album", QVariant(QString, "Cobalt Blue") ) ( ":albumartist" ,  QVariant(QString, "Michael Brook") ) ( ":art_automatic" ,  QVariant(QString, "(embedded)") ) ( ":art_manual" ,  QVariant(QString, "") ) ( ":artist" ,  QVariant(QString, "Michael Brook") ) ( ":beginning" ,  QVariant(qlonglong, 0) ) ( ":bitrate" ,  QVariant(int, 128) ) ( ":bpm" ,  QVariant(float, -1) ) ( ":comment" ,  QVariant(QString, "") ) ( ":compilation" ,  QVariant(int, 0) ) ( ":composer" ,  QVariant(QString, "Michael Brook") ) ( ":ctime" ,  QVariant(int, 1452095427) ) ( ":cue_path" ,  QVariant(QString, "") ) ( ":directory" ,  QVariant(int, 1) ) ( ":disc" ,  QVariant(int, -1) ) ( ":effective_albumartist" ,  QVariant(QString, "Michael Brook") ) ( ":effective_compilation" ,  QVariant(int, 0) ) ( ":effective_originalyear" ,  QVariant(int, -1) ) ( ":etag" ,  QVariant(QString, "") ) ( ":filename" ,  QVariant(QByteArray, "file:///home/rnc/Dropbox/Music/Michael%20Brook/Cobalt%20Blue/06%20Andean.mp3") ) ( ":filesize" ,  QVariant(int, 3470967) ) ( ":filetype" ,  QVariant(int, 5) ) ( ":forced_compilation_off" ,  QVariant(int, 0) ) ( ":forced_compilation_on" ,  QVariant(int, 0) ) ( ":genre" ,  QVariant(QString, "Ambient") ) ( ":grouping" ,  QVariant(QString, "") ) ( ":lastplayed" ,  QVariant(int, -1) ) ( ":length" ,  QVariant(qlonglong, 216000000000) ) ( ":lyrics" ,  QVariant(QString, "") ) ( ":mtime" ,  QVariant(, ) ) ( ":originalyear" ,  QVariant(int, -1) ) ( ":performer" ,  QVariant(QString, "") ) ( ":playcount" ,  QVariant(int, 0) ) ( ":rating" ,  QVariant(float, -1) ) ( ":sampler" ,  QVariant(int, 0) ) ( ":samplerate" ,  QVariant(int, 44100) ) ( ":score" ,  QVariant(int, 0) ) ( ":skipcount" ,  QVariant(int, 0) ) ( ":title" ,  QVariant(QString, "Andean") ) ( ":track" ,  QVariant(int, 6) ) ( ":unavailable" ,  QVariant(int, 0) ) ( ":year" ,  QVariant(int, 1998) ) )  
SamTShaw commented 7 years ago

I'm encountering this issue with 1.3.1 as well. Using KDE Neon/Ubuntu 16.04 with Clementine from ppa:me-davidsansome/clementine.

The exact same file (identical md5sum) is works on my other machine (same OS and Clementine version). The file can also be manually played by clementine with no issues.

As a work-around I tried removing the NOT NULL constraint from songs.mtime in the DB, but then none of the library displayed in Clementine. I also tried removing the constraint, scanning the files, putting a dummy value in the column and re-enabling the constraint, but again the library didn't display in Clementine.

EDIT: I found what the issue is. Looking at the source code, I found that mtime means the last modified time of the file. I had a look at the files that weren't being added to the library, and for some reason the modified time was about a hundred years in the future. Running find Music/ -print0|xargs -0 -P 100 touch to set the modified time to something sensible resulted in Clementine successfully adding the files to the library.

uqs commented 4 years ago

Similar issue here. I haven't used Clementine in years (!) but now I get the following when scanning files from an NFS mount (via automounter)

db error: QSqlError("19", "Unable to fetch row", "NOT NULL constraint failed: songs.ctime")

If I stat a random file, it comes up like so:

% stat foo.mp3 device 250081246984 inode 9989 mode 33188 nlink 1 uid 1000 gid 999 rdev 18446735277749999616 size 11064307 atime 1045664936 mtime 1328967066 ctime 1499331650 blksize 4096 blocks 21777 link

20:42:19.420 ERROR Database:593 db error: QSqlError("19", "Unable to fetch row", "NOT NULL constraint failed: songs.ctime") 20:42:19.420 ERROR Database:594 faulty query: "INSERT INTO songs (title, album, artist, albumartist, composer, track, disc, bpm, year, genre, comment, compilation, bitrate, samplerate, directory, filename, mtime, ctime, filesize, sampler, art_automatic, art_manual, filetype, playcount, lastplayed, rating, forced_compilation_on, forced_compilation_off, effective_compilation, skipcount, score, beginning, length, cue_path, unavailable, effective_albumartist, etag, performer, grouping, lyrics, originalyear, effective_originalyear) VALUES (:title, :album, :artist, :albumartist, :composer, :track, :disc, :bpm, :year, :genre, :comment, :compilation, :bitrate, :samplerate, :directory, :filename, :mtime, :ctime, :filesize, :sampler, :art_automatic, :art_manual, :filetype, :playcount, :lastplayed, :rating, :forced_compilation_on, :forced_compilation_off, :effective_compilation, :skipcount, :score, :beginning, :length, :cue_path, :unavailable, :effective_albumartist, :etag, :performer, :grouping, :lyrics, :originalyear, :effective_originalyear)" 20:42:19.420 ERROR Database:595 bound values: QMap((":album", QVariant(QString, "Season 5"))(":albumartist", QVariant(QString, ""))(":art_automatic", QVariant(QString, "redacted - cover.jpg"))(":art_manual", QVariant(QString, ""))(":artist", QVariant(QString, "Aes Dana"))(":beginning", QVariant(qlonglong, 0))(":bitrate", QVariant(int, 192))(":bpm", QVariant(float, -1))(":comment", QVariant(QString, ""))(":compilation", QVariant(int, 0))(":composer", QVariant(QString, ""))(":ctime", QVariant(Invalid))(":cue_path", QVariant(QString, ""))(":directory", QVariant(int, 2))(":disc", QVariant(int, -1))(":effective_albumartist", QVariant(QString, "Aes Dana"))(":effective_compilation", QVariant(int, 0))(":effective_originalyear", QVariant(int, -1))(":etag", QVariant(QString, ""))(":filename", QVariant(QByteArray, "file:///redacted.mp3"))(":filesize", QVariant(int, 8038701))(":filetype", QVariant(int, 5))(":forced_compilation_off", QVariant(int, 0))(":forced_compilation_on", QVariant(int, 0))(":genre", QVariant(QString, "Ambient"))(":grouping", QVariant(QString, ""))(":lastplayed", QVariant(int, -1))(":length", QVariant(qlonglong, 334000000000))(":lyrics", QVariant(QString, ""))(":mtime", QVariant(int, 1045664928))(":originalyear", QVariant(int, -1))(":performer", QVariant(QString, ""))(":playcount", QVariant(int, 0))(":rating", QVariant(float, -1))(":sampler", QVariant(int, 0))(":samplerate", QVariant(int, 44100))(":score", QVariant(int, 0))(":skipcount", QVariant(int, 0))(":title", QVariant(QString, "Forest fishes"))(":track", QVariant(int, 9))(":unavailable", QVariant(int, 0))(":year", QVariant(int, 2003)))

You can see this in the output above: ":ctime", QVariant(Invalid))

wat? what is Clementine trying to do here?

uqs commented 4 years ago

This might be issue #4454 but I need to check. Certainly ctime is NOT the creation time.