Main Page | Class List | File List | Class Members | File Members

tp_c.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------- 00002 00003 libtunepimp -- The MusicBrainz tagging library. 00004 Let a thousand taggers bloom! 00005 00006 Copyright (C) Robert Kaye 2003 00007 00008 This file is part of libtunepimp. 00009 00010 libtunepimp is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU General Public License as published by 00012 the Free Software Foundation; either version 2 of the License, or 00013 (at your option) any later version. 00014 00015 libtunepimp is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with libtunepimp; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 00024 $Id: tp_c.h,v 1.31 2004/03/26 23:14:49 robert Exp $ 00025 00026 ----------------------------------------------------------------------------*/ 00027 #ifndef _TP_C_H_ 00028 #define _TP_C_H_ 00029 00030 #ifdef __cplusplus 00031 extern "C" 00032 { 00033 #endif 00034 00035 #include "defs.h" 00036 00042 typedef void *tunepimp_t; 00043 00044 00049 typedef void *track_t; 00050 00051 00059 typedef void *result_t; 00060 00061 00074 typedef void (*tp_notify_callback)(tunepimp_t pimp, void *data, TPCallbackEnum 00075 type, int fileId); 00076 00077 00089 typedef void (*tp_status_callback)(tunepimp_t pimp, void *data, const char *status); 00090 00091 00114 typedef struct _metadata_t 00115 { 00116 char *artist; 00117 char *sortName; 00118 char *album; 00119 char *track; 00120 int trackNum; 00121 int variousArtist; 00122 char *artistId; 00123 char *albumId; 00124 char *trackId; 00125 char *fileTrm; 00126 char *albumArtistId; 00127 unsigned long duration; 00128 TPAlbumType albumType; 00129 TPAlbumStatus albumStatus; 00130 char *fileFormat; 00131 int releaseYear, releaseDay, releaseMonth; 00132 char releaseCountry[3]; 00133 00134 // This is only used in case of TRM collision 00135 int numTRMIds; 00136 } metadata_t; 00137 00138 00145 typedef struct _artistresult_t 00146 { 00147 int relevance; 00148 char *name, *sortName; 00149 char *id; 00150 } artistresult_t; 00151 00152 00159 typedef struct _albumresult_t 00160 { 00161 int relevance; 00162 char *name; 00163 char *id; 00164 int numTracks, numCDIndexIds; 00165 int isVA; 00166 TPAlbumStatus status; 00167 TPAlbumType type; 00168 int releaseYear, releaseDay, releaseMonth; 00169 char releaseCountry[3]; 00170 artistresult_t *artist; 00171 } albumresult_t; 00172 00173 00181 typedef struct _albumtrackresult_t 00182 { 00183 int relevance; 00184 char *name; 00185 char *id; 00186 int numTRMIds, trackNum; 00187 unsigned long duration; 00188 artistresult_t *artist; 00189 albumresult_t *album; 00190 } albumtrackresult_t; 00191 00192 00193 /* -------------------------------------------------------------------------- 00194 * Main TunePimp Interface 00195 * --------------------------------------------------------------------------*/ 00196 00207 tunepimp_t tp_New (const char *appName, const char *appVersion); 00208 00222 tunepimp_t tp_NewWithArgs (const char *appName, const char *appVersion, int startThreads); 00223 00231 void tp_Delete (tunepimp_t o); 00232 00233 00242 void tp_GetVersion (tunepimp_t o, int *major, int *minor, int *rev); 00243 00244 00257 void tp_SetUserInfo (tunepimp_t o, const char *userName, 00258 const char *password); 00259 00260 00274 void tp_GetUserInfo (tunepimp_t o, char *userName, int maxUserNameLen, 00275 char *password, int maxPasswordLen); 00276 00277 00288 void tp_SetUseUTF8 (tunepimp_t o, int useUTF8); 00289 00290 00301 int tp_GetUseUTF8(tunepimp_t o); 00302 00303 00316 void tp_SetServer (tunepimp_t o, const char *serverAddr, 00317 short serverPort); 00318 00319 00334 void tp_GetServer(tunepimp_t o, char *serverAddr, int maxLen, 00335 short *serverPort); 00336 00337 00351 void tp_SetProxy (tunepimp_t o, const char *serverAddr, short serverPort); 00352 00353 00368 void tp_GetProxy(tunepimp_t o, char *serverAddr, int maxLen, short *serverPort); 00369 00370 00380 int tp_GetNumSupportedExtensions(tunepimp_t o); 00381 00382 00397 #define TP_EXTENSION_LEN 32 00398 void tp_GetSupportedExtensions(tunepimp_t o, char extensions[][TP_EXTENSION_LEN]); 00399 00409 void tp_SetAnalyzerPriority(tunepimp_t o, TPThreadPriorityEnum priority); 00410 00420 TPThreadPriorityEnum tp_GetAnalyzerPriority(tunepimp_t o); 00421 00443 void tp_SetAutoFileLookup(tunepimp_t o, int enable); 00444 00445 00456 int tp_GetAutoFileLookup(tunepimp_t o); 00457 00458 00476 void tp_SetNotifyCallback(tunepimp_t o, tp_notify_callback callback, void *data); 00477 00478 00489 tp_notify_callback tp_GetNotifyCallback(tunepimp_t o); 00490 00491 00509 int tp_GetNotification(tunepimp_t o, TPCallbackEnum *type, int *fileId); 00510 00511 00529 void tp_SetStatusCallback(tunepimp_t o, tp_status_callback callback, void *data); 00530 00531 00548 int tp_GetStatus(tunepimp_t o, char *status, int statusLen); 00549 00550 00561 tp_status_callback tp_GetStatusCallback(tunepimp_t o); 00562 00563 00574 void tp_GetError(tunepimp_t o, char *error, int maxLen); 00575 00576 00590 void tp_SetDebug (tunepimp_t o, int debug); 00591 00592 00602 int tp_GetDebug(tunepimp_t o); 00603 00604 00626 int tp_AddFile (tunepimp_t o, const char *fileName); 00627 00628 00642 int tp_AddDir (tunepimp_t o, const char *dirPath); 00643 00644 00654 void tp_Remove (tunepimp_t o, int fileId); 00655 00656 00665 int tp_GetNumFiles (tunepimp_t o); 00666 00667 00677 int tp_GetNumUnsubmitted (tunepimp_t o); 00678 00679 00687 int tp_GetNumUnsavedItems (tunepimp_t o); 00688 00699 int tp_GetTrackCounts(tunepimp_t o, int *counts, int maxCounts); 00700 00712 int tp_GetNumFileIds (tunepimp_t o); 00713 00714 00728 void tp_GetFileIds (tunepimp_t o, int *ids, int numIds); 00729 00730 00743 track_t tp_GetTrack (tunepimp_t o, int fileId); 00744 00745 00754 void tp_ReleaseTrack (tunepimp_t o, track_t track); 00755 00756 00771 void tp_Wake (tunepimp_t o, track_t track); 00772 00773 00787 TPError tp_SelectResult (tunepimp_t o, track_t track, int resultIndex); 00788 00789 00800 void tp_Misidentified (tunepimp_t o, int fileId); 00801 00814 void tp_IdentifyAgain (tunepimp_t o, int fileId); 00815 00853 int tp_WriteTags (tunepimp_t o, int *fileIds, int numFileIds); 00854 00855 00866 void tp_AddTRMSubmission(tunepimp_t o, const char *trackId, const char *trmId); 00867 00868 00881 TPError tp_SubmitTRMs (tunepimp_t o); 00882 00883 00897 void tp_SetRenameFiles (tunepimp_t o, int rename); 00898 00899 00910 int tp_GetRenameFiles(tunepimp_t o); 00911 00912 00926 void tp_SetMoveFiles (tunepimp_t o, int move); 00927 00928 00938 int tp_GetMoveFiles(tunepimp_t o); 00939 00940 00952 void tp_SetWriteID3v1 (tunepimp_t o, int writeID3v1); 00953 00954 00964 int tp_GetWriteID3v1(tunepimp_t o); 00965 00966 00980 void tp_SetClearTags (tunepimp_t o, int clearTags); 00981 00982 00993 int tp_GetClearTags(tunepimp_t o); 00994 00995 01032 void tp_SetFileMask (tunepimp_t o, const char *fileMask); 01033 01034 01047 void tp_GetFileMask (tunepimp_t o, char *fileMask, int maxLen); 01048 01049 01065 void tp_SetVariousFileMask (tunepimp_t o, const char *variousFileMask); 01066 01067 01080 void tp_GetVariousFileMask (tunepimp_t o, char *variousFileMask, int maxLen); 01081 01082 01100 void tp_SetAllowedFileCharacters(tunepimp_t o, const char *allowedFileCharacters); 01101 01102 01117 void tp_GetAllowedFileCharacters(tunepimp_t o, char *allowedFileCharacters, int maxLen); 01118 01119 01134 void tp_SetDestDir (tunepimp_t o, const char *destDir); 01135 01136 01150 void tp_GetDestDir(tunepimp_t o, char *destDir, int maxLen); 01151 01152 01178 void tp_SetTopSrcDir (tunepimp_t o, const char *topSrcDir); 01179 01180 01195 void tp_GetTopSrcDir(tunepimp_t o, char *topSrcDir, int maxLen); 01196 01197 01222 void tp_SetTRMCollisionThreshold(tunepimp_t o, int trmThreshold); 01223 01224 01235 int tp_GetTRMCollisionThreshold(tunepimp_t o); 01236 01254 void tp_SetMinTRMThreshold(tunepimp_t o, int minThreshold); 01255 01256 01267 int tp_GetMinTRMThreshold(tunepimp_t o); 01268 01290 void tp_SetAutoSaveThreshold (tunepimp_t o, int autoSaveThreshold); 01291 01292 01304 int tp_GetAutoSaveThreshold(tunepimp_t o); 01305 01314 void tp_SetMaxFileNameLen(tunepimp_t o, int maxFileNameLen); 01315 01316 01325 int tp_GetMaxFileNameLen(tunepimp_t o); 01326 01337 void tp_SetAutoRemovedSavedFiles(tunepimp_t o, int autoRemoveSavedFiles); 01338 01339 01350 int tp_GetAutoRemovedSavedFiles(tunepimp_t o); 01351 01352 01371 int tp_GetRecognizedFileList(tunepimp_t o, int threshold, int **fileIds, int *numIds); 01372 01373 01383 void tp_DeleteRecognizedFileList(tunepimp_t o, int *fileIds); 01384 01385 01386 #ifdef WIN32 01387 01399 void tp_WSAInit (tunepimp_t o); 01400 01401 01410 void tp_WSAStop (tunepimp_t o); 01411 #endif 01412 01413 01414 /* -------------------------------------------------------------------------- 01415 * Track Interface 01416 * --------------------------------------------------------------------------*/ 01417 01429 TPFileStatus tr_GetStatus (track_t t); 01430 01431 01443 void tr_SetStatus (track_t t, const TPFileStatus status); 01444 01445 01455 void tr_GetFileName (track_t t, char *fileName, int maxLen); 01456 01457 01469 void tr_GetTRM (track_t t, char *trm, int maxLen); 01470 01471 01484 void tr_GetLocalMetadata (track_t t, metadata_t *mdata); 01485 01486 01500 void tr_SetLocalMetadata (track_t t, const metadata_t *mdata); 01501 01502 01516 void tr_GetServerMetadata(track_t t, metadata_t *mdata); 01517 01518 01531 void tr_SetServerMetadata(track_t t, const metadata_t *mdata); 01532 01533 01548 void tr_GetError (track_t t, char *error, int maxLen); 01549 01550 01562 int tr_GetSimilarity (track_t t); 01563 01564 01573 int tr_HasChanged (track_t t); 01574 01575 01586 int tr_GetNumResults (track_t t); 01587 01588 01608 void tr_GetResults (track_t t, TPResultType *type, 01609 result_t *results, int *numResults); 01610 01611 01622 void tr_Lock (track_t t); 01623 01624 01633 void tr_Unlock (track_t t); 01634 01635 01636 /* -------------------------------------------------------------------------- 01637 * Metadata Interface 01638 * --------------------------------------------------------------------------*/ 01639 01640 01651 metadata_t *md_New (void); 01652 01653 01661 void md_Delete (metadata_t *mdata); 01662 01663 01674 void md_Clear (metadata_t *mdata); 01675 01676 01686 TPAlbumStatus md_ConvertToAlbumStatus (const char *albumStatus); 01687 01688 01699 TPAlbumType md_ConvertToAlbumType (const char *albumType); 01700 01701 01714 void md_ConvertFromAlbumStatus(TPAlbumStatus status, char *albumStatus, int maxLen); 01715 01716 01729 void md_ConvertFromAlbumType (TPAlbumType type, char *albumType, int maxLen); 01730 01731 01732 01733 /* -------------------------------------------------------------------------- 01734 * Result Interface 01735 * --------------------------------------------------------------------------*/ 01736 01746 void rs_Delete(TPResultType type, result_t *result, int numResults); 01747 01748 #ifdef __cplusplus 01749 } 01750 #endif 01751 01752 #endif

Generated on Sat Aug 7 20:09:00 2004 for MusicBrainz Tunepimp Library by doxygen 1.3.8