• Main Page
  • Files
  • File List

nfo.h

Go to the documentation of this file.
00001 /*
00002  * GeeXboX libnfo: a .NFO file reader/writer.
00003  * Copyright (C) 2009-2010 Benjamin Zores <ben@geexbox.org>
00004  *
00005  * This file is part of libnfo.
00006  *
00007  * libnfo is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * libnfo is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with libvalhalla; if not, write to the Free Software
00019  * Foundation, Inc, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00022 #ifndef NFO_H
00023 #define NFO_H
00024 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif /* __cplusplus */
00034 
00035 #define NFO_STRINGIFY(s) #s
00036 #define NFO_TOSTRING(s) NFO_STRINGIFY(s)
00037 
00038 #define NFO_VERSION_INT(a, b, c) (a << 16 | b << 8 | c)
00039 #define NFO_VERSION_DOT(a, b, c) a ##.## b ##.## c
00040 #define NFO_VERSION(a, b, c) NFO_VERSION_DOT(a, b, c)
00041 
00042 #define LIBNFO_VERSION_MAJOR  1
00043 #define LIBNFO_VERSION_MINOR  0
00044 #define LIBNFO_VERSION_MICRO  1
00045 
00046 #define LIBNFO_VERSION_INT NFO_VERSION_INT(LIBNFO_VERSION_MAJOR, \
00047                                            LIBNFO_VERSION_MINOR, \
00048                                            LIBNFO_VERSION_MICRO)
00049 #define LIBNFO_VERSION     NFO_VERSION(LIBNFO_VERSION_MAJOR, \
00050                                        LIBNFO_VERSION_MINOR, \
00051                                        LIBNFO_VERSION_MICRO)
00052 #define LIBNFO_VERSION_STR NFO_TOSTRING(LIBNFO_VERSION)
00053 #define LIBNFO_BUILD       LIBNFO_VERSION_INT
00054 
00055 #include <inttypes.h>
00056 
00057 /* Structure definitions */
00058 typedef struct nfo_stream_video_s nfo_stream_video_t;
00059 typedef struct nfo_stream_audio_s nfo_stream_audio_t;
00060 typedef struct nfo_stream_sub_s nfo_stream_sub_t;
00061 typedef struct nfo_fileinfo_s nfo_fileinfo_t;
00062 typedef struct nfo_actor_s nfo_actor_t;
00063 typedef struct nfo_movie_s nfo_movie_t;
00064 typedef struct nfo_tvshow_s nfo_tvshow_t;
00065 typedef struct nfo_tvshow_episode_s nfo_tvshow_episode_t;
00066 typedef struct nfo_s nfo_t;
00067 
00068 typedef enum nfo_type_s
00069 {
00070   NFO_UNKNOWN,
00071   NFO_MOVIE,
00072   NFO_TVSHOW,
00073   NFO_MUSIC,
00074 } nfo_type_t;
00075 
00076 typedef enum nfo_actor_field_s {
00077   NFO_ACTOR_NAME,
00078   NFO_ACTOR_ROLE,
00079   NFO_ACTOR_THUMB,
00080 } nfo_actor_field_t;
00081 
00082 typedef enum nfo_video_field_s {
00083   NFO_VIDEO_WIDTH,
00084   NFO_VIDEO_HEIGHT,
00085   NFO_VIDEO_CODEC,
00086   NFO_VIDEO_FORMAT_INFO,
00087   NFO_VIDEO_DURATION,
00088   NFO_VIDEO_BITRATE,
00089   NFO_VIDEO_BITRATE_MODE,
00090   NFO_VIDEO_BITRATE_MAX,
00091   NFO_VIDEO_CONTAINER,
00092   NFO_VIDEO_CODEC_ID,
00093   NFO_VIDEO_CODEC_INFO,
00094   NFO_VIDEO_SCAN_TYPE,
00095   NFO_VIDEO_ASPECT,
00096 } nfo_video_field_t;
00097 
00098 typedef enum nfo_audio_field_s {
00099   NFO_AUDIO_LANG,
00100   NFO_AUDIO_CODEC,
00101   NFO_AUDIO_CHANNELS,
00102   NFO_AUDIO_BITRATE,
00103 } nfo_audio_field_t;
00104 
00105 typedef enum nfo_sub_field_s {
00106   NFO_SUB_LANG,
00107 } nfo_sub_field_t;
00108 
00109 typedef enum nfo_movie_field_s {
00110   NFO_MOVIE_TITLE,
00111   NFO_MOVIE_ORIGINAL_TITLE,
00112   NFO_MOVIE_RATING,
00113   NFO_MOVIE_YEAR,
00114   NFO_MOVIE_TOP250,
00115   NFO_MOVIE_VOTES,
00116   NFO_MOVIE_OUTLINE,
00117   NFO_MOVIE_PLOT,
00118   NFO_MOVIE_TAGLINE,
00119   NFO_MOVIE_RUNTIME,
00120   NFO_MOVIE_THUMB,
00121   NFO_MOVIE_FAN_ART,
00122   NFO_MOVIE_MPAA,
00123   NFO_MOVIE_PLAY_COUNT,
00124   NFO_MOVIE_WATCHED,
00125   NFO_MOVIE_ID,
00126   NFO_MOVIE_TRAILER,
00127   NFO_MOVIE_GENRE,
00128   NFO_MOVIE_CREDITS,
00129   NFO_MOVIE_DIRECTOR,
00130   NFO_MOVIE_STUDIO,
00131 } nfo_movie_field_t;
00132 
00133 typedef enum nfo_tvshow_field_s {
00134   NFO_TVSHOW_TITLE,
00135   NFO_TVSHOW_RATING,
00136   NFO_TVSHOW_SEASON,
00137   NFO_TVSHOW_EPISODE,
00138   NFO_TVSHOW_DISPLAY_SEASON,
00139   NFO_TVSHOW_DISPLAY_EPISODE,
00140   NFO_TVSHOW_EPISODE_GUIDE_URL,
00141   NFO_TVSHOW_PLOT,
00142   NFO_TVSHOW_MPAA,
00143   NFO_TVSHOW_WATCHED,
00144   NFO_TVSHOW_GENRE,
00145   NFO_TVSHOW_PREMIERED,
00146   NFO_TVSHOW_STUDIO,
00147   NFO_TVSHOW_FANART,
00148   NFO_TVSHOW_FANART_HEADER,
00149   NFO_TVSHOW_FANART_COVER,
00150 } nfo_tvshow_field_t;
00151 
00152 typedef enum nfo_tvshow_episode_field_s {
00153   NFO_TVSHOW_EPISODE_TITLE,
00154   NFO_TVSHOW_EPISODE_RATING,
00155   NFO_TVSHOW_EPISODE_SEASON,
00156   NFO_TVSHOW_EPISODE_EPISODE,
00157   NFO_TVSHOW_EPISODE_PLOT,
00158   NFO_TVSHOW_EPISODE_THUMB,
00159   NFO_TVSHOW_EPISODE_FANART,
00160   NFO_TVSHOW_EPISODE_FANART_SEASON,
00161   NFO_TVSHOW_EPISODE_PLAY_COUNT,
00162   NFO_TVSHOW_EPISODE_CREDITS,
00163   NFO_TVSHOW_EPISODE_DIRECTOR,
00164   NFO_TVSHOW_EPISODE_AIRED,
00165   NFO_TVSHOW_EPISODE_VOTES,
00166 } nfo_tvshow_episode_field_t;
00167 
00168 /* (Un)Init Routines */
00169 nfo_t *nfo_init (const char *filename);
00170 void nfo_free (nfo_t *nfo);
00171 
00172 /* NFO Get Methods */
00173 nfo_type_t nfo_get_type (nfo_t *nfo);
00174 nfo_movie_t *nfo_get_movie (nfo_t *nfo);
00175 nfo_tvshow_episode_t *nfo_get_tvshow_episode (nfo_t *nfo);
00176 
00177 /* Movie Get Methods */
00178 char *nfo_movie_get (nfo_movie_t *movie, nfo_movie_field_t f);
00179 
00180 int nfo_movie_get_actors_count (nfo_movie_t *movie);
00181 nfo_actor_t *nfo_movie_get_actor (nfo_movie_t *movie, int id);
00182 
00183 int nfo_movie_get_video_streams_count (nfo_movie_t *movie);
00184 nfo_stream_video_t *nfo_movie_get_video_stream (nfo_movie_t *movie, int id);
00185 
00186 int nfo_movie_get_audio_streams_count (nfo_movie_t *movie);
00187 nfo_stream_audio_t *nfo_movie_get_audio_stream (nfo_movie_t *movie, int id);
00188 
00189 int nfo_movie_get_sub_streams_count (nfo_movie_t *movie);
00190 nfo_stream_sub_t *nfo_movie_get_sub_stream (nfo_movie_t *movie, int id);
00191 
00192 /* TVShow Get Methods */
00193 char *nfo_tvshow_episode_get (nfo_tvshow_episode_t *ep,
00194                               nfo_tvshow_episode_field_t f);
00195 
00196 int nfo_tvshow_episode_get_actors_count (nfo_tvshow_episode_t *ep);
00197 nfo_actor_t *nfo_tvshow_episode_get_actor (nfo_tvshow_episode_t *ep, int id);
00198 
00199 int nfo_tvshow_episode_get_video_streams_count (nfo_tvshow_episode_t *ep);
00200 nfo_stream_video_t *nfo_tvshow_episode_get_video_stream
00201  (nfo_tvshow_episode_t *ep, int id);
00202 
00203 int nfo_tvshow_episode_get_audio_streams_count (nfo_tvshow_episode_t *ep);
00204 nfo_stream_audio_t *nfo_tvshow_episode_get_audio_stream
00205  (nfo_tvshow_episode_t *ep, int id);
00206 
00207 int nfo_tvshow_episode_get_sub_streams_count (nfo_tvshow_episode_t *ep);
00208 nfo_stream_sub_t *nfo_tvshow_episode_get_sub_stream
00209  (nfo_tvshow_episode_t *ep, int id);
00210 
00211 nfo_tvshow_t *nfo_tvshow_episode_get_show (nfo_tvshow_episode_t *ep);
00212 char *nfo_tvshow_get (nfo_tvshow_t *ep, nfo_tvshow_field_t f);
00213 
00214 /* Actor Get Methods */
00215 char *nfo_actor_get (nfo_actor_t *actor, nfo_actor_field_t f);
00216 
00217 /* Streams Get Methods */
00218 char *nfo_video_stream_get (nfo_stream_video_t *video, nfo_video_field_t f);
00219 char *nfo_audio_stream_get (nfo_stream_audio_t *audio, nfo_audio_field_t f);
00220 char *nfo_sub_stream_get (nfo_stream_sub_t *sub, nfo_sub_field_t f);
00221 
00222 #ifdef __cplusplus
00223 }
00224 #endif /* __cplusplus */
00225 
00226 #endif /* NFO_H */

Generated on Sat Feb 16 2013 18:13:45 for libnfo by  doxygen 1.7.1