gmyth/gmyth/gmyth_scheduler.h
author melunko
Thu Mar 13 16:29:38 2008 +0000 (2008-03-13)
branchtrunk
changeset 942 c93bfa74c71f
parent 935 067904b6921f
child 944 ec1d5934d8e8
permissions -rw-r--r--
[svn r951] gmyth now is 0.8.1. Added methods epg_is_connected() and scheduler_is_connected()
     1 /**
     2  * GMyth Library
     3  *
     4  * @file gmyth/gmyth_scheduler.h
     5  *
     6  * @brief <p> The scheduler encapsulates all functions for browsing, scheduling
     7  * and modifying the recorded content.
     8  *
     9  * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    10  * @author Alexsandro Jose Virginio dos Santos <alexsandro.santos@indt.org.br>
    11  *
    12  *
    13  * This program is free software; you can redistribute it and/or modify
    14  * it under the terms of the GNU Lesser General Public License as published by
    15  * the Free Software Foundation; either version 2 of the License, or
    16  * (at your option) any later version.
    17  *
    18  * This program is distributed in the hope that it will be useful,
    19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    21  * GNU General Public License for more details.
    22  *
    23  * You should have received a copy of the GNU Lesser General Public License
    24  * along with this program; if not, write to the Free Software
    25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    26  */
    27 
    28 #ifndef __GMYTH_SCHEDULER_H__
    29 #define __GMYTH_SCHEDULER_H__
    30 
    31 #include <glib-object.h>
    32 #include <time.h>
    33 
    34 #include "gmyth_common.h"
    35 #include "gmyth_query.h"
    36 #include "gmyth_backendinfo.h"
    37 
    38 G_BEGIN_DECLS
    39 
    40 typedef enum {
    41     GMYTH_SCHEDULE_ONE_OCCURRENCE,
    42     GMYTH_SCHEDULE_ALL_OCCURRENCES,
    43     GMYTH_SCHEDULE_EXCEPTION
    44 } GMythScheduleType;
    45 
    46 
    47 #define GMYTH_SCHEDULER_TYPE               (gmyth_scheduler_get_type ())
    48 #define GMYTH_SCHEDULER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SCHEDULER_TYPE, GMythScheduler))
    49 #define GMYTH_SCHEDULER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SCHEDULER_TYPE, GMythSchedulerClass))
    50 #define IS_GMYTH_SCHEDULER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_SCHEDULER_TYPE))
    51 #define IS_GMYTH_SCHEDULER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SCHEDULER_TYPE))
    52 #define GMYTH_SCHEDULER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_SCHEDULER_TYPE, GMythSchedulerClass))
    53 
    54 typedef struct _GMythScheduler GMythScheduler;
    55 typedef struct _GMythSchedulerClass GMythSchedulerClass;
    56 
    57 struct _GMythSchedulerClass {
    58     GObjectClass    parent_class;
    59 };
    60 
    61 struct _GMythScheduler {
    62     GObject         parent;
    63 
    64     unsigned long   recordid;
    65     unsigned long   type;
    66     unsigned long   search;
    67     GString        *profile;
    68 
    69     long            dupin;
    70     long            dupmethod;
    71     long            autoexpire;
    72     short int       autotranscode;
    73     long            transcoder;
    74 
    75     short int       autocommflag;
    76     short int       autouserjob1;
    77     short int       autouserjob2;
    78     short int       autouserjob3;
    79     short int       autouserjob4;
    80 
    81     long            startoffset;
    82     long            endoffset;
    83     long            maxepisodes;
    84     long            maxnewest;
    85 
    86     long            recpriority;
    87     GString        *recgroup;
    88     GString        *playgroup;
    89 
    90     long            prefinput;
    91     short int       inactive;
    92 
    93     GString        *search_type;
    94     GString        *search_what;
    95 
    96     GMythQuery     *msqlquery;
    97     GMythBackendInfo *backend_info;
    98 };
    99 
   100 typedef struct {
   101     guint           schedule_id;
   102     gint            channel_id;
   103     GString        *program_id;
   104 
   105     GTimeVal       *start_time;
   106     GTimeVal       *end_time;
   107 
   108     GString        *seriesid;
   109     GString        *title;
   110     GString        *subtitle;
   111     GString        *description;
   112     GString        *category;
   113 
   114     GMythScheduleType type;
   115 
   116     gint parentid;
   117 
   118 } ScheduleInfo;
   119 
   120 typedef struct {
   121     guint           record_id;
   122     gint            channel_id;
   123     GString        *program_id;
   124 
   125     GTimeVal       *start_time;
   126     GTimeVal       *end_time;
   127 
   128     GString         *seriesid;
   129     GString        *title;
   130     GString        *subtitle;
   131     GString        *description;
   132     GString        *category;
   133 
   134     GString        *basename;
   135 
   136     guint64         filesize;
   137 
   138 } RecordedInfo;
   139 
   140 
   141 GType               gmyth_scheduler_get_type                (void);
   142 
   143 GMythScheduler*     gmyth_scheduler_new                     (void);
   144 gboolean            gmyth_scheduler_connect                 (GMythScheduler * scheduler,
   145                                                              GMythBackendInfo * backend_info);
   146 gboolean            gmyth_scheduler_connect_with_timeout    (GMythScheduler * scheduler,
   147                                                              GMythBackendInfo * backend_info,
   148                                                              guint timeout);
   149 gboolean            gmyth_scheduler_is_connected (GMythScheduler *scheduler);
   150 gboolean            gmyth_scheduler_disconnect              (GMythScheduler * scheduler);
   151 gint                gmyth_scheduler_get_schedule_list       (GMythScheduler * scheduler,
   152                                                              GList ** sched_list);
   153 ScheduleInfo*       gmyth_scheduler_get_schedule            (GMythScheduler * scheduler,
   154 		                                             gint schedule_id);
   155 gint                gmyth_scheduler_get_recorded_list       (GMythScheduler * scheduler,
   156                                                              GList ** rec_list);
   157 RecordedInfo*       gmyth_scheduler_get_recorded_info       (GMythScheduler *scheduler,
   158                                                              const char *basename);
   159 GMythProgramInfo*   gmyth_scheduler_get_recorded            (GMythScheduler * scheduler,
   160                                                              GString * channel,
   161                                                              GTimeVal * starttime);
   162 ScheduleInfo*       gmyth_scheduler_add_schedule_program    (GMythScheduler * scheduler,
   163                                                              GMythProgramInfo *program,
   164                                                              GMythScheduleType type);
   165 gint                gmyth_scheduler_add_schedule            (GMythScheduler * scheduler,
   166                                                              ScheduleInfo * schedule_info);
   167 gboolean            gmyth_scheduler_add_schedule_full       (GMythScheduler * scheduler,
   168                                                              ScheduleInfo * schedule_info,
   169                                                              GMythScheduleType type);
   170 gboolean            gmyth_scheduler_add_exception           (GMythScheduler *scheduler,
   171                                                              gint schedule_id,
   172                                                              ScheduleInfo *exception_info);
   173 gboolean            gmyth_scheduler_delete_schedule         (GMythScheduler * scheduler,
   174                                                              gint record_id);
   175 gint                gmyth_scheduler_delete_recorded         (GMythScheduler * scheduler,
   176                                                              gint record_id);
   177 void                gmyth_scheduler_recorded_info_get_preview(RecordedInfo * info,
   178                                                              GByteArray * data);
   179 
   180 
   181 void                gmyth_recorded_info_free                (RecordedInfo * info);
   182 void                gmyth_schedule_info_free                (ScheduleInfo * info);
   183 void                gmyth_recorded_info_list_free           (GList * list);
   184 void                gmyth_schedule_info_list_free           (GList * list);
   185 
   186 G_END_DECLS
   187 #endif                          /* __GMYTH_SCHEDULER_H__ */