MusicBrainz Tunepimp Library 0.5.3
|
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 8360 2006-08-07 21:05:12Z luks $ 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 00064 typedef void (*tp_notify_callback)(tunepimp_t pimp, void *data, TPCallbackEnum 00065 type, int fileId, TPFileStatus status); 00066 00067 00079 typedef void (*tp_status_callback)(tunepimp_t pimp, void *data, const char *status); 00080 00081 00105 #define TP_ARTIST_NAME_LEN 255 00106 #define TP_ALBUM_NAME_LEN 255 00107 #define TP_TRACK_NAME_LEN 255 00108 #define TP_ID_LEN 40 00109 #define TP_FORMAT_LEN 32 00110 #define TP_COUNTRY_LEN 3 00111 typedef struct _metadata_t 00112 { 00113 char artist[TP_ARTIST_NAME_LEN]; 00114 char sortName[TP_ARTIST_NAME_LEN]; 00115 char album[TP_ALBUM_NAME_LEN]; 00116 char track[TP_TRACK_NAME_LEN]; 00117 int trackNum; 00118 int totalInSet; 00119 int variousArtist; 00120 int nonAlbum; 00121 char artistId[TP_ID_LEN]; 00122 char albumId[TP_ID_LEN]; 00123 char trackId[TP_ID_LEN]; 00124 char filePUID[TP_ID_LEN]; 00125 char albumArtistId[TP_ID_LEN]; 00126 unsigned long duration; 00127 TPAlbumType albumType; 00128 TPAlbumStatus albumStatus; 00129 char fileFormat[TP_FORMAT_LEN]; 00130 int releaseYear, releaseDay, releaseMonth; 00131 char releaseCountry[TP_COUNTRY_LEN]; 00132 00133 // This is only used in case of PUID collision 00134 int numPUIDIds; 00135 00136 char albumArtist[TP_ARTIST_NAME_LEN]; 00137 char albumArtistSortName[TP_ARTIST_NAME_LEN]; 00138 } metadata_t; 00139 00140 00141 /* -------------------------------------------------------------------------- 00142 * Main TunePimp Interface 00143 * --------------------------------------------------------------------------*/ 00144 00155 tunepimp_t tp_New (const char *appName, const char *appVersion); 00156 00171 tunepimp_t tp_NewWithArgs (const char *appName, const char *appVersion, 00172 int startThreads, const char *pluginDir); 00173 00181 void tp_Delete (tunepimp_t o); 00182 00183 00192 void tp_GetVersion (tunepimp_t o, int *major, int *minor, int *rev); 00193 00194 00202 void tp_SetMusicDNSClientId(tunepimp_t o, const char *clientId); 00203 00204 00214 void tp_GetMusicDNSClientId(tunepimp_t o, char *clientId, int maxClientIdLen); 00215 00230 void tp_SetFileNameEncoding(tunepimp_t o, const char *encoding); 00231 00232 00242 void tp_GetFileNameEncoding(tunepimp_t o, char *encoding, int maxEncodingLen); 00243 00244 00257 void tp_SetServer (tunepimp_t o, const char *serverAddr, 00258 short serverPort); 00259 00260 00275 void tp_GetServer(tunepimp_t o, char *serverAddr, int maxLen, 00276 short *serverPort); 00277 00278 00292 void tp_SetProxy (tunepimp_t o, const char *serverAddr, short serverPort); 00293 00294 00309 void tp_GetProxy(tunepimp_t o, char *serverAddr, int maxLen, short *serverPort); 00310 00311 00321 int tp_GetNumSupportedExtensions(tunepimp_t o); 00322 00323 00338 #define TP_EXTENSION_LEN 32 00339 void tp_GetSupportedExtensions(tunepimp_t o, char extensions[][TP_EXTENSION_LEN]); 00340 00350 void tp_SetAnalyzerPriority(tunepimp_t o, TPThreadPriorityEnum priority); 00351 00361 TPThreadPriorityEnum tp_GetAnalyzerPriority(tunepimp_t o); 00362 00363 00381 void tp_SetNotifyCallback(tunepimp_t o, tp_notify_callback callback, void *data); 00382 00383 00394 tp_notify_callback tp_GetNotifyCallback(tunepimp_t o); 00395 00396 00415 int tp_GetNotification(tunepimp_t o, TPCallbackEnum *type, int *fileId, TPFileStatus *status); 00416 00417 00435 void tp_SetStatusCallback(tunepimp_t o, tp_status_callback callback, void *data); 00436 00437 00454 int tp_GetStatus(tunepimp_t o, char *status, int statusLen); 00455 00456 00467 tp_status_callback tp_GetStatusCallback(tunepimp_t o); 00468 00469 00480 void tp_GetError(tunepimp_t o, char *error, int maxLen); 00481 00482 00496 void tp_SetDebug (tunepimp_t o, int debug); 00497 00498 00508 int tp_GetDebug(tunepimp_t o); 00509 00510 00533 int tp_AddFile (tunepimp_t o, const char *fileName, int readMetadataNow); 00534 00535 00549 int tp_AddDir (tunepimp_t o, const char *dirPath); 00550 00551 00561 void tp_Remove (tunepimp_t o, int fileId); 00562 00563 00572 int tp_GetNumFiles (tunepimp_t o); 00573 00574 00582 int tp_GetNumUnsavedItems (tunepimp_t o); 00583 00594 int tp_GetTrackCounts(tunepimp_t o, int *counts, int maxCounts); 00595 00607 int tp_GetNumFileIds (tunepimp_t o); 00608 00609 00623 void tp_GetFileIds (tunepimp_t o, int *ids, int numIds); 00624 00625 00638 track_t tp_GetTrack (tunepimp_t o, int fileId); 00639 00640 00649 void tp_ReleaseTrack (tunepimp_t o, track_t track); 00650 00651 00666 void tp_Wake (tunepimp_t o, track_t track); 00667 00668 00679 void tp_Misidentified (tunepimp_t o, int fileId); 00680 00689 void tp_IdentifyAgain (tunepimp_t o, int fileId); 00690 00729 int tp_WriteTags (tunepimp_t o, int *fileIds, int numFileIds); 00730 00731 00746 void tp_SetRenameFiles (tunepimp_t o, int rename); 00747 00748 00759 int tp_GetRenameFiles(tunepimp_t o); 00760 00761 00776 void tp_SetMoveFiles (tunepimp_t o, int move); 00777 00778 00788 int tp_GetMoveFiles(tunepimp_t o); 00789 00790 00802 void tp_SetWriteID3v1 (tunepimp_t o, int writeID3v1); 00803 00804 00814 int tp_GetWriteID3v1(tunepimp_t o); 00815 00816 00828 void tp_SetWriteID3v2_3 (tunepimp_t o, int writeID3v2_3); 00829 00830 00840 int tp_GetWriteID3v2_3(tunepimp_t o); 00841 00852 void tp_SetID3Encoding (tunepimp_t o, TPID3Encoding encoding); 00853 00854 00864 TPID3Encoding tp_GetID3Encoding(tunepimp_t o); 00865 00879 void tp_SetClearTags (tunepimp_t o, int clearTags); 00880 00881 00892 int tp_GetClearTags(tunepimp_t o); 00893 00894 00932 void tp_SetFileMask (tunepimp_t o, const char *fileMask); 00933 00934 00947 void tp_GetFileMask (tunepimp_t o, char *fileMask, int maxLen); 00948 00949 00965 void tp_SetVariousFileMask (tunepimp_t o, const char *variousFileMask); 00966 00967 00980 void tp_GetVariousFileMask (tunepimp_t o, char *variousFileMask, int maxLen); 00981 00982 00999 void tp_SetNonAlbumFileMask (tunepimp_t o, const char *nonAlbumFileMask); 01000 01001 01014 void tp_GetNonAlbumFileMask (tunepimp_t o, char *nonAlbumFileMask, int maxLen); 01015 01016 01035 void tp_SetAllowedFileCharacters(tunepimp_t o, const char *allowedFileCharacters); 01036 01037 01052 void tp_GetAllowedFileCharacters(tunepimp_t o, char *allowedFileCharacters, int maxLen); 01053 01054 01069 void tp_SetDestDir (tunepimp_t o, const char *destDir); 01070 01071 01085 void tp_GetDestDir(tunepimp_t o, char *destDir, int maxLen); 01086 01087 01113 void tp_SetTopSrcDir (tunepimp_t o, const char *topSrcDir); 01114 01115 01130 void tp_GetTopSrcDir(tunepimp_t o, char *topSrcDir, int maxLen); 01131 01132 01154 void tp_SetAutoSaveThreshold (tunepimp_t o, int autoSaveThreshold); 01155 01156 01168 int tp_GetAutoSaveThreshold(tunepimp_t o); 01169 01178 void tp_SetMaxFileNameLen(tunepimp_t o, int maxFileNameLen); 01179 01180 01189 int tp_GetMaxFileNameLen(tunepimp_t o); 01190 01201 void tp_SetAutoRemovedSavedFiles(tunepimp_t o, int autoRemoveSavedFiles); 01202 01203 01214 int tp_GetAutoRemovedSavedFiles(tunepimp_t o); 01215 01216 01235 int tp_GetRecognizedFileList(tunepimp_t o, int threshold, int **fileIds, int *numIds); 01236 01237 01247 void tp_DeleteRecognizedFileList(tunepimp_t o, int *fileIds); 01248 01249 int tp_GetWinSafeFileNames(tunepimp_t o); 01250 void tp_SetWinSafeFileNames(tunepimp_t o, int winSafeFileNames); 01251 01252 #ifdef WIN32 01253 01265 void tp_WSAInit (tunepimp_t o); 01266 01267 01276 void tp_WSAStop (tunepimp_t o); 01277 #endif 01278 01279 01280 /* -------------------------------------------------------------------------- 01281 * Track Interface 01282 * --------------------------------------------------------------------------*/ 01283 01295 TPFileStatus tr_GetStatus (track_t t); 01296 01297 01309 void tr_SetStatus (track_t t, const TPFileStatus status); 01310 01311 01321 void tr_GetFileName (track_t t, char *fileName, int maxLen); 01322 01323 01335 void tr_GetPUID (track_t t, char *puid, int maxLen); 01336 01337 01350 void tr_GetLocalMetadata (track_t t, metadata_t *mdata); 01351 01352 01365 void tr_SetLocalMetadata (track_t t, const metadata_t *mdata); 01366 01367 01380 void tr_GetServerMetadata(track_t t, metadata_t *mdata); 01381 01382 01392 void tr_SetServerMetadata(track_t t, const metadata_t *mdata); 01393 01394 01409 void tr_GetError (track_t t, char *error, int maxLen); 01410 01411 01423 int tr_GetSimilarity (track_t t); 01424 01425 01434 int tr_HasChanged (track_t t); 01435 01443 void tr_SetChanged (track_t t); 01444 01455 void tr_Lock (track_t t); 01456 01457 01466 void tr_Unlock (track_t t); 01467 01468 01469 /* -------------------------------------------------------------------------- 01470 * Metadata Interface 01471 * --------------------------------------------------------------------------*/ 01472 01473 01484 metadata_t *md_New (void); 01485 01486 01494 void md_Delete (metadata_t *mdata); 01495 01496 01507 void md_Clear (metadata_t *mdata); 01508 01517 int md_Compare (const metadata_t *mdataA, const metadata_t *mdataB); 01518 01528 TPAlbumStatus md_ConvertToAlbumStatus (const char *albumStatus); 01529 01530 01541 TPAlbumType md_ConvertToAlbumType (const char *albumType); 01542 01543 01556 void md_ConvertFromAlbumStatus(TPAlbumStatus status, char *albumStatus, int maxLen); 01557 01558 01571 void md_ConvertFromAlbumType (TPAlbumType type, char *albumType, int maxLen); 01572 01573 01574 01575 /* -------------------------------------------------------------------------- 01576 * String Interface 01577 * --------------------------------------------------------------------------*/ 01578 01588 float md_Similarity(const char *a, const char *b); 01589 01590 #ifdef __cplusplus 01591 } 01592 #endif 01593 01594 #endif