00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00032
00033 #ifdef ONLINE_SERVICES
00034
00035 #ifndef __ONLINE_SERVICE_H__
00036 #define __ONLINE_SERVICE_H__
00037
00038 #include "zmm/zmm.h"
00039 #include "zmmf/zmmf.h"
00040 #include "mxml/mxml.h"
00041 #include "layout/layout.h"
00042
00043 #define ONLINE_SERVICE_AUX_ID "ols"
00044 #define ONLINE_SERVICE_LAST_UPDATE "lu"
00045
00046
00047 typedef enum
00048 {
00049 OS_None = 0,
00050 OS_YouTube = 1,
00051 OS_SopCast = 2,
00052 OS_Weborama = 3,
00053 OS_ATrailers = 4,
00054 OS_Max
00055 } service_type_t;
00056
00059 class OnlineService : public zmm::Object
00060 {
00061 public:
00062 OnlineService();
00063
00075 virtual bool refreshServiceData(zmm::Ref<Layout> layout) = 0;
00076
00078 virtual service_type_t getServiceType() = 0;
00079
00081 virtual zmm::String getServiceName() = 0;
00082
00084 char getStoragePrefix();
00085
00087 static char getStoragePrefix(service_type_t service);
00088
00092 virtual zmm::Ref<zmm::Object> defineServiceTask(zmm::Ref<mxml::Element> xmlopt, zmm::Ref<zmm::Object> params) = 0;
00093
00102 void incTaskCount() { taskCount++; }
00103
00104 void decTaskCount() { taskCount--; }
00105
00106 int getTaskCount() { return taskCount; }
00107
00108 void setTaskCount(int taskCount) { this->taskCount = taskCount; }
00109
00111 void setTimerParameter(zmm::Ref<zmm::Object> param)
00112 { timer_parameter = param; }
00113
00114 zmm::Ref<Object> getTimerParameter() { return timer_parameter; }
00115
00117 void setRefreshInterval(int interval) {refresh_interval = interval; }
00118
00120 int getRefreshInterval() { return refresh_interval; }
00121
00123 void setItemPurgeInterval(int interval) { purge_interval = interval; }
00124
00126 int getItemPurgeInterval() { return purge_interval; }
00127
00128 protected:
00129 int taskCount;
00130 int refresh_interval;
00131 int purge_interval;
00132 zmm::Ref<zmm::Object> timer_parameter;
00133
00135 zmm::String getCheckAttr(zmm::Ref<mxml::Element> xml, zmm::String attrname);
00137 int getCheckPosIntAttr(zmm::Ref<mxml::Element> xml, zmm::String attrname);
00138 };
00139
00140 class OnlineServiceList : public zmm::Object
00141 {
00142 public:
00143 OnlineServiceList();
00144
00146 void registerService(zmm::Ref<OnlineService> service);
00147
00149 zmm::Ref<OnlineService> getService(service_type_t service);
00150
00151 protected:
00152 zmm::Ref<zmm::Array<OnlineService> > service_list;
00153 };
00154
00155 #endif//__ONLINE_SERVICE_H__
00156
00157 #endif//ONLINE_SERVICE