The following code, which I think is a minimal program to load music
db = Database('/media/andrew@acooke.org ipod')
itdb_device_set_sysinfo(db._itdb.device, "ModelNumStr", "C297")
db.import_file('/home/andrew/some-track.mp3')
db.copy_delayed_files()
db.close()
prints the following to stderr:
** (utrunner.py:11333): WARNING **: Itdb_Track ID '0' not found.
** (utrunner.py:11333): CRITICAL **: itdb_get_mountpoint: assertion `itdb' failed
** (utrunner.py:11333): CRITICAL **: prepare_itdb_for_write: assertion `link' failed
** (utrunner.py:11333): CRITICAL **: mk_mhla: assertion `fexp->albums' failed
** (utrunner.py:11333): CRITICAL **: mk_mhli: assertion `fexp->artists' failed
** (utrunner.py:11333): CRITICAL **: itdb_splr_validate: assertion `at != ITDB_SPLAT_UNKNOWN' failed
and does not load any music.
When I run gtkpod (which uses libgpod - they are both from the same project), it does work (and prints only the initial warning and the ITDB_SPLAT_UNKNOWN
message). The paths are all correct and I can open directories, write to files, etc. The database object appears to be correct (shows 2 playlists, for example) and the SysInfoExtended file is present.
What am I doing wrong? Has anyone got this (the libgpod Python wrapper) to work?
One possible clue is that gtkpod prompts me for the iPod type (Classic 160GB). I do not set that information above. How can I set that? update - I did try the call shown above and mentioned in an answer below, but it seemed to have no effect (I didn't include it originally because I thought it must have been wrong, but perhaps it is needed and the problem is elsewhere). Also, gtkpod calls it "xB150"?!
I have asked the libgpod/gtkpod mailing list, but received no response. This is with both the latest stable release and the git trunk (compiled with CFLAGS=-w).
update I deleted all music, then ran the code above with both C297 and xB150. in neither case did the file Extras.itdb (which looks like an sqlite db) change size and the disconnected iPod has no songs. related files are at the following links:
- SysInfo (empty file)
- SysInfoExtended
- Extras.itdb (sqlite db?)
General notes on this issue, which will be updated in future, here.