1 /*
2   Copyright (C) 2005-2017 Marius L. Jøhndal
3 
4   This library is free software; you can redistribute it and/or
5   modify it under the terms of the GNU Lesser General Public
6   License as published by the Free Software Foundation; either
7   version 2.1 of the License, or (at your option) any later version.
8 
9   This library is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12   Lesser General Public License for more details.
13 
14   You should have received a copy of the GNU Lesser General Public
15   License along with this library; if not, write to the Free Software
16   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 
18 */
19 
20 #ifndef CHANNEL_H
21 #define CHANNEL_H
22 
23 typedef enum {
24   CCA_RSS_DOWNLOAD_START,
25   CCA_RSS_DOWNLOAD_END,
26   CCA_ENCLOSURE_DOWNLOAD_START,
27   CCA_ENCLOSURE_DOWNLOAD_END
28 } channel_action;
29 
30 typedef struct _channel {
31   gchar *url;
32   gchar *channel_filename;
33   gchar *spool_directory;
34   gchar *filename_pattern;
35   GHashTable *downloaded_enclosures;
36   gchar *rss_last_fetched;
37 } channel;
38 
39 typedef struct _channel_info {
40   char *title;
41   char *link;
42   char *description;
43   char *language;
44 } channel_info;
45 
46 typedef struct _enclosure {
47   char *url;
48   long length;
49   char *type;
50 } enclosure;
51 
52 typedef struct _enclosure_filter {
53   gchar *pattern;
54   gboolean caseless;
55 } enclosure_filter;
56 
57 typedef void (*channel_callback)(void *user_data, channel_action action,
58                                  channel_info *channel_info,
59                                  enclosure *enclosure, const char *filename);
60 
61 channel *channel_new(const char *url, const char *channel_file,
62                      const char *spool_directory, const char *filename_pattern,
63                      int resume);
64 void channel_free(channel *c);
65 int channel_update(channel *c, void *user_data, channel_callback cb,
66                    int no_download, int no_mark_read, int first_only,
67                    int resume, enclosure_filter *filter, int debug,
68                    int progress_bar);
69 
70 enclosure_filter *enclosure_filter_new(const gchar *pattern, gboolean caseless);
71 void enclosure_filter_free(enclosure_filter *e);
72 
73 #endif /* CHANNEL_H */
74