gmyth/src/gmyth_scheduler.h
author renatofilho
Thu Jun 14 20:40:47 2007 +0100 (2007-06-14)
branchtrunk
changeset 754 cb885ee44618
parent 750 312d6bc514f3
child 755 4b5efa290285
permissions -rw-r--r--
[svn r760] changed code style to Kernel Normal Form style with tabsize=4
     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 #define GMYTH_SCHEDULER_TYPE               (gmyth_scheduler_get_type ())
    40 #define GMYTH_SCHEDULER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SCHEDULER_TYPE, GMythScheduler))
    41 #define GMYTH_SCHEDULER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SCHEDULER_TYPE, GMythSchedulerClass))
    42 #define IS_GMYTH_SCHEDULER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMYTH_SCHEDULER_TYPE))
    43 #define IS_GMYTH_SCHEDULER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SCHEDULER_TYPE))
    44 #define GMYTH_SCHEDULER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_SCHEDULER_TYPE, GMythSchedulerClass))
    45 typedef struct _GMythScheduler GMythScheduler;
    46 typedef struct _GMythSchedulerClass GMythSchedulerClass;
    47 
    48 struct _GMythSchedulerClass {
    49     GObjectClass    parent_class;
    50 
    51     /*
    52      * callbacks 
    53      */
    54     /*
    55      * no one for now 
    56      */
    57 };
    58 
    59 struct _GMythScheduler {
    60     GObject         parent;
    61 
    62     unsigned long   recordid;
    63     unsigned long   type;
    64     unsigned long   search;
    65     GString        *profile;
    66 
    67     long            dupin;
    68     long            dupmethod;
    69     long            autoexpire;
    70     short int       autotranscode;
    71     long            transcoder;
    72 
    73     short int       autocommflag;
    74     short int       autouserjob1;
    75     short int       autouserjob2;
    76     short int       autouserjob3;
    77     short int       autouserjob4;
    78 
    79     long            startoffset;
    80     long            endoffset;
    81     long            maxepisodes;
    82     long            maxnewest;
    83 
    84     long            recpriority;
    85     GString        *recgroup;
    86     GString        *playgroup;
    87 
    88     long            prefinput;
    89     short int       inactive;
    90 
    91     GString        *search_type;
    92     GString        *search_what;
    93 
    94     GMythQuery     *msqlquery;
    95     GMythBackendInfo *backend_info;
    96 };
    97 
    98 typedef struct {
    99     guint           schedule_id;
   100     guint           program_id;
   101     guint           channel_id;
   102 
   103     GTimeVal       *start_time;
   104     GTimeVal       *end_time;
   105 
   106     GString        *title;
   107     GString        *subtitle;
   108     GString        *description;
   109     GString        *category;
   110 
   111 } ScheduleInfo;
   112 
   113 typedef struct {
   114     guint           record_id;
   115     guint           program_id;
   116     guint           channel_id;
   117 
   118     GTimeVal       *start_time;
   119     GTimeVal       *end_time;
   120 
   121     GString        *title;
   122     GString        *subtitle;
   123     GString        *description;
   124     GString        *category;
   125 
   126     GString        *basename;
   127 
   128     guint64         filesize;
   129 
   130 } RecordedInfo;
   131 
   132 
   133 GType           gmyth_scheduler_get_type(void);
   134 
   135 GMythScheduler *gmyth_scheduler_new();
   136 gboolean        gmyth_scheduler_connect(GMythScheduler * scheduler,
   137                                         GMythBackendInfo * backend_info);
   138 gboolean        gmyth_scheduler_connect_with_timeout(GMythScheduler *
   139                                                      scheduler,
   140                                                      GMythBackendInfo *
   141                                                      backend_info,
   142                                                      guint timeout);
   143 gboolean        gmyth_scheduler_disconnect(GMythScheduler * scheduler);
   144 
   145 gint            gmyth_scheduler_get_schedule_list(GMythScheduler *
   146                                                   scheduler,
   147                                                   GList ** sched_list);
   148 gint            gmyth_scheduler_get_recorded_list(GMythScheduler *
   149                                                   scheduler,
   150                                                   GList ** rec_list);
   151 
   152 GMythProgramInfo *gmyth_scheduler_get_recorded(GMythScheduler * scheduler,
   153                                                GString * channel,
   154                                                GTimeVal * starttime);
   155 
   156 gint            gmyth_scheduler_add_schedule(GMythScheduler * scheduler,
   157                                              ScheduleInfo * schedule_info);
   158 
   159 gint            gmyth_scheduler_delete_schedule(GMythScheduler * scheduler,
   160                                                 gint record_id);
   161 gint            gmyth_scheduler_delete_recorded(GMythScheduler * scheduler,
   162                                                 gint record_id);
   163 
   164 void            gmyth_scheduler_recorded_info_get_preview(RecordedInfo *
   165                                                           info,
   166                                                           GByteArray *
   167                                                           data);
   168 
   169 void            gmyth_recorded_info_free(RecordedInfo * info);
   170 void            gmyth_schedule_info_free(ScheduleInfo * info);
   171 
   172 void            gmyth_recorded_info_list_free(GList * list);
   173 void            gmyth_schedule_info_list_free(GList * list);
   174 
   175 G_END_DECLS
   176 #endif                          /* __GMYTH_SCHEDULER_H__ */