00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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, TPFileStatus status);
00076
00077
00089 typedef void (*tp_status_callback)(tunepimp_t pimp, void *data, const char *status);
00090
00091
00115 #define TP_ARTIST_NAME_LEN 255
00116 #define TP_ALBUM_NAME_LEN 255
00117 #define TP_TRACK_NAME_LEN 255
00118 #define TP_ID_LEN 40
00119 #define TP_FORMAT_LEN 32
00120 #define TP_COUNTRY_LEN 3
00121 typedef struct _metadata_t
00122 {
00123 char artist[TP_ARTIST_NAME_LEN];
00124 char sortName[TP_ARTIST_NAME_LEN];
00125 char album[TP_ALBUM_NAME_LEN];
00126 char track[TP_TRACK_NAME_LEN];
00127 int trackNum;
00128 int totalInSet;
00129 int variousArtist;
00130 int nonAlbum;
00131 char artistId[TP_ID_LEN];
00132 char albumId[TP_ID_LEN];
00133 char trackId[TP_ID_LEN];
00134 char fileTrm[TP_ID_LEN];
00135 char albumArtistId[TP_ID_LEN];
00136 unsigned long duration;
00137 TPAlbumType albumType;
00138 TPAlbumStatus albumStatus;
00139 char fileFormat[TP_FORMAT_LEN];
00140 int releaseYear, releaseDay, releaseMonth;
00141 char releaseCountry[TP_COUNTRY_LEN];
00142
00143
00144 int numTRMIds;
00145
00146 char albumArtist[TP_ARTIST_NAME_LEN];
00147 char albumArtistSortName[TP_ARTIST_NAME_LEN];
00148 } metadata_t;
00149
00150
00157 typedef struct _artistresult_t
00158 {
00159 int relevance;
00160 char name[TP_ARTIST_NAME_LEN], sortName[TP_ARTIST_NAME_LEN];
00161 char id[TP_ID_LEN];
00162 } artistresult_t;
00163
00164
00171 typedef struct _albumresult_t
00172 {
00173 int relevance;
00174 char name[TP_ALBUM_NAME_LEN];
00175 char id[TP_ID_LEN];
00176 int numTracks, numCDIndexIds;
00177 int isVA;
00178 int isNA;
00179 TPAlbumStatus status;
00180 TPAlbumType type;
00181 int releaseYear, releaseDay, releaseMonth;
00182 char releaseCountry[3];
00183 artistresult_t artist;
00184 } albumresult_t;
00185
00193 typedef struct _albumtrackresult_t
00194 {
00195 int relevance;
00196 char name[TP_ALBUM_NAME_LEN];
00197 char id[TP_ID_LEN];
00198 int numTRMIds, trackNum;
00199 unsigned long duration;
00200 artistresult_t artist;
00201 albumresult_t album;
00202 } albumtrackresult_t;
00203
00204
00205
00206
00207
00208
00219 tunepimp_t tp_New (const char *appName, const char *appVersion);
00220
00235 tunepimp_t tp_NewWithArgs (const char *appName, const char *appVersion,
00236 int startThreads, const char *pluginDir);
00237
00245 void tp_Delete (tunepimp_t o);
00246
00247
00256 void tp_GetVersion (tunepimp_t o, int *major, int *minor, int *rev);
00257
00258
00271 void tp_SetUserInfo (tunepimp_t o, const char *userName,
00272 const char *password);
00273
00274
00288 void tp_GetUserInfo (tunepimp_t o, char *userName, int maxUserNameLen,
00289 char *password, int maxPasswordLen);
00290
00291
00306 void tp_SetFileNameEncoding(tunepimp_t o, const char *encoding);
00307
00308
00318 void tp_GetFileNameEncoding(tunepimp_t o, char *encoding, int maxEncodingLen);
00319
00320
00333 void tp_SetServer (tunepimp_t o, const char *serverAddr,
00334 short serverPort);
00335
00336
00351 void tp_GetServer(tunepimp_t o, char *serverAddr, int maxLen,
00352 short *serverPort);
00353
00354
00368 void tp_SetProxy (tunepimp_t o, const char *serverAddr, short serverPort);
00369
00370
00385 void tp_GetProxy(tunepimp_t o, char *serverAddr, int maxLen, short *serverPort);
00386
00387
00397 int tp_GetNumSupportedExtensions(tunepimp_t o);
00398
00399
00414 #define TP_EXTENSION_LEN 32
00415 void tp_GetSupportedExtensions(tunepimp_t o, char extensions[][TP_EXTENSION_LEN]);
00416
00426 void tp_SetAnalyzerPriority(tunepimp_t o, TPThreadPriorityEnum priority);
00427
00437 TPThreadPriorityEnum tp_GetAnalyzerPriority(tunepimp_t o);
00438
00460 void tp_SetAutoFileLookup(tunepimp_t o, int enable);
00461
00462
00473 int tp_GetAutoFileLookup(tunepimp_t o);
00474
00475
00493 void tp_SetNotifyCallback(tunepimp_t o, tp_notify_callback callback, void *data);
00494
00495
00506 tp_notify_callback tp_GetNotifyCallback(tunepimp_t o);
00507
00508
00527 int tp_GetNotification(tunepimp_t o, TPCallbackEnum *type, int *fileId, TPFileStatus *status);
00528
00529
00547 void tp_SetStatusCallback(tunepimp_t o, tp_status_callback callback, void *data);
00548
00549
00566 int tp_GetStatus(tunepimp_t o, char *status, int statusLen);
00567
00568
00579 tp_status_callback tp_GetStatusCallback(tunepimp_t o);
00580
00581
00592 void tp_GetError(tunepimp_t o, char *error, int maxLen);
00593
00594
00608 void tp_SetDebug (tunepimp_t o, int debug);
00609
00610
00620 int tp_GetDebug(tunepimp_t o);
00621
00622
00645 int tp_AddFile (tunepimp_t o, const char *fileName, int readMetadataNow);
00646
00647
00661 int tp_AddDir (tunepimp_t o, const char *dirPath);
00662
00663
00673 void tp_Remove (tunepimp_t o, int fileId);
00674
00675
00684 int tp_GetNumFiles (tunepimp_t o);
00685
00686
00696 int tp_GetNumUnsubmitted (tunepimp_t o);
00697
00698
00706 int tp_GetNumUnsavedItems (tunepimp_t o);
00707
00718 int tp_GetTrackCounts(tunepimp_t o, int *counts, int maxCounts);
00719
00731 int tp_GetNumFileIds (tunepimp_t o);
00732
00733
00747 void tp_GetFileIds (tunepimp_t o, int *ids, int numIds);
00748
00749
00762 track_t tp_GetTrack (tunepimp_t o, int fileId);
00763
00764
00773 void tp_ReleaseTrack (tunepimp_t o, track_t track);
00774
00775
00790 void tp_Wake (tunepimp_t o, track_t track);
00791
00792
00806 TPError tp_SelectResult (tunepimp_t o, track_t track, int resultIndex);
00807
00808
00819 void tp_Misidentified (tunepimp_t o, int fileId);
00820
00833 void tp_IdentifyAgain (tunepimp_t o, int fileId);
00834
00873 int tp_WriteTags (tunepimp_t o, int *fileIds, int numFileIds);
00874
00875
00886 void tp_AddTRMSubmission(tunepimp_t o, const char *trackId, const char *trmId);
00887
00888
00901 TPError tp_SubmitTRMs (tunepimp_t o);
00902
00903
00918 void tp_SetRenameFiles (tunepimp_t o, int rename);
00919
00920
00931 int tp_GetRenameFiles(tunepimp_t o);
00932
00933
00948 void tp_SetMoveFiles (tunepimp_t o, int move);
00949
00950
00960 int tp_GetMoveFiles(tunepimp_t o);
00961
00962
00974 void tp_SetWriteID3v1 (tunepimp_t o, int writeID3v1);
00975
00976
00986 int tp_GetWriteID3v1(tunepimp_t o);
00987
00988
01000 void tp_SetWriteID3v2_3 (tunepimp_t o, int writeID3v2_3);
01001
01002
01012 int tp_GetWriteID3v2_3(tunepimp_t o);
01013
01024 void tp_SetID3Encoding (tunepimp_t o, TPID3Encoding encoding);
01025
01026
01036 TPID3Encoding tp_GetID3Encoding(tunepimp_t o);
01037
01051 void tp_SetClearTags (tunepimp_t o, int clearTags);
01052
01053
01064 int tp_GetClearTags(tunepimp_t o);
01065
01066
01104 void tp_SetFileMask (tunepimp_t o, const char *fileMask);
01105
01106
01119 void tp_GetFileMask (tunepimp_t o, char *fileMask, int maxLen);
01120
01121
01137 void tp_SetVariousFileMask (tunepimp_t o, const char *variousFileMask);
01138
01139
01152 void tp_GetVariousFileMask (tunepimp_t o, char *variousFileMask, int maxLen);
01153
01154
01171 void tp_SetNonAlbumFileMask (tunepimp_t o, const char *nonAlbumFileMask);
01172
01173
01186 void tp_GetNonAlbumFileMask (tunepimp_t o, char *nonAlbumFileMask, int maxLen);
01187
01188
01207 void tp_SetAllowedFileCharacters(tunepimp_t o, const char *allowedFileCharacters);
01208
01209
01224 void tp_GetAllowedFileCharacters(tunepimp_t o, char *allowedFileCharacters, int maxLen);
01225
01226
01241 void tp_SetDestDir (tunepimp_t o, const char *destDir);
01242
01243
01257 void tp_GetDestDir(tunepimp_t o, char *destDir, int maxLen);
01258
01259
01285 void tp_SetTopSrcDir (tunepimp_t o, const char *topSrcDir);
01286
01287
01302 void tp_GetTopSrcDir(tunepimp_t o, char *topSrcDir, int maxLen);
01303
01304
01329 void tp_SetTRMCollisionThreshold(tunepimp_t o, int trmThreshold);
01330
01331
01342 int tp_GetTRMCollisionThreshold(tunepimp_t o);
01343
01361 void tp_SetMinTRMThreshold(tunepimp_t o, int minThreshold);
01362
01363
01374 int tp_GetMinTRMThreshold(tunepimp_t o);
01375
01397 void tp_SetAutoSaveThreshold (tunepimp_t o, int autoSaveThreshold);
01398
01399
01411 int tp_GetAutoSaveThreshold(tunepimp_t o);
01412
01421 void tp_SetMaxFileNameLen(tunepimp_t o, int maxFileNameLen);
01422
01423
01432 int tp_GetMaxFileNameLen(tunepimp_t o);
01433
01444 void tp_SetAutoRemovedSavedFiles(tunepimp_t o, int autoRemoveSavedFiles);
01445
01446
01457 int tp_GetAutoRemovedSavedFiles(tunepimp_t o);
01458
01459
01478 int tp_GetRecognizedFileList(tunepimp_t o, int threshold, int **fileIds, int *numIds);
01479
01480
01490 void tp_DeleteRecognizedFileList(tunepimp_t o, int *fileIds);
01491
01492
01493 #ifdef WIN32
01494
01506 void tp_WSAInit (tunepimp_t o);
01507
01508
01517 void tp_WSAStop (tunepimp_t o);
01518 #endif
01519
01520
01521
01522
01523
01524
01536 TPFileStatus tr_GetStatus (track_t t);
01537
01538
01550 void tr_SetStatus (track_t t, const TPFileStatus status);
01551
01552
01562 void tr_GetFileName (track_t t, char *fileName, int maxLen);
01563
01564
01576 void tr_GetTRM (track_t t, char *trm, int maxLen);
01577
01578
01591 void tr_GetLocalMetadata (track_t t, metadata_t *mdata);
01592
01593
01607 void tr_SetLocalMetadata (track_t t, const metadata_t *mdata);
01608
01609
01623 void tr_GetServerMetadata(track_t t, metadata_t *mdata);
01624
01625
01638 void tr_SetServerMetadata(track_t t, const metadata_t *mdata);
01639
01640
01655 void tr_GetError (track_t t, char *error, int maxLen);
01656
01657
01669 int tr_GetSimilarity (track_t t);
01670
01671
01680 int tr_HasChanged (track_t t);
01681
01689 void tr_SetChanged (track_t t);
01690
01701 int tr_GetNumResults (track_t t);
01702
01703
01723 void tr_GetResults (track_t t, TPResultType *type,
01724 result_t *results, int *numResults);
01725
01726
01737 void tr_Lock (track_t t);
01738
01739
01748 void tr_Unlock (track_t t);
01749
01750
01751
01752
01753
01754
01755
01766 metadata_t *md_New (void);
01767
01768
01776 void md_Delete (metadata_t *mdata);
01777
01778
01789 void md_Clear (metadata_t *mdata);
01790
01799 int md_Compare (const metadata_t *mdataA, const metadata_t *mdataB);
01800
01810 TPAlbumStatus md_ConvertToAlbumStatus (const char *albumStatus);
01811
01812
01823 TPAlbumType md_ConvertToAlbumType (const char *albumType);
01824
01825
01838 void md_ConvertFromAlbumStatus(TPAlbumStatus status, char *albumStatus, int maxLen);
01839
01840
01853 void md_ConvertFromAlbumType (TPAlbumType type, char *albumType, int maxLen);
01854
01855
01856
01857
01858
01859
01860
01870 void rs_Delete(TPResultType type, result_t *result, int numResults);
01871
01872
01873
01874
01875
01887 float md_Similarity(const char *a, const char *b);
01888
01889 #ifdef __cplusplus
01890 }
01891 #endif
01892
01893 #endif