예제 #1
0
static int do_dump (int argc, char **argv)
{
    GError *error = NULL;
    Itdb_PhotoDB *db;

    if (argc != 4)
    {
	g_print (_("Wrong number of command line arguments.\n"));
	usage (argc, argv);
	return 1;
    }

    if (!g_file_test (argv[3], G_FILE_TEST_EXISTS))
    {
	if (mkdir (argv[3], 0777) == -1)
	{
	    g_print (_("Error creating '%s' (mkdir)\n"), argv[3]);
	    return 1;
	}
    }
    if (!g_file_test (argv[3], G_FILE_TEST_IS_DIR))
    {
	g_print (_("Error: '%s' is not a directory\n"), argv[3]);
	return 1;
    }

    db = itdb_photodb_parse (argv[2], &error);
    if (db == NULL)
    {
	if (error)
	{
	    g_print (_("Error reading iPod photo database (%s).\n"), error->message);
	    g_error_free (error);
	    error = NULL;
	}
	else
	{
	    g_print (_("Error reading iPod photo database.\n"));
	}
	return 1;
    }
    dump_albums (db, argv[3]);
    itdb_photodb_free (db);
    return 0;
}
예제 #2
0
//#define XIAMI_GET_MY_LIB
//#define XIAMI_COLLECT_TEST
static void  get_my_fav(DataManager *manager)
{
    int userid = 0;
    std::string nickname;
    std::string msg ;
    DataManager::MusicLib lib;    
    unsigned int cnt = 0;
    SongInfo *pMysongs;
    AlbumInfo *pAlbum;

 #ifdef NEED_LOGIN   
    if (manager->Login(XIAMI_USER_ID, XIAMI_PWD))
    {
#ifdef XIAMI_GET_MY_LIB 
        printf("===========GetMusicLibInfo =============\n");    
        manager->GetMusicLibInfo(lib);            
        printf("lib info: songs=%d, albums=%d artist=%d\n", lib.songNum, lib.albumNum, lib.artistNum);
#endif

#ifdef XIAMI_GET_MY_SONGS
        printf("===========get_my_songs =============\n");
        pMysongs = manager->get_my_songs(1, cnt);
        dump_songs(cnt,  pMysongs);
#endif

#ifdef XIAMI_GET_MY_ALBUMS
        printf("===========get_my_albums =============\n");        
        pAlbum=manager->get_my_albums(0, cnt);
        if(!pAlbum){
            printf("get my album failed\n");
            return;
        }        
        dump_albums(cnt, pAlbum);

        printf("===========get_my_collects =============\n");
        pAlbum = manager->get_my_collects(0, cnt);
        printf("*** get my col cnt=%d::\n", cnt);        
        dump_albums(cnt, pAlbum);

        printf("===========get_my_fav_collects =============\n");
        pAlbum = manager->get_my_fav_collects(0, cnt);
        dump_albums(cnt, pAlbum);

        printf("===========get_my_artists =============\n");
        pAlbum=manager->get_my_artists(0, cnt);
        printf("*** get my artist::\n");        
        dump_albums(cnt, pAlbum);

        printf("===========get_artist_albums =============\n");
        unsigned int artist_id =0;
        artist_id = pAlbum->id;
        printf("*** get my artist id=%d::\n", artist_id);
        unsigned int total=0;
        pAlbum=manager->get_artist_albums(artist_id, 1, cnt, total);
        printf("*** get my artist's albums::cnt=%d, total=%d\n", cnt, total);
        dump_albums(cnt, pAlbum);

        printf("===========get_albums_songs =============\n");
        unsigned int albums_id = 32418;
        albums_id = pAlbum->id;
        printf("*** get   albums_id id=%d::\n", albums_id);        
        pMysongs = manager->get_albums_songs(albums_id, 1, cnt);
        printf("*** get my artist's albums songs::cnt=%d\n", cnt);
        dump_songs(cnt,  pMysongs);
#endif                
    }
#endif // endif NEED_LOGIN    
#ifdef XIAMI_SEARCH_TEST
    printf("===========search_songs =============\n");
    const char key[] ="zxy";
    pMysongs = manager->search_songs(key, (unsigned int)1, cnt);
    
    printf("*** get my artist's albums songs::cnt=%d\n", cnt);
    dump_songs(cnt,  pMysongs);
#endif

#ifdef XIAMI_COLLECT_TEST
        printf("===========collect my songs to xiami.com =============\n");
        unsigned int song_id = 74393; // xueyou's one tear
        int type = COLLECT_TYPE_SONG;
        manager->collect_to_my_xiami(song_id,  type, true);
        
        printf("===========collect artist  =============\n");
        type = COLLECT_TYPE_ARTIST;
        song_id = 78523;
        manager->collect_to_my_xiami(song_id,  type, false);
#endif  // XIAMI_COLLECT_TEST    
        printf("===========isMyFavSong =============\n");
        bool status=false;
        status=manager->isMyFavSong(1);
        if(status)
            printf("*** In my fav list\n");
        else
            printf("*** Not found in my fav list\n");
        
}