ETVDB  0.6.0
ETVDB is a tool and a library to get data from The TV Database (TVDB)
etvdb.h
Go to the documentation of this file.
1 /* Copyright (C) 2013 Thomas Gstaedtner
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  */
17 
18 #ifndef __ETVDB_H__
19 #define __ETVDB_H__
20 
46 #include <stdlib.h>
47 #include <string.h>
48 #include <time.h>
49 #include <Eina.h>
50 
51 #ifdef EAPI
52 # undef EAPI
53 #endif
54 
55 #ifdef __GNUC__
56 # if __GNUC__ >= 4
57 # define EAPI __attribute__ ((visibility("default")))
58 # else
59 # define EAPI
60 # endif
61 #else
62 # define EAPI
63 #endif
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
74 char etvdb_api_key[17];
75 
85 
91 typedef struct _etvdb_series {
92  uint32_t id;
93  char *imdb_id;
94  char *name;
95  char *overview;
96  uint16_t runtime;
97  Eina_List *seasons;
98  Eina_List *specials;
99 } Series;
100 
106 typedef struct _etvdb_episode {
107  uint32_t id;
108  char *imdb_id;
109  char *name;
110  char *overview;
111  char *firstaired;
112  uint16_t number;
113  uint16_t season;
115 } Episode;
116 
121 EAPI Eina_Bool etvdb_init(char api_key[17]);
122 EAPI Eina_Bool etvdb_shutdown(void);
123 
124 EAPI Eina_Hash *etvdb_languages_get(const char *lang_file_path);
125 EAPI Eina_Bool etvdb_language_set(Eina_Hash *hash, char *lang);
126 EAPI time_t etvdb_server_time_get(void);
127 
128 EAPI Series *etvdb_series_by_id_get(uint32_t id);
129 EAPI int etvdb_series_episodes_count(Series *s, int season);
130 EAPI Eina_List *etvdb_series_find(const char *name);
131 EAPI void etvdb_series_free(Series *s);
132 EAPI Series *etvdb_series_from_list_get(Eina_List *list, int number);
133 EAPI Eina_Bool etvdb_series_populate(Series *s);
134 
135 EAPI Eina_List *etvdb_episodes_get(Series *s);
136 EAPI Episode *etvdb_episode_airs_next_get(Series *s, char *timestr);
137 EAPI Episode *etvdb_episode_by_date_get(Series *s, const char *date);
138 EAPI Episode *etvdb_episode_by_id_get(uint32_t id, Series **s);
139 EAPI Episode *etvdb_episode_by_number_get(Series *s, int season, int episode);
140 EAPI void etvdb_episode_free(Episode *e);
141 EAPI Episode *etvdb_episode_from_series_get(Series *s, int season, int episode);
142 EAPI Episode *etvdb_episode_latest_aired_get(Series *s, char *timestr);
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #endif /* __ETVDB_H__ */
EAPI Episode * etvdb_episode_by_number_get(Series *s, int season, int episode)
Get episode data for one specific Episode.
Definition: episodes.c:253
EAPI time_t etvdb_server_time_get(void)
Function to retrieve time from TVDB&#39;s servers.
Definition: infra.c:134
Definition: etvdb.h:91
EAPI Eina_Bool etvdb_init(char *api_key)
Initialize etvdb.
Definition: etvdb.c:36
EAPI int etvdb_series_episodes_count(Series *s, int season)
Count episodes of one season in a Series structure.
Definition: series.c:278
EAPI Episode * etvdb_episode_airs_next_get(Series *s, char *timestr)
Get the Episode that airs next.
Definition: episodes.c:78
uint16_t number
Definition: etvdb.h:112
EAPI Eina_Hash * etvdb_languages_get(const char *lang_file_path)
Function to retrieve supported languages.
Definition: infra.c:39
EAPI Episode * etvdb_episode_by_id_get(uint32_t id, Series **s)
Get episode data for one specific Episode.
Definition: episodes.c:207
char * name
Definition: etvdb.h:109
EAPI Episode * etvdb_episode_latest_aired_get(Series *s, char *timestr)
Get the Episode that aired most recently.
Definition: episodes.c:349
EAPI Series * etvdb_series_by_id_get(uint32_t id)
Get Series data by TVDB Series ID.
Definition: series.c:34
EAPI Eina_Bool etvdb_language_set(Eina_Hash *hash, char *lang)
Change the global language setting.
Definition: infra.c:105
struct _etvdb_episode Episode
EAPI Series * etvdb_series_from_list_get(Eina_List *list, int number)
Get a Series from a list and initialize it fully.
Definition: series.c:78
EAPI Eina_List * etvdb_episodes_get(Series *s)
Get all Episodes of a Series.
Definition: episodes.c:32
EAPI void etvdb_series_free(Series *s)
Free a Series structure.
Definition: series.c:245
char * name
Definition: etvdb.h:94
char etvdb_language[3]
This array holds the language id. It is initialized by default and can be overview via etvdb_language...
Definition: etvdb.h:84
EAPI Eina_Bool etvdb_series_populate(Series *s)
Populate a Series structure with Episode data.
Definition: series.c:186
Eina_List * seasons
Definition: etvdb.h:97
char * firstaired
Definition: etvdb.h:111
char * overview
Definition: etvdb.h:110
Series * series
Definition: etvdb.h:114
char * imdb_id
Definition: etvdb.h:93
EAPI Eina_Bool etvdb_shutdown(void)
Shutdown etvdb.
Definition: etvdb.c:96
Definition: etvdb.h:106
char etvdb_api_key[17]
This array holds the TVDB api key for ETVDB. You should never manually overwrite it.
Definition: etvdb.h:74
uint16_t season
Definition: etvdb.h:113
char * overview
Definition: etvdb.h:95
uint32_t id
Definition: etvdb.h:92
EAPI void etvdb_episode_free(Episode *e)
Free a Episode structure.
Definition: episodes.c:298
Eina_List * specials
Definition: etvdb.h:98
uint32_t id
Definition: etvdb.h:107
uint16_t runtime
Definition: etvdb.h:96
EAPI Episode * etvdb_episode_by_date_get(Series *s, const char *date)
Get episode data for a specific date.
Definition: episodes.c:129
struct _etvdb_series Series
EAPI Episode * etvdb_episode_from_series_get(Series *s, int season, int episode)
Get Episode data from Series data.
Definition: episodes.c:323
EAPI Eina_List * etvdb_series_find(const char *name)
Find Series by Name.
Definition: series.c:120
char * imdb_id
Definition: etvdb.h:108