branches/gmyth-0.1b/src/gmyth_scheduler.h
author rosfran
Wed Feb 14 21:28:49 2007 +0000 (2007-02-14)
branchtrunk
changeset 360 6d5596b9eb95
permissions -rw-r--r--
[svn r362] Some fixes in the GIOWatcher clean-ups, and changed the API version number.
     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  * 
    14  * This program is free software; you can redistribute it and/or modify
    15  * it under the terms of the GNU Lesser General Public License as published by
    16  * the Free Software Foundation; either version 2 of the License, or
    17  * (at your option) any later version.
    18  *
    19  * This program is distributed in the hope that it will be useful,
    20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    22  * GNU General Public License for more details.
    23  *
    24  * You should have received a copy of the GNU Lesser General Public License
    25  * along with this program; if not, write to the Free Software
    26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    27  */
    28 
    29 #ifndef __GMYTH_SCHEDULER_H__
    30 #define __GMYTH_SCHEDULER_H__
    31 
    32 #include <glib-object.h>
    33 #include <time.h>
    34 
    35 #include "gmyth_common.h"
    36 #include "gmyth_query.h"
    37 #include "gmyth_backendinfo.h"
    38 
    39 G_BEGIN_DECLS
    40 
    41 #define GMYTH_SCHEDULER_TYPE               (gmyth_scheduler_get_type ())
    42 #define GMYTH_SCHEDULER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SCHEDULER_TYPE, GMythScheduler))
    43 #define GMYTH_SCHEDULER_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SCHEDULER_TYPE, GMythSchedulerClass))
    44 #define IS_GMYTH_SCHEDULER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SCHEDULER_TYPE))
    45 #define IS_GMYTH_SCHEDULER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SCHEDULER_TYPE))
    46 #define GMYTH_SCHEDULER_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_SCHEDULER_TYPE, GMythSchedulerClass))
    47 
    48 
    49 typedef struct _GMythScheduler         GMythScheduler;
    50 typedef struct _GMythSchedulerClass    GMythSchedulerClass;
    51 
    52 struct _GMythSchedulerClass
    53 {
    54   GObjectClass parent_class;
    55 
    56   /* callbacks */
    57   /* no one for now */
    58 };
    59 
    60 struct _GMythScheduler
    61 {
    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 *searchType;
    94     GString *searchForWhat;
    95     
    96     GMythQuery *msqlquery;
    97     GMythBackendInfo *backend_info;
    98 };
    99 
   100 typedef struct {
   101 	gint    record_id;
   102 	gint    program_id;
   103 	gint    channel_id;
   104 	
   105   GTimeVal* start_time;
   106 	GTimeVal* end_time;
   107     
   108 	GString *title;
   109 	GString *subtitle;
   110 	GString *description;
   111 	GString *category;
   112     
   113 } ScheduleInfo;
   114 
   115 typedef struct {
   116     guint    record_id;
   117     guint    program_id;
   118     guint    channel_id;
   119 
   120     GTimeVal*  start_time;
   121     GTimeVal*  end_time;
   122 
   123     GString *title;
   124     GString *subtitle;
   125     GString *description;
   126     GString *category;
   127     
   128     GString *basename;
   129 
   130     guint64 filesize;
   131     
   132 } RecordedInfo;
   133 
   134 
   135 GType           gmyth_scheduler_get_type (void);
   136 
   137 GMythScheduler* gmyth_scheduler_new ();
   138 gboolean        gmyth_scheduler_connect      (GMythScheduler *scheduler, 
   139                                               GMythBackendInfo *backend_info);
   140 gboolean        gmyth_scheduler_connect_with_timeout      (GMythScheduler *scheduler, 
   141                                        		GMythBackendInfo *backend_info, guint timeout);
   142 gboolean        gmyth_scheduler_disconnect   (GMythScheduler *scheduler);
   143 
   144 gint            gmyth_scheduler_get_schedule_list (GMythScheduler *scheduler, 
   145                                                    GList **sched_list);
   146 gint            gmyth_scheduler_get_recorded_list (GMythScheduler *scheduler, 
   147                                                    GList **rec_list);
   148 
   149 GMythProgramInfo* gmyth_scheduler_get_recorded (GMythScheduler *scheduler, 
   150                                         		GString *channel, GTimeVal* starttime);
   151 
   152 gint            gmyth_scheduler_add_schedule(GMythScheduler *scheduler, 
   153                                              ScheduleInfo *schedule_info);
   154 
   155 gint            gmyth_scheduler_delete_schedule (GMythScheduler *scheduler, 
   156                                                  gint record_id);
   157 gint            gmyth_scheduler_delete_recorded (GMythScheduler *scheduler, 
   158                                                  gint record_id);
   159 
   160 void            gmyth_scheduler_recorded_info_get_preview (RecordedInfo *info, 
   161                                                            GByteArray* data);
   162 
   163 void            gmyth_scheduler_schedule_info_free (ScheduleInfo *info);
   164 void            gmyth_scheduler_recorded_info_free (RecordedInfo *info);
   165 
   166 G_END_DECLS
   167 
   168 #endif /* __GMYTH_SCHEDULER_H__ */
   169