|
From: Árpád G. <arp...@gm...> - 2011-07-31 17:27:40
|
Hello again,
So I've figured out what's missing: libgpod is only able to add music to the
iPhone's iPod Library if it's compiled with libimobiledevice support.
Obiviously, it's impossible to port libimobiledevice and libusb to iPhone,
so I'm looking for some explanation on how could I get it to work. Which is
the essential part of libimobiledevice which causes the iPod.app to properly
read and reload the library? I'd like to implement this by hand in my iPhone
app.
Regards, Árpád
2011/7/30 Árpád Goretity <arp...@gm...>
> Dear gtkpod developers,
>
> I'm writing an iPhone application which tries to implement the following
> functionality: as there's no official way among Apple's frameworks to add
> songs/videos to the iPod library, I'm trying to implement this using
> libgpod. I've already compiled libgpod for iPhone (along with libplist, but
> obiviously without libusb and libimobiledevice) and now I'm trying to use
> it. However, when I add a track to the library using my - at the moment,
> command line - application, all previously added tracks are gone from the
> library, but only 'partially': the iPod app on the device can't see them,
> but Gtkpod does. When I sync my iPhone with Gtkpod, everything goes well and
> I can properly add tracks to my iPhone's library using Gtkpod (one single
> warning is generated during mounting my iPhone: 'Extended info will not be
> used'). Thus I'm assuming that I'm doing something wrong. I've tried to
> extract a working example from gtkpod's source (the latest stable release
> was which I downloaded), but I got confused... I kindly ask you whether you
> could provide me a very simple, very basic but tutorial-like introduction to
> the use of libgpod (the API reference didn't help much). FYI, I'm using
> Ubuntu 11.04 on my PC and I have an (obiviously jailbroken) iPhone 3G with
> the 4.2.1 firmware.
>
> The code which I've written so far:
>
> #include <libgpod/itdb.h>
> #include <stdio.h>
>
> int main () {
>
> Itdb_iTunesDB *db = itdb_parse ("/var/mobile/Media", NULL);
> // printf ("Db: %p\n", db);
>
> Itdb_Track *track = itdb_track_new ();
> track->transferred = 0;
> track->year = 2011;
> track->title = "Test2";
> track->artist = "H2CO3";
> track->album = "Carbon8";
> track->genre = "Punk";
> track->filetype = g_strdup ("MP3-file");
>
> itdb_track_add (db, track, -1);
>
> Itdb_Playlist *mpl = itdb_playlist_new ("New iPod", 0);
> itdb_playlist_set_mpl (mpl);
> Itdb_Playlist *podcasts = itdb_playlist_new ("Podcasts", 0);
> itdb_playlist_set_podcasts (podcasts);
>
> itdb_playlist_add (db, mpl, -1);
> itdb_playlist_add (db, podcasts, -1);
>
> itdb_playlist_add_track (mpl, track, -1);
> itdb_playlist_add_track (podcasts, track, -1);
>
> GError *err;
>
> gboolean ret = itdb_cp_track_to_ipod (track,
> "/var/mobile/song.mp3", &err);
> if (!ret) {
> printf ("Error: %s\n", err->message);
> }
> itdb_write (db, NULL);
>
> return 0;
>
> }
>
> What have I done wrong?
>
> Thanks in advance,
>
> Árpád Goretity
>
>
|