From: <ny...@us...> - 2007-01-24 10:26:46
|
Revision: 273 http://svn.sourceforge.net/pmplib/?rev=273&view=rev Author: nyaochi Date: 2007-01-24 02:26:45 -0800 (Wed, 24 Jan 2007) Log Message: ----------- Removed the generation routine for *.plp files from pmp_iriverplus3 since it's unnecessary. Modified Paths: -------------- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c trunk/pmplib/lib/pmp_iriverplus3/ip3db.h trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj Removed Paths: ------------- trunk/pmplib/lib/pmp_iriverplus3/plp.c Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-01-18 19:44:24 UTC (rev 272) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.c 2007-01-24 10:26:45 UTC (rev 273) @@ -278,22 +278,3 @@ dst->entries[i] = ucs2dup(src->entries[i]); } } - -int ip3db_write_playlists(ip3db_t* db, const ip3db_playlist_t* playlists, int num_playlists, const ucs2char_t *path_to_root) -{ - int i; - - for (i = 0;i < num_playlists;++i) { - ucs2char_t filename[MAX_PATH]; - const ip3db_playlist_t* pl = &playlists[i]; - - ucs2cpy(filename, path_to_root); - ucs2cat(filename, pl->filepath + 1); - ucs2cat(filename, pl->filename); - filepath_backslash(filename); - - plp_write(db, filename, pl->entries, pl->num_entries, path_to_root); - } - - return 0; -} Modified: trunk/pmplib/lib/pmp_iriverplus3/ip3db.h =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2007-01-18 19:44:24 UTC (rev 272) +++ trunk/pmplib/lib/pmp_iriverplus3/ip3db.h 2007-01-24 10:26:45 UTC (rev 273) @@ -211,8 +211,6 @@ ip3db_music_record_t* ip3db_get_record(ip3db_t* db, int i); result_t ip3db_dump(ip3db_t* db, FILE *fpo); -int ip3db_write_playlists(ip3db_t* db, const ip3db_playlist_t* playlists, int num_playlists, const ucs2char_t *path_to_root); - void ip3db_record_init(ip3db_t* db, ip3db_music_record_t* record); void ip3db_record_finish(ip3db_t* db, ip3db_music_record_t* record); Deleted: trunk/pmplib/lib/pmp_iriverplus3/plp.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/plp.c 2007-01-18 19:44:24 UTC (rev 272) +++ trunk/pmplib/lib/pmp_iriverplus3/plp.c 2007-01-24 10:26:45 UTC (rev 273) @@ -1,120 +0,0 @@ -/* - * Playlist reader/writer for iriver E10. - * - * Copyright (c) 2005-2006 Nyaochi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/* $Id$ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif/*HAVE_CONFIG_H*/ - -#include <os.h> -#include <stdio.h> -#include <stdlib.h> -#include <ucs2char.h> -#include <filepath.h> - -#include "serialize.h" -#include "util.h" -#include "ip3db.h" -#include "dat.h" - -static uint32_t findfile(ip3db_t* db, const ucs2char_t *filename, const ucs2char_t *path_to_root) -{ - int i; - const ucs2char_t *filepart = filepath_skippath(filename); - const ucs2char_t *pathfile = filepath_skipdrive(filename, path_to_root); - ucs2char_t *pathname = alloca(sizeof(ucs2char_t) * (ucs2len(pathfile) + 1)); - - ucs2cpy(pathname, pathfile); - filepath_remove_filespec(pathname); - filepath_addslash(pathname); - filepath_slash(pathname); - - for (i = 0;i < db->dat->musics.num_entries;++i) { - dat_entry_t* entry = &db->dat->musics.entries[i]; - if (ucs2icmp(entry->fields[IP3DBF_MUSIC_FILENAME].value.str, filepart) == 0 && - ucs2icmp(entry->fields[IP3DBF_MUSIC_FILEPATH].value.str, pathname) == 0) { - return entry->fields[IP3DBF_MUSIC_UID].value.dword; - } - } - return 0; -} - -int plp_write( - ip3db_t* db, - const ucs2char_t *filename, - ucs2char_t* const mediafiles[], - int num_mediafiles, - const ucs2char_t *path_to_root - ) -{ - int i; - FILE *fp = NULL; - uint32_t* uids = NULL; - uint32_t num_uids = 0; - - for (i = 0;i < num_mediafiles;i++) { - if (mediafiles[i][0]) { - uint32_t uid = 0; - ucs2char_t mediafile[MAX_PATH]; - ucs2cpy(mediafile, mediafiles[i]); - - uid = findfile(db, mediafile, path_to_root); - if (uid <= 0) { - goto error_exit; - } - - uids = realloc(uids, sizeof(uint32_t) * (num_uids+1)); - if (!uids) { - goto error_exit; - } - uids[num_uids++] = uid; - } - } - - fp = ucs2fopen(filename, "wb"); - if (fp) { - size_t size = sizeof(uint32_t) + sizeof(uint32_t) * num_uids; - uint8_t* buffer = (uint8_t*)malloc(size); - uint8_t* p = buffer; - - if (!buffer) { - goto error_exit; - } - - p += serialize_uint32le(p, &num_uids, 1); - for (i = 0;i < (int)num_uids;++i) { - p += serialize_uint32le(p, &uids[i], 1); - } - fwrite(buffer, 1, size, fp); - free(buffer); - fclose(fp); - } else { - return -1; - } - - free(uids); - return 0; - -error_exit: - free(uids); - return -1; -} Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-18 19:44:24 UTC (rev 272) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.c 2007-01-24 10:26:45 UTC (rev 273) @@ -432,9 +432,6 @@ ip3db_set(&pmpmi->ip3db, pmpmi->records, pmpmi->num_records, NULL, 0); } - // Write out the playlist first. - ip3db_write_playlists(&pmpmi->ip3db, pmpmi->playlists, pmpmi->num_playlists, pmp->info.path_to_root); - // Write out the music database. set_filenames(dat, dic, idx, pmp); ret = ip3db_write(&pmpmi->ip3db, dat, dic, idx); Modified: trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj =================================================================== --- trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2007-01-18 19:44:24 UTC (rev 272) +++ trunk/pmplib/lib/pmp_iriverplus3/pmp_iriverplus3.vcproj 2007-01-24 10:26:45 UTC (rev 273) @@ -193,10 +193,6 @@ > </File> <File - RelativePath=".\plp.c" - > - </File> - <File RelativePath=".\pmp_iriverplus3.c" > </File> @@ -231,10 +227,6 @@ > </File> <File - RelativePath=".\plp.h" - > - </File> - <File RelativePath=".\serialize.h" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |