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.29 2004/02/05 10:37:40 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     char         *fileFormat;
00130 
00131     // This is only used in case of TRM collision
00132     int           numTRMIds;
00133 } metadata_t;
00134 
00135 
00142 typedef struct _artistresult_t
00143 {
00144     int   relevance;
00145     char *name, *sortName;
00146     char *id;
00147 } artistresult_t;
00148 
00149 
00156 typedef struct _albumresult_t
00157 {
00158     int             relevance;
00159     char           *name;
00160     char           *id;
00161     int             numTracks, numCDIndexIds;
00162     int             isVA;
00163     TPAlbumStatus   status;
00164     TPAlbumType     type;
00165     artistresult_t *artist;
00166 } albumresult_t;
00167 
00168 
00176 typedef struct _albumtrackresult_t
00177 {
00178     int             relevance;
00179     char           *name;
00180     char           *id;
00181     int             numTRMIds, trackNum;
00182     unsigned long   duration;
00183     artistresult_t *artist;
00184     albumresult_t  *album;
00185 } albumtrackresult_t;
00186 
00187 
00188 /* --------------------------------------------------------------------------
00189  * Main TunePimp Interface
00190  * --------------------------------------------------------------------------*/
00191 
00202 tunepimp_t tp_New           (const char *appName, const char *appVersion);
00203 
00217 tunepimp_t tp_NewWithArgs   (const char *appName, const char *appVersion, int startThreads);
00218 
00226 void      tp_Delete         (tunepimp_t o);
00227 
00228 
00237 void      tp_GetVersion     (tunepimp_t o, int *major, int *minor, int *rev);
00238 
00239 
00252 void       tp_SetUserInfo    (tunepimp_t o, const char *userName, 
00253                                             const char *password);
00254 
00255 
00269 void tp_GetUserInfo (tunepimp_t o, char *userName, int maxUserNameLen,
00270                                    char *password, int maxPasswordLen);
00271 
00272 
00283 void      tp_SetUseUTF8      (tunepimp_t o, int useUTF8);
00284 
00285 
00296 int tp_GetUseUTF8(tunepimp_t o);
00297 
00298 
00311 void       tp_SetServer      (tunepimp_t o, const char *serverAddr, 
00312                               short serverPort);
00313 
00314 
00329 void tp_GetServer(tunepimp_t o, char *serverAddr, int maxLen,
00330                                 short *serverPort);
00331 
00332 
00346 void       tp_SetProxy          (tunepimp_t o, const char *serverAddr, short serverPort);
00347 
00348 
00363 void tp_GetProxy(tunepimp_t o, char *serverAddr, int maxLen, short *serverPort);
00364 
00365 
00375 int tp_GetNumSupportedExtensions(tunepimp_t o);
00376 
00377 
00392 void tp_GetSupportedExtensions(tunepimp_t o, char extensions[][32]);
00393 
00403 void tp_SetAnalyzerPriority(tunepimp_t o, TPThreadPriorityEnum priority);
00404 
00414 TPThreadPriorityEnum tp_GetAnalyzerPriority(tunepimp_t o);
00415 
00437 void tp_SetAutoFileLookup(tunepimp_t o, int enable);
00438 
00439 
00450 int tp_GetAutoFileLookup(tunepimp_t o);
00451 
00452 
00469 void tp_SetNotifyCallback(tunepimp_t o, tp_notify_callback callback, void *data);
00470 
00471 
00482 tp_notify_callback tp_GetNotifyCallback(tunepimp_t o);
00483 
00484 
00502 int tp_GetNotification(tunepimp_t o, TPCallbackEnum *type, int *fileId);
00503 
00504 
00521 void tp_SetStatusCallback(tunepimp_t o, tp_status_callback callback, void *data);
00522 
00523 
00540 int tp_GetStatus(tunepimp_t o, char *status, int statusLen);
00541 
00542 
00553 tp_status_callback tp_GetStatusCallback(tunepimp_t o);
00554 
00555 
00566 void tp_GetError(tunepimp_t o, char *error, int maxLen);
00567 
00568 
00582 void       tp_SetDebug        (tunepimp_t o, int debug);
00583 
00584 
00594 int tp_GetDebug(tunepimp_t o);
00595 
00596 
00618 int       tp_AddFile          (tunepimp_t o, const char *fileName);
00619 
00620 
00634 int       tp_AddDir                (tunepimp_t o, const char *dirPath);
00635 
00636 
00646 void      tp_Remove                (tunepimp_t o, int fileId);
00647 
00648 
00657 int       tp_GetNumFiles           (tunepimp_t o);
00658 
00659 
00669 int       tp_GetNumUnsubmitted     (tunepimp_t o);
00670 
00671 
00679 int       tp_GetNumUnsavedItems    (tunepimp_t o);
00680 
00691 int       tp_GetTrackCounts(tunepimp_t o, int *counts, int maxCounts);
00692 
00704 int       tp_GetNumFileIds         (tunepimp_t o);
00705 
00706 
00720 void      tp_GetFileIds            (tunepimp_t o, int *ids, int numIds);
00721 
00722 
00735 track_t   tp_GetTrack             (tunepimp_t o, int fileId);
00736 
00737 
00746 void      tp_ReleaseTrack          (tunepimp_t o, track_t track);
00747 
00748 
00763 void      tp_Wake                  (tunepimp_t o, track_t track);
00764 
00765 
00779 TPError   tp_SelectResult          (tunepimp_t o, track_t track, int resultIndex);
00780 
00781 
00792 void      tp_Misidentified         (tunepimp_t o, int fileId);
00793 
00806 void      tp_IdentifyAgain         (tunepimp_t o, int fileId);
00807 
00845 int      tp_WriteTags             (tunepimp_t o, int *fileIds, int numFileIds);
00846 
00847 
00857 void tp_AddTRMSubmission(tunepimp_t o, const char *trackId, const char *trmId);
00858 
00859 
00872 TPError   tp_SubmitTRMs            (tunepimp_t o);
00873 
00874 
00888 void      tp_SetRenameFiles          (tunepimp_t o, int rename);
00889 
00890 
00901 int tp_GetRenameFiles(tunepimp_t o);
00902 
00903 
00917 void      tp_SetMoveFiles            (tunepimp_t o, int move);
00918 
00919 
00929 int tp_GetMoveFiles(tunepimp_t o);
00930 
00931 
00943 void      tp_SetWriteID3v1           (tunepimp_t o, int writeID3v1);
00944 
00945 
00955 int tp_GetWriteID3v1(tunepimp_t o);
00956 
00957 
00971 void      tp_SetClearTags            (tunepimp_t o, int clearTags);
00972 
00973 
00984 int tp_GetClearTags(tunepimp_t o);
00985 
00986 
01017 void      tp_SetFileMask             (tunepimp_t o, const char *fileMask);
01018 
01019 
01032 void tp_GetFileMask (tunepimp_t o, char *fileMask, int maxLen);
01033 
01034 
01050 void      tp_SetVariousFileMask     (tunepimp_t o, const char *variousFileMask);
01051 
01052 
01065 void tp_GetVariousFileMask (tunepimp_t o, char *variousFileMask, int maxLen);
01066 
01067 
01085 void tp_SetAllowedFileCharacters(tunepimp_t o, const char *allowedFileCharacters);
01086 
01087 
01102 void tp_GetAllowedFileCharacters(tunepimp_t o, char *allowedFileCharacters, int maxLen);
01103 
01104 
01119 void      tp_SetDestDir              (tunepimp_t o, const char *destDir);
01120 
01121 
01135 void tp_GetDestDir(tunepimp_t o, char *destDir, int maxLen);
01136 
01137 
01163 void      tp_SetTopSrcDir            (tunepimp_t o, const char *topSrcDir);
01164 
01165 
01180 void tp_GetTopSrcDir(tunepimp_t o, char *topSrcDir, int maxLen);
01181 
01182 
01207 void      tp_SetTRMCollisionThreshold(tunepimp_t o, int trmThreshold);
01208 
01209 
01220 int tp_GetTRMCollisionThreshold(tunepimp_t o);
01221 
01239 void      tp_SetMinTRMThreshold(tunepimp_t o, int minThreshold);
01240 
01241 
01252 int tp_GetMinTRMThreshold(tunepimp_t o);
01253 
01275 void      tp_SetAutoSaveThreshold    (tunepimp_t o, int autoSaveThreshold);
01276 
01277 
01289 int tp_GetAutoSaveThreshold(tunepimp_t o);
01290 
01299 void tp_SetMaxFileNameLen(tunepimp_t o, int maxFileNameLen);
01300 
01301 
01310 int tp_GetMaxFileNameLen(tunepimp_t o);
01311 
01322 void tp_SetAutoRemovedSavedFiles(tunepimp_t o, int autoRemoveSavedFiles);
01323 
01324 
01335 int tp_GetAutoRemovedSavedFiles(tunepimp_t o);
01336 
01337 
01356 int tp_GetRecognizedFileList(tunepimp_t o, int threshold, int **fileIds, int *numIds);
01357 
01358 
01368 void tp_DeleteRecognizedFileList(tunepimp_t o, int *fileIds);
01369 
01370 
01371 #ifdef WIN32
01372 
01384 void      tp_WSAInit           (tunepimp_t o);
01385 
01386 
01395 void      tp_WSAStop           (tunepimp_t o);
01396 #endif 
01397 
01398 
01399 /* --------------------------------------------------------------------------
01400  * Track Interface
01401  * --------------------------------------------------------------------------*/
01402 
01414 TPFileStatus tr_GetStatus      (track_t t);
01415 
01416 
01428 void       tr_SetStatus        (track_t t, const TPFileStatus status);
01429 
01430 
01440 void       tr_GetFileName      (track_t t, char *fileName, int maxLen);
01441 
01442 
01454 void       tr_GetTRM           (track_t t, char *trm, int maxLen);
01455 
01456 
01469 void       tr_GetLocalMetadata (track_t t, metadata_t *mdata);
01470 
01471 
01485 void       tr_SetLocalMetadata (track_t t, const metadata_t *mdata);
01486 
01487 
01501 void       tr_GetServerMetadata(track_t t, metadata_t *mdata);
01502 
01503 
01516 void       tr_SetServerMetadata(track_t t, const metadata_t *mdata);
01517 
01518 
01533 void       tr_GetError         (track_t t, char *error, int maxLen);
01534 
01535 
01547 int        tr_GetSimilarity    (track_t t);
01548 
01549 
01558 int        tr_HasChanged       (track_t t);
01559 
01560 
01571 int        tr_GetNumResults    (track_t t);
01572 
01573 
01593 void       tr_GetResults       (track_t t, TPResultType *type, 
01594                                 result_t *results, int *numResults);
01595 
01596 
01607 void       tr_Lock             (track_t t);
01608 
01609 
01618 void       tr_Unlock           (track_t t);
01619 
01620 
01621 /* --------------------------------------------------------------------------
01622  * Metadata Interface
01623  * --------------------------------------------------------------------------*/
01624 
01625 
01636 metadata_t   *md_New                   (void);
01637 
01638 
01646 void          md_Delete                (metadata_t *mdata);
01647 
01648 
01659 void          md_Clear                 (metadata_t *mdata);
01660 
01661 
01671 TPAlbumStatus md_ConvertToAlbumStatus  (const char *albumStatus);
01672 
01673 
01684 TPAlbumType   md_ConvertToAlbumType    (const char *albumType);
01685 
01686 
01699 void          md_ConvertFromAlbumStatus(TPAlbumStatus status, char *albumStatus, int maxLen);
01700 
01701 
01714 void          md_ConvertFromAlbumType  (TPAlbumType type, char *albumType, int maxLen);
01715 
01716 
01717 
01718 /* --------------------------------------------------------------------------
01719  * Result Interface
01720  * --------------------------------------------------------------------------*/
01721 
01731 void rs_Delete(TPResultType type, result_t *result, int numResults);
01732 
01733 #ifdef __cplusplus
01734 }
01735 #endif
01736 
01737 #endif 

Generated on Sun Feb 29 17:03:33 2004 for MusicBrainz Tunepimp Library by doxygen 1.3.6-20040222