wepg-devel Mailing List for PalmOS electronic program guide
Brought to you by:
leonvs
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(7) |
Aug
(15) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Leon v. S. <le...@us...> - 2004-08-22 13:55:26
|
Update of /cvsroot/wepg/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31222 Modified Files: WepgAppInfo.h WepgApplic.cxx resource.h resource.rcp Log Message: ok Index: resource.rcp =================================================================== RCS file: /cvsroot/wepg/app/resource.rcp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** resource.rcp 29 Jul 2004 15:52:08 -0000 1.3 --- resource.rcp 22 Aug 2004 13:55:15 -0000 1.4 *************** *** 115,118 **** --- 115,122 ---- MENUITEM "Day end" FRM_GLOBALMENU_SETDAY "D" MENUITEM "View start" FRM_GLOBALMENU_SETVIEW "V" + MENUITEM SEPARATOR + MENUITEM "Sync 1 day" FRM_GLOBALMENU_LOAD1DAY "1" + MENUITEM "Sync 3 days" FRM_GLOBALMENU_LOAD3DAYS "3" + MENUITEM "Sync week" FRM_GLOBALMENU_LOADWEEK "7" END END Index: WepgAppInfo.h =================================================================== RCS file: /cvsroot/wepg/app/WepgAppInfo.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgAppInfo.h 17 Apr 2002 12:34:01 -0000 1.1.1.1 --- WepgAppInfo.h 22 Aug 2004 13:55:15 -0000 1.2 *************** *** 32,35 **** --- 32,36 ---- unsigned char day_end_hour; unsigned char day_end_min; + unsigned char load_ahead; }; Index: resource.h =================================================================== RCS file: /cvsroot/wepg/app/resource.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** resource.h 29 Jul 2004 15:52:08 -0000 1.3 --- resource.h 22 Aug 2004 13:55:15 -0000 1.4 *************** *** 41,44 **** --- 41,47 ---- #define FRM_GLOBALMENU_SETTZ 2205 #define FRM_GLOBALMENU_TODAY 2206 + #define FRM_GLOBALMENU_LOAD1DAY 2207 + #define FRM_GLOBALMENU_LOAD3DAYS 2208 + #define FRM_GLOBALMENU_LOADWEEK 2209 #define ALERT_DBCORRUPT 2300 Index: WepgApplic.cxx =================================================================== RCS file: /cvsroot/wepg/app/WepgApplic.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WepgApplic.cxx 29 Jul 2004 15:52:08 -0000 1.2 --- WepgApplic.cxx 22 Aug 2004 13:55:15 -0000 1.3 *************** *** 404,407 **** --- 404,429 ---- unhideToday(); return (true); + + case FRM_GLOBALMENU_LOAD1DAY: { + WepgAppInfo* appinfo = (WepgAppInfo*)m_db->getAppInfo(); + WepgAppInfoData* mirror = appinfo->getMirror(); + mirror->load_ahead = 1; + appinfo->write(); + return (true); + } + case FRM_GLOBALMENU_LOAD3DAYS: { + WepgAppInfo* appinfo = (WepgAppInfo*)m_db->getAppInfo(); + WepgAppInfoData* mirror = appinfo->getMirror(); + mirror->load_ahead = 3; + appinfo->write(); + return (true); + } + case FRM_GLOBALMENU_LOADWEEK: { + WepgAppInfo* appinfo = (WepgAppInfo*)m_db->getAppInfo(); + WepgAppInfoData* mirror = appinfo->getMirror(); + mirror->load_ahead = 7; + appinfo->write(); + return (true); + } } } |
|
From: Leon v. S. <le...@us...> - 2004-08-22 13:54:16
|
Update of /cvsroot/wepg/mythcond/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30880/src Modified Files: PalmAppInfo.C wepgsync.C Log Message: ok Index: wepgsync.C =================================================================== RCS file: /cvsroot/wepg/mythcond/src/wepgsync.C,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** wepgsync.C 8 Aug 2004 14:38:12 -0000 1.5 --- wepgsync.C 22 Aug 2004 13:53:53 -0000 1.6 *************** *** 71,74 **** --- 71,86 ---- } + static void + printDate(char* str, WepgDBTimeStamp const * ts) + { + sprintf(str, "%04li-%02li-%02li %02li:%02li", + ts->year, + ts->month, + ts->day, + ts->hour, + ts->minute + ); + } + *************** *** 163,167 **** IntermedRec::init( PalmAppInfo &appinfo, MYSQL *hostdb, MYSQL_RES *rs, MYSQL_ROW row ) { - WepgDBTimeStamp ts; struct tm tm; int fi; --- 175,178 ---- *************** *** 175,187 **** m_storage.station_id = atol( row[ mysql_field_index( rs, "chanid" ) ] ) - 1000; //HACK cat = row[ mysql_field_index( rs, "category" ) ]; ! i = 0; ! if (cat != NULL) ! while (i<APPNUMCATEGORIES) { ! if (strcmp(cat, appinfo.getPacked()->category_labels[i]) == 0) ! break; ! i++; } - m_storage.flags.category = i; parseDate( row[ mysql_field_index( rs, "starttime" ) ], &tm ); --- 186,199 ---- m_storage.station_id = atol( row[ mysql_field_index( rs, "chanid" ) ] ) - 1000; //HACK + m_storage.flags.category = 0; cat = row[ mysql_field_index( rs, "category" ) ]; ! if (cat != NULL) { ! for (i=0; i<APPNUMCATEGORIES; i++) { ! if (strcmp(cat, appinfo.getPacked()->category_labels[i]) == 0) { ! m_storage.flags.category = i; ! break; ! } ! } } parseDate( row[ mysql_field_index( rs, "starttime" ) ], &tm ); *************** *** 278,289 **** //some cache ! ts = m_storage.start_time; ! sprintf( m_startTimeStr, "%04li-%02li-%02li %02li:%02li", ! ts.year, ! ts.month, ! ts.day, ! ts.hour, ! ts.minute ! ); } --- 290,294 ---- //some cache ! printDate(m_startTimeStr, &m_storage.start_time); } *************** *** 343,346 **** --- 348,354 ---- int attr; int category; + char sql[1024]; + MYSQL_RES *rs; + MYSQL_ROW row; logprintf("wepg: saving modified recs\n"); *************** *** 373,377 **** } - retval = dlp_ReadRecordByIndex( pilot_socket, palmdb.getHandle(), --- 381,384 ---- *************** *** 384,388 **** continue; } - swapToHost( pacrec ); --- 391,394 ---- *************** *** 403,407 **** new_flags |= pacrec->flags.alarm ? FLAG_ALARM : 0; new_flags |= pacrec->flags.sys_seen_it ? FLAG_SYSSEENIT : 0; - new_flags |= pacrec->flags.unread ? FLAG_UNREAD : 0; new_flags |= pacrec->flags.record ? FLAG_RECORD : 0; --- 409,412 ---- *************** *** 409,430 **** new_flags |= pacrec->flags.recorded ? FLAG_RECORDED : 0; ! char sql[1024]; sprintf( sql, "UPDATE UserBroadcast " "SET user_rating=%i, flags=%i, rec_status=%i " "WHERE user_id=%i AND rec_id=%lu", - (int)pacrec->flags.user_rating, (int)new_flags, (int)STATUS_NONE, (int)hostuser.getInternalId(), - recid ); - free( pacrec ); - retval = mymysql_exec( hostdb, sql ); ! if ( retval ) return retval; } retval = dlp_ResetSyncFlags( pilot_socket, palmdb.getHandle() ); --- 414,480 ---- new_flags |= pacrec->flags.recorded ? FLAG_RECORDED : 0; ! int old_flags = 0; ! sprintf(sql, ! "SELECT flags FROM UserBroadcast " ! "WHERE user_id=%i AND rec_id=%lu", ! (int)hostuser.getInternalId(), ! recid); ! retval = mymysql_store(hostdb, sql, &rs); ! if (retval) { ! free(pacrec); ! return retval; ! } ! while( (row = mysql_fetch_row(rs)) != NULL ) { ! old_flags = atoi(row[0]); ! } ! mysql_free_result(rs); ! sprintf( sql, "UPDATE UserBroadcast " "SET user_rating=%i, flags=%i, rec_status=%i " "WHERE user_id=%i AND rec_id=%lu", (int)pacrec->flags.user_rating, (int)new_flags, (int)STATUS_NONE, (int)hostuser.getInternalId(), recid ); retval = mymysql_exec( hostdb, sql ); ! if ( retval ) { ! free(pacrec); return retval; + } + + if ((old_flags & FLAG_RECORD) != (new_flags & FLAG_RECORD)) { + char stim[64]; + printDate(stim, &pacrec->start_time); + int chanid = (int)(1000 + pacrec->station_id); //HACK + + if (new_flags & FLAG_RECORD) { + sprintf(sql, + "INSERT INTO record (type,chanid,station,starttime,startdate,endtime,enddate," + "title,subtitle,description,recpriority,recgroup,startoffset,endoffset) " + "SELECT DISTINCTROW " + "1,c.chanid,c.callsign,DATE_FORMAT(starttime,'%%T'),DATE_FORMAT(starttime,'%%Y-%%m-%%d'),DATE_FORMAT(endtime,'%%T'),DATE_FORMAT(endtime,'%%Y-%%m-%%d')," + "title, subtitle, description, 10, 'wepg', 0, 0 " + "FROM program AS p INNER JOIN channel AS c ON (p.chanid=c.chanid)" + "WHERE p.chanid=%i AND starttime='%s'", + chanid, + stim); + } + else { + sprintf(sql, + "DELETE FROM record " + "WHERE recgroup='wepg' AND chanid=%i AND " + "starttime=DATE_FORMAT('%s','%%T') AND startdate=DATE_FORMAT('%s','%%Y-%%m-%%d')", + chanid, stim, stim); + } + retval = mymysql_exec( hostdb, sql ); + if ( retval ) { + free( pacrec ); + return retval; + } + } + free(pacrec); } retval = dlp_ResetSyncFlags( pilot_socket, palmdb.getHandle() ); *************** *** 437,442 **** } - - static int archiveOldRecs( int pilot_socket, MYSQL *hostdb, --- 487,490 ---- *************** *** 610,613 **** --- 658,662 ---- } n_killed++; + } mysql_free_result( rs ); *************** *** 650,653 **** --- 699,703 ---- // mymysql_exec( hostdb, sql ); + // enum RecordingType{ kNotRecording = 0, kSingleRecord = 1, Index: PalmAppInfo.C =================================================================== RCS file: /cvsroot/wepg/mythcond/src/PalmAppInfo.C,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PalmAppInfo.C 7 Aug 2004 18:53:50 -0000 1.4 --- PalmAppInfo.C 22 Aug 2004 13:53:53 -0000 1.5 *************** *** 98,102 **** sprintf( sql, "SELECT chanid,callsign,channum " ! "FROM channel WHERE visible=1 ORDER BY channum" ); --- 98,105 ---- sprintf( sql, "SELECT chanid,callsign,channum " ! "FROM channel " ! "WHERE visible=1 AND chanid>=1000 AND chanid<2000 " ! // "ORDER BY channum" ! "ORDER BY chanid" //HACK: work-around for bug in palm app ); *************** *** 116,120 **** bool enabled = true; ! int listpos = atol( row[ mysql_field_index( rs, "channum" ) ] ); if ( listpos < 0 ) listpos = 0; if ( listpos >= APPNUMSTATIONS ) listpos = APPNUMSTATIONS-1; --- 119,123 ---- bool enabled = true; ! int listpos = stat_id;//HACK///atol( row[ mysql_field_index( rs, "channum" ) ] ); if ( listpos < 0 ) listpos = 0; if ( listpos >= APPNUMSTATIONS ) listpos = APPNUMSTATIONS-1; *************** *** 133,136 **** --- 136,140 ---- } + sprintf( sql, "SELECT DISTINCT category FROM program"); if ( mymysql_store( hostdb, sql, &rs ) ) { |
|
From: Leon v. S. <le...@us...> - 2004-08-22 13:54:16
|
Update of /cvsroot/wepg/mythcond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30880 Modified Files: populate.py serie.py Log Message: ok Index: serie.py =================================================================== RCS file: /cvsroot/wepg/mythcond/serie.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** serie.py 8 Aug 2004 17:26:35 -0000 1.3 --- serie.py 22 Aug 2004 13:53:52 -0000 1.4 *************** *** 30,33 **** --- 30,34 ---- TOLERANCE = 3.0/24 #3 hours + nextSeriesID = 1 def loadBroadcasts(mythdb, chanid, start_time, end_time, base_day_offset, day_offset, count, offsets): *************** *** 151,154 **** --- 152,156 ---- sid = nextSeriesID nextSeriesID = nextSeriesID + 1 + print "sid",sid for i in bc: # print 'a', *************** *** 271,274 **** --- 273,278 ---- def main(): + global nextSeriesID + try: opts, args = getopt.getopt(sys.argv[1:], "h:u:p:v?", ["host=", "user=", "password=", "help"]) Index: populate.py =================================================================== RCS file: /cvsroot/wepg/mythcond/populate.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** populate.py 8 Aug 2004 17:26:35 -0000 1.1 --- populate.py 22 Aug 2004 13:53:52 -0000 1.2 *************** *** 28,36 **** def populateUserBroadcast(mythdb, user_id, verbose): ! cu = mythdb.cursor() ! cu.execute("SELECT MAX(starttime) FROM UserBroadcast WHERE user_id=%s", (user_id)) ! row = cu.fetchone() ! limit = mux(row == None or row[0] == None, mx.DateTime.today(), row[0]) ! cu.close() if verbose: print "populate from",limit --- 28,39 ---- def populateUserBroadcast(mythdb, user_id, verbose): ! # cu = mythdb.cursor() ! # cu.execute("SELECT MAX(starttime) FROM UserBroadcast WHERE user_id=%s", (user_id)) ! # row = cu.fetchone() ! # limit = mux(row == None or row[0] == None, mx.DateTime.today(), row[0]) ! # cu.close() ! ! limit = mx.DateTime.today() ! if verbose: print "populate from",limit |
|
From: Leon v. S. <le...@us...> - 2004-08-08 17:26:44
|
Update of /cvsroot/wepg/mythcond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19515 Modified Files: serie.py Added Files: populate.py Log Message: ok Index: serie.py =================================================================== RCS file: /cvsroot/wepg/mythcond/serie.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** serie.py 8 Aug 2004 14:38:12 -0000 1.2 --- serie.py 8 Aug 2004 17:26:35 -0000 1.3 *************** *** 17,28 **** import MySQLdb - import random import string import time - import os.path - import socket import sys import mx import math # defines --- 17,26 ---- import MySQLdb import string import time import sys import mx import math + import getopt # defines *************** *** 33,43 **** - - def loadBroadcasts(mythdb, chanid, start_time, end_time, base_day_offset, day_offset, count, offsets): offsets.extend( range(base_day_offset, base_day_offset + count * day_offset, day_offset) ) ! # print "loading off",offsets bca = [] --- 31,39 ---- def loadBroadcasts(mythdb, chanid, start_time, end_time, base_day_offset, day_offset, count, offsets): offsets.extend( range(base_day_offset, base_day_offset + count * day_offset, day_offset) ) ! #if verbose: print "loading off",offsets bca = [] *************** *** 86,90 **** def saveSerie(mythdb, bc): ! global s_nextSeriesID # print "serie: ",len(bc) --- 82,86 ---- def saveSerie(mythdb, bc): ! global nextSeriesID # print "serie: ",len(bc) *************** *** 153,158 **** else: # instantiate new string of series ! sid = s_nextSeriesID ! s_nextSeriesID = s_nextSeriesID + 1 for i in bc: # print 'a', --- 149,154 ---- else: # instantiate new string of series ! sid = nextSeriesID ! nextSeriesID = nextSeriesID + 1 for i in bc: # print 'a', *************** *** 268,328 **** - mythdb = MySQLdb.connect(host="bender", user="mythtv", passwd="mythtv", db="mythconverg") ! cc=mythdb.cursor() ! cc.execute("SELECT MAX(id),MAX(starttime) FROM Serie") ! row = cc.fetchone() ! if row != None and row[0] != None: ! s_nextSeriesID = row[0] + 1 ! endtime = row[1] ! else: ! s_nextSeriesID = 1 ! endtime = mx.DateTime.today() - 14 ! cc.close() - cc=mythdb.cursor() - cc.execute("SELECT MAX(starttime) FROM program") - row = cc.fetchone() - if row != None and row[0] != None: - starttime = row[0] - else: - starttime = mx.DateTime.today() - cc.close() ! #day_offset = 0 ! #day_count = 5 ! #week_count = 4 ! #week_day_count = 1 ! #c1 = mx.DateTime.today() ! #c1 = c1 + day_offset * oneDay ! c1 = mx.DateTime.Date(starttime.year, starttime.month, starttime.day) ! c2 = c1 + oneDay ! day_count = (starttime - endtime).day + 1 ! if day_count < 4: ! day_count = 4 ! week_count = 4 ! week_day_count = day_count ! # print "daycount ",day_count, "c1",c1 ! cu=mythdb.cursor() ! cu.execute("SELECT chanid FROM channel WHERE visible=1") ! while 1: ! row = cu.fetchone() ! if row == None: ! break; ! chanid = row[0] ! print "processing channel ",chanid ! findSeries2(mythdb, chanid, c1, c2, day_count, week_count, week_day_count) ! cu.close() ! mythdb.close() ! print "done." --- 264,355 ---- ! def usage(): ! print "%s: [-h,--host=...] [-u,--user=...] [-p,--password=...] [-v] [-?]" % sys.argv[0] + def main(): + try: + opts, args = getopt.getopt(sys.argv[1:], "h:u:p:v?", ["host=", "user=", "password=", "help"]) + except getopt.GetoptError: + usage() + sys.exit(2) ! dbhost = "localhost" ! dbuser = "mythtv" ! dbpass = "mythtv" ! verbose = False ! for o, a in opts: ! if o == "-v": ! verbose = True ! if o in ("-?", "--help"): ! usage() ! sys.exit() ! if o in ("-h", "--host"): ! dbhost = a ! if o in ("-u", "--user"): ! dbuser = a ! if o in ("-p", "--password"): ! dbpass = a ! mythdb = MySQLdb.connect(host=dbhost, user=dbuser, passwd=dbpass, db="mythconverg") ! cc=mythdb.cursor() ! cc.execute("SELECT MAX(id),MAX(starttime) FROM Serie") ! row = cc.fetchone() ! if row != None and row[0] != None: ! nextSeriesID = row[0] + 1 ! endtime = row[1] ! else: ! nextSeriesID = 1 ! endtime = mx.DateTime.today() - 14 ! cc.close() ! cc=mythdb.cursor() ! cc.execute("SELECT MAX(starttime) FROM program") ! row = cc.fetchone() ! if row != None and row[0] != None: ! starttime = row[0] ! else: ! starttime = mx.DateTime.today() ! cc.close() ! #day_offset = 0 ! #day_count = 5 ! #week_count = 4 ! #week_day_count = 1 ! #c1 = mx.DateTime.today() ! #c1 = c1 + day_offset * oneDay ! c1 = mx.DateTime.Date(starttime.year, starttime.month, starttime.day) ! c2 = c1 + oneDay ! day_count = (starttime - endtime).day + 1 ! if day_count < 4: ! day_count = 4 ! week_count = 4 ! week_day_count = day_count ! if verbose: print "scanning back",day_count,"days for dayly's from",c1 ! if verbose: print "scanning back",week_day_count,"days for weekly's spanning",week_count,"weeks" + cu=mythdb.cursor() + cu.execute("SELECT chanid,callsign FROM channel WHERE visible=1") + while 1: + row = cu.fetchone() + if row == None: + break; + chanid = row[0] + name = row[1] + + if verbose: print "processing channel",chanid,name + findSeries2(mythdb, chanid, c1, c2, day_count, week_count, week_day_count) + cu.close() + + mythdb.close() + if verbose: print "done." + + if __name__ == "__main__": + main() --- NEW FILE: populate.py --- # populate.py - db filler for wepg # Copyright (C) 2004 Leon van Stuivenberg <l.v...@ch...> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import MySQLdb import sys import mx import getopt def mux(a,b,c): if a: return b else: return c # populate db with user-specific broadcast records; dups will be avoided by PK def populateUserBroadcast(mythdb, user_id, verbose): cu = mythdb.cursor() cu.execute("SELECT MAX(starttime) FROM UserBroadcast WHERE user_id=%s", (user_id)) row = cu.fetchone() limit = mux(row == None or row[0] == None, mx.DateTime.today(), row[0]) cu.close() if verbose: print "populate from",limit cu = mythdb.cursor() cu.execute("""INSERT INTO UserBroadcast (user_id,chanid,starttime,uid,orgtitle,category) SELECT %s,chanid,starttime,LEFT(LOWER(title),31),title,category FROM program WHERE starttime>%s""", (user_id, limit)) if verbose: print "populated nrows",cu.rowcount cu.close() if verbose: print "populate done." def usage(): print "%s: [-h,--host=...] [-u,--user=...] [-p,--password=...] [-v] [-?]" % sys.argv[0] def main(): try: opts, args = getopt.getopt(sys.argv[1:], "h:u:p:v?", ["host=", "user=", "password=", "help"]) except getopt.GetoptError: usage() sys.exit(2) dbhost = "localhost" dbuser = "mythtv" dbpass = "mythtv" verbose = False for o, a in opts: if o == "-v": verbose = True if o in ("-?", "--help"): usage() sys.exit() if o in ("-h", "--host"): dbhost = a if o in ("-u", "--user"): dbuser = a if o in ("-p", "--password"): dbpass = a mythdb = MySQLdb.connect(host=dbhost, user=dbuser, passwd=dbpass, db="mythconverg") cu=mythdb.cursor() cu.execute("SELECT id,name FROM User") while 1: row = cu.fetchone() if row == None: break; user_id = row[0] name = row[1] if verbose: print "processing user",user_id,name populateUserBroadcast(mythdb, user_id, verbose) cu.close() mythdb.close() if verbose: print "done." if __name__ == "__main__": main() |
|
From: Leon v. S. <le...@us...> - 2004-08-08 14:38:54
|
Update of /cvsroot/wepg/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28837 Modified Files: HostUser.C Log Message: ok Index: HostUser.C =================================================================== RCS file: /cvsroot/wepg/common/HostUser.C,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HostUser.C 3 Aug 2004 17:12:52 -0000 1.1 --- HostUser.C 8 Aug 2004 14:38:46 -0000 1.2 *************** *** 127,131 **** else { printf("user:'%s'\n", info.username); ! errprintf( "unanounced user %s", (const char*)info.username ); mysql_free_result( rs ); --- 127,131 ---- else { printf("user:'%s'\n", info.username); ! errprintf( "unanounced user %s\n", (const char*)info.username ); mysql_free_result( rs ); |
|
From: Leon v. S. <le...@us...> - 2004-08-08 14:38:21
|
Update of /cvsroot/wepg/mythcond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28741 Modified Files: myth.sql serie.py Log Message: ok Index: serie.py =================================================================== RCS file: /cvsroot/wepg/mythcond/serie.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** serie.py 7 Aug 2004 18:52:51 -0000 1.1 --- serie.py 8 Aug 2004 14:38:12 -0000 1.2 *************** *** 1,3 **** ! # mythcond - a pilot-link conduit for wepg # Copyright (C) 2004 Leon van Stuivenberg <l.v...@ch...> # --- 1,3 ---- ! # serie.py - database miner for wepg # Copyright (C) 2004 Leon van Stuivenberg <l.v...@ch...> # *************** *** 23,46 **** import socket import sys - import tempfile import mx ! # defines; flags: ! ! true = 1==1 ! false = not true ! #oneDay = mx.RelativeDateTime.oneDay ! oneDay = 1 # fixme: too large, but allows shifts between DST and noDST this way. ! TOLERANCE = 3.0/24 ! - def mux(a,b,c): - if a: - return b - return c - --- 23,36 ---- import socket import sys import mx + import math ! # defines ! oneDay = mx.DateTime.oneDay # fixme: too large, but allows shifts between DST and noDST this way. ! TOLERANCE = 3.0/24 #3 hours *************** *** 49,53 **** offsets.extend( range(base_day_offset, base_day_offset + count * day_offset, day_offset) ) ! print "loading off",offsets bca = [] --- 39,43 ---- offsets.extend( range(base_day_offset, base_day_offset + count * day_offset, day_offset) ) ! # print "loading off",offsets bca = [] *************** *** 56,61 **** yc2 = end_time - offsets[i] * oneDay cc = mythdb.cursor() ! #note: includes overlap # fixme: uid cc.execute("""SELECT starttime, endtime, title, lower(left(title,31)) FROM program --- 46,53 ---- yc2 = end_time - offsets[i] * oneDay + # print "yc12 ",yc1,yc2 + cc = mythdb.cursor() ! #note: includes overlap; should instead include margin of TOLERANCE # fixme: uid cc.execute("""SELECT starttime, endtime, title, lower(left(title,31)) FROM program *************** *** 67,123 **** if row == None: break; ! tuple = { "starttime":row[0], "endtime":row[1], "title":row[2], "uid":row[3] } tmp.append(tuple) cc.close() bca.append(tmp) ! print "in this tmp ",len(tmp) return bca def saveSerie(mythdb, bc): ! print "serie: ",len(bc) ! for i in bc: ! print i["starttime"],i["uid"] def matchEpisodes(a, b, delta, day_offset): a_st = a["starttime"] b_st = b["starttime"] ! margin_low = b_st - delta + day_offset; ! margin_high = b_st + delta + day_offset; if not (a_st > margin_low and a_st < margin_high): return None a_et = a["endtime"] b_et = b["endtime"] ! margin_low = b_et - delta + day_offset ! margin_high = b_et + delta + day_offset if not (a_et > margin_low and a_et < margin_high): return None ! if a["uid"] == b["uid"]: #fixme: move forward ! devi = (b_st + 0.5*(b_et - b_st)) - (a_st + 0.5*(a_et-a_st)) + day_offset ! return [b, devi] ! return None ! def findSerieInDay(master, candidates, day_offset): ! best = None ! besti = -1 for i in range(len(candidates)): c = candidates[i] if c == None: continue; ! r = matchEpisodes(master, c, TOLERANCE, day_offset) ! if r != None and (best == None or r[1] < best[1]): ! best = r ! besti = i ! if best != None: ! print "found match for ",master,"->",best[0] ! candidates[besti] = None ! return best[0] return None --- 59,208 ---- if row == None: break; ! tuple = { "starttime":row[0], "endtime":row[1], "title":row[2], "uid":row[3], "chanid":chanid } tmp.append(tuple) cc.close() bca.append(tmp) ! # print "in this tmp ",len(tmp) return bca + def findSeriesFor(mythdb, bc): + + cc = mythdb.cursor() + cc.execute("SELECT id FROM Serie WHERE chanid=%s AND starttime=%s", (bc["chanid"],bc["starttime"])) + row = cc.fetchone() + if row == None or row[0] == None: + cc.close() + return None + sid = row[0] + cc.close() + + cc = mythdb.cursor() + cc.execute("SELECT chanid,starttime,id FROM Serie WHERE id=%s", (sid)) + return cc + + def saveSerie(mythdb, bc): ! global s_nextSeriesID ! ! # print "serie: ",len(bc) ! # for i in bc: ! # print i["starttime"],i["uid"] ! ! # check if part of existing series ! sid = -1 ! for i in range(len(bc)): ! if bc[i] == None: ! continue ! cc = findSeriesFor(mythdb, bc[i]) ! if cc == None: ! continue ! #note: cc will have at least one row ! if sid == -1: ! row = cc.fetchone() ! assert row != None and row[2] != None ! # Current string element (bc[i]) is part of ! # an existing string. Save serie id. ! # print 's', ! bc[i] = None ! sid = row[2] ! while 1: ! row = cc.fetchone() ! if row == None: ! break ! # print 's', ! # Check if any following elements of current string ! # already belong to the existing string; ! # if so, mark elements (null). ! for j in range(i+1,len(bc)): ! if bc[j] != None and row[0] == bc[j]["chanid"] and row[1] == bc[j]["starttime"]: ! bc[j] = None ! else: ! # Previous element(s) of the current string have already been ! # assigned to an existing serie string. ! # The current string element belongs to another existing serie ! # string though, so re-assign the 2nd existing string with ! # the 1st string's id, thereby merging them. ! while 1: ! row = cc.fetchone() ! if row == None: ! break ! bc[i] = None ! if row[2] != sid: ! # print 'M', ! uc = mythdb.cursor() ! uc.execute("UPDATE Serie SET id=%s WHERE chanid=%s AND starttime=%s", ! (sid,row[0],row[1])) ! uc.close() ! # else: ! # print 'c', ! cc.close() ! ! if sid != -1: ! # merge with existing string of series ! for i in bc: ! if i == None: ! continue ! # print 'm', ! ic = mythdb.cursor() ! ic.execute("INSERT INTO Serie (chanid,starttime,id) VALUES (%s,%s,%s)", ! (i["chanid"],i["starttime"],sid)) ! ic.close() ! else: ! # instantiate new string of series ! sid = s_nextSeriesID ! s_nextSeriesID = s_nextSeriesID + 1 ! for i in bc: ! # print 'a', ! ic = mythdb.cursor() ! ic.execute("INSERT INTO Serie (chanid,starttime,id) VALUES (%s,%s,%s)", ! (i["chanid"],i["starttime"],sid)) ! ic.close() ! # print "ok" ! return def matchEpisodes(a, b, delta, day_offset): + + if a["uid"] != b["uid"] or a == b: + return None a_st = a["starttime"] b_st = b["starttime"] ! margin_low = b_st + (day_offset - delta) * oneDay ! margin_high = b_st + (day_offset + delta) * oneDay ! ! # print "margin for ",a ! # print " is ",margin_low, margin_high ! # print "based on ",b ! if not (a_st > margin_low and a_st < margin_high): return None a_et = a["endtime"] b_et = b["endtime"] ! margin_low = b_et + (day_offset - delta) * oneDay ! margin_high = b_et + (day_offset + delta) * oneDay if not (a_et > margin_low and a_et < margin_high): return None ! devi = (b_st + 0.5*(b_et - b_st)) - (a_st + 0.5*(a_et-a_st)) + day_offset * oneDay ! return math.fabs(float(devi)) def findSerieInDay(master, candidates, day_offset): ! best_d = None for i in range(len(candidates)): c = candidates[i] if c == None: continue; ! d = matchEpisodes(master, c, TOLERANCE, day_offset) ! if d != None and (best_d == None or d < best_d): ! best_d = d ! best_i = i ! if best_d != None: ! # print "found match for ",master,"->",candidates[best_i], "devi",best_d ! return best_i return None *************** *** 136,143 **** # try finding a similar broadcast the previous day/week for k in range(i+1, len(bca)): ! f = findSerieInDay(m, bca[k], day_offset[k] - day_offset[i]); ! if f != None: ! v.append(f) if len(v) > 1: saveSerie(mythdb, v) return --- 221,230 ---- # try finding a similar broadcast the previous day/week for k in range(i+1, len(bca)): ! x = findSerieInDay(m, bca[k], day_offset[k] - day_offset[i]); ! if x != None: ! v.append(bca[k][x]) ! bca[k][x] = None if len(v) > 1: + bca[i][j] = None saveSerie(mythdb, v) return *************** *** 180,194 **** mythdb = MySQLdb.connect(host="bender", user="mythtv", passwd="mythtv", db="mythconverg") ! day_offset = 0 ! day_count = 5 ! week_count = 3 ! week_day_count = 1 ! c1 = mx.DateTime.today() ! c1 = c1 + day_offset * oneDay c2 = c1 + oneDay cu=mythdb.cursor() cu.execute("SELECT chanid FROM channel WHERE visible=1") --- 267,314 ---- + mythdb = MySQLdb.connect(host="bender", user="mythtv", passwd="mythtv", db="mythconverg") ! cc=mythdb.cursor() ! cc.execute("SELECT MAX(id),MAX(starttime) FROM Serie") ! row = cc.fetchone() ! if row != None and row[0] != None: ! s_nextSeriesID = row[0] + 1 ! endtime = row[1] ! else: ! s_nextSeriesID = 1 ! endtime = mx.DateTime.today() - 14 ! cc.close() ! cc=mythdb.cursor() ! cc.execute("SELECT MAX(starttime) FROM program") ! row = cc.fetchone() ! if row != None and row[0] != None: ! starttime = row[0] ! else: ! starttime = mx.DateTime.today() ! cc.close() ! ! ! ! #day_offset = 0 ! #day_count = 5 ! #week_count = 4 ! #week_day_count = 1 ! ! #c1 = mx.DateTime.today() ! #c1 = c1 + day_offset * oneDay ! ! c1 = mx.DateTime.Date(starttime.year, starttime.month, starttime.day) c2 = c1 + oneDay + day_count = (starttime - endtime).day + 1 + if day_count < 4: + day_count = 4 + week_count = 4 + week_day_count = day_count + + # print "daycount ",day_count, "c1",c1 + cu=mythdb.cursor() cu.execute("SELECT chanid FROM channel WHERE visible=1") Index: myth.sql =================================================================== RCS file: /cvsroot/wepg/mythcond/myth.sql,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** myth.sql 7 Aug 2004 18:52:52 -0000 1.3 --- myth.sql 8 Aug 2004 14:38:12 -0000 1.4 *************** *** 31,33 **** --- 31,41 ---- ); + DROP TABLE IF EXISTS Serie; + CREATE TABLE Serie ( + chanid int(11) NOT NULL, + starttime datetime NOT NULL, + id int(11) NOT NULL, + PRIMARY KEY (chanid,starttime,id) + ); + |
|
From: Leon v. S. <le...@us...> - 2004-08-08 14:38:21
|
Update of /cvsroot/wepg/mythcond/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28741/src Modified Files: wepgsync.C Log Message: ok Index: wepgsync.C =================================================================== RCS file: /cvsroot/wepg/mythcond/src/wepgsync.C,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wepgsync.C 7 Aug 2004 18:53:50 -0000 1.4 --- wepgsync.C 8 Aug 2004 14:38:12 -0000 1.5 *************** *** 112,115 **** --- 112,116 ---- unsigned long getRecId() const { return m_recId; } + long getRecStatus() const { return m_recStatus; } protected: *************** *** 540,544 **** //////// ! dlp_DeleteRecord(pilot_socket, palmdb.getHandle(), 1, (recordid_t) 0); //////// --- 541,545 ---- //////// ! //dlp_DeleteRecord(pilot_socket, palmdb.getHandle(), 1, (recordid_t) 0); //////// *************** *** 675,678 **** --- 676,680 ---- errprintf( "Query failed (%s)\n%s\n", mysql_error(hostdb), sql ); return 1; + } if (rs == NULL) { *************** *** 710,717 **** sprintf( sql2, "UPDATE UserBroadcast " ! "SET rec_id=%lu " "WHERE user_id=%i AND starttime="DLIM"%s"DLIM" and chanid=%i", ! newid, hostuser.getInternalId(), --- 712,719 ---- sprintf( sql2, "UPDATE UserBroadcast " ! "SET rec_id=%lu,rec_status=%i " "WHERE user_id=%i AND starttime="DLIM"%s"DLIM" and chanid=%i", ! newid, STATUS_NONE, hostuser.getInternalId(), *************** *** 721,724 **** --- 723,757 ---- mymysql_exec( hostdb, sql2 ); } + else if (intrec.getRecStatus() == STATUS_UPDATE) { + // record modified on host + + retval = dlp_WriteRecord( + pilot_socket, + palmdb.getHandle(), + 0, //flags + intrec.getRecId(), + 0, //cat + (void*) intrec.getPacked(), + intrec.getPackedSize(), + NULL ); + if ( retval < 0 ) { + errprintf( "error updating record, %i\n", retval ); + return retval; + } + // update status + char sql2[1024]; + sprintf( sql2, + "UPDATE UserBroadcast " + "SET rec_status=%i " + "WHERE user_id=%i AND starttime="DLIM"%s"DLIM" and chanid=%i", + + STATUS_NONE, + + hostuser.getInternalId(), + (const char*)intrec.getStartTimeStr(), + (int)intrec.getStationId() + 1000 //HACK + ); + mymysql_exec( hostdb, sql2 ); + } } *************** *** 809,812 **** --- 842,846 ---- char user_id_buf[ 16+1 ]; bool new_user_id = false; + const char* user_id; |
|
From: Leon v. S. <le...@us...> - 2004-08-07 18:53:59
|
Update of /cvsroot/wepg/mythcond/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5990/src Modified Files: PalmAppInfo.C wepgsync.C Log Message: ok Index: wepgsync.C =================================================================== RCS file: /cvsroot/wepg/mythcond/src/wepgsync.C,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wepgsync.C 3 Aug 2004 17:15:25 -0000 1.3 --- wepgsync.C 7 Aug 2004 18:53:50 -0000 1.4 *************** *** 215,219 **** int f = atol( row[ mysql_field_index( rs, "flags" ) ] ); ! // if (row[ mysql_field_index( rs, "willrecord" ) ] != NULL) f |= FLAG_SYSRECORD; if (row[ mysql_field_index( rs, "isrecorded" ) ] != NULL) f |= FLAG_RECORDED; m_storage.flags.watched = (f & FLAG_WATCHED) != 0; --- 215,219 ---- int f = atol( row[ mysql_field_index( rs, "flags" ) ] ); ! if (row[ mysql_field_index( rs, "willrecord" ) ] != NULL) f |= FLAG_SYSRECORD; if (row[ mysql_field_index( rs, "isrecorded" ) ] != NULL) f |= FLAG_RECORDED; m_storage.flags.watched = (f & FLAG_WATCHED) != 0; *************** *** 410,414 **** char sql[1024]; sprintf( sql, ! "UPDATE wepgbc " "SET user_rating=%i, flags=%i, rec_status=%i " "WHERE user_id=%i AND rec_id=%lu", --- 410,414 ---- char sql[1024]; sprintf( sql, ! "UPDATE UserBroadcast " "SET user_rating=%i, flags=%i, rec_status=%i " "WHERE user_id=%i AND rec_id=%lu", *************** *** 465,469 **** sprintf( sql, "SELECT rec_id " ! "FROM wepgbc " "WHERE %s", cond --- 465,469 ---- sprintf( sql, "SELECT rec_id " ! "FROM UserBroadcast " "WHERE %s", cond *************** *** 498,502 **** // archive all sprintf( sql, ! "UPDATE wepgbc " "SET archived='Y' " "WHERE %s", --- 498,502 ---- // archive all sprintf( sql, ! "UPDATE UserBroadcast " "SET archived='Y' " "WHERE %s", *************** *** 538,541 **** --- 538,546 ---- } + + //////// + dlp_DeleteRecord(pilot_socket, palmdb.getHandle(), 1, (recordid_t) 0); + //////// + retval = dlp_CleanUpDatabase( pilot_socket, palmdb.getHandle() ); if ( retval < 0 ) *************** *** 577,581 **** sprintf( sql, "SELECT rec_id " ! "FROM wepgbc " "WHERE user_id=%i AND rec_id=%lu", (int)hostuser.getInternalId(), --- 582,586 ---- sprintf( sql, "SELECT rec_id " ! "FROM UserBroadcast " "WHERE user_id=%i AND rec_id=%lu", (int)hostuser.getInternalId(), *************** *** 634,660 **** MYSQL_ROW row; ! char sql[1024]; ! //first seed wepgbc with any new programs; dups will be avoided via PK sprintf(sql, ! "INSERT INTO wepgbc (user_id,chanid,starttime)" "SELECT %i,chanid,starttime FROM program WHERE starttime>="DLIM"%s"DLIM" ", hostuser.getInternalId(), threshold.getPast() ); ! mymysql_exec( hostdb, sql ); ! ! //table 'record' does not contain what i thought.. ! // "LEFT JOIN record ON (program.chanid=record.chanid AND UNIX_TIMESTAMP(program.starttime)=UNIX_TIMESTAMP(record.startdate)+TIME_TO_SEC(record.starttime)) " ! //select programs sprintf( sql, ! "SELECT program.chanid,program.starttime,program.endtime,program.title,program.category,CONCAT(program.subtitle,';',program.description) AS info," ! "wepgbc.rec_id,wepgbc.rec_status,wepgbc.flags,wepgbc.system_rating,wepgbc.user_rating," ! "recorded.chanid AS isrecorded " ! "FROM program INNER JOIN wepgbc ON (program.chanid=wepgbc.chanid AND program.starttime=wepgbc.starttime) " "LEFT JOIN recorded ON (program.chanid=recorded.chanid AND program.starttime=recorded.starttime) " ! "WHERE " ! "user_id=%i AND archived='N' AND wepgbc.starttime>"DLIM"%s"DLIM" AND wepgbc.starttime<="DLIM"%s"DLIM" ", hostuser.getInternalId(), threshold.getPast(), --- 639,671 ---- MYSQL_ROW row; ! char sql[4096]; ! //first seed UserBroadcast with any new programs; dups will be avoided via PK sprintf(sql, ! "INSERT INTO UserBroadcast (user_id,chanid,starttime) " "SELECT %i,chanid,starttime FROM program WHERE starttime>="DLIM"%s"DLIM" ", hostuser.getInternalId(), threshold.getPast() ); + // mymysql_exec( hostdb, sql ); ! ! // enum RecordingType{ kNotRecording = 0, kSingleRecord = 1, ! // kTimeslotRecord 2, kChannelRecord 3, kAllRecord 4, kWeekslotRecord 5, ! // kFindOneRecord, kOverrideRecord, kDontRecord}; ! //select programs sprintf( sql, ! "SELECT DISTINCT program.chanid,program.starttime,program.endtime,program.title,program.category,CONCAT(program.subtitle,';',program.description) AS info," ! "UserBroadcast.rec_id,UserBroadcast.rec_status,UserBroadcast.flags,UserBroadcast.system_rating,UserBroadcast.user_rating," ! "record.title AS willrecord, recorded.chanid AS isrecorded " ! "FROM program INNER JOIN channel ON (program.chanid=channel.chanid) " ! "INNER JOIN UserBroadcast ON (program.chanid=UserBroadcast.chanid AND program.starttime=UserBroadcast.starttime) " "LEFT JOIN recorded ON (program.chanid=recorded.chanid AND program.starttime=recorded.starttime) " ! "LEFT JOIN record ON (program.title=record.title AND (record.type=4 OR " ! "(record.station=channel.callsign AND (record.type=3 OR " ! "(TIME_TO_SEC(record.starttime)=TIME_TO_SEC(program.starttime) AND (record.type=2 OR " ! "(DAYOFWEEK(record.startdate)=DAYOFWEEK(program.starttime) AND record.type=5))))))) " ! "WHERE channel.visible=1 AND " ! "user_id=%i AND archived='N' AND UserBroadcast.starttime>"DLIM"%s"DLIM" AND UserBroadcast.starttime<="DLIM"%s"DLIM" ", hostuser.getInternalId(), threshold.getPast(), *************** *** 665,671 **** return 1; } ! while( (row = mysql_fetch_row(rs)) != NULL ) { IntermedRec intrec; intrec.init( appinfo, hostdb, rs, row ); --- 676,688 ---- return 1; } ! if (rs == NULL) { ! logprintf("no bcs\n"); ! return 1; ! } ! while( (row = mysql_fetch_row(rs)) != NULL ) { + printf("row %s %s %s %s\n", row[0], row[1], row[2], row[3]); + IntermedRec intrec; intrec.init( appinfo, hostdb, rs, row ); *************** *** 692,696 **** char sql2[1024]; sprintf( sql2, ! "UPDATE wepgbc " "SET rec_id=%lu " "WHERE user_id=%i AND starttime="DLIM"%s"DLIM" and chanid=%i", --- 709,713 ---- char sql2[1024]; sprintf( sql2, ! "UPDATE UserBroadcast " "SET rec_id=%lu " "WHERE user_id=%i AND starttime="DLIM"%s"DLIM" and chanid=%i", *************** *** 757,761 **** TimeThreshold threshold( hostuser ); ! retval = saveModified( pilot_socket, hostdb, palmdb, hostuser ); if ( retval != 0 ) { --- 774,778 ---- TimeThreshold threshold( hostuser ); ! printf("savemod\n"); retval = saveModified( pilot_socket, hostdb, palmdb, hostuser ); if ( retval != 0 ) { *************** *** 763,767 **** return retval; } ! retval = archiveOldRecs( pilot_socket, hostdb, palmdb, hostuser, threshold ); if ( retval != 0 ) { --- 780,784 ---- return retval; } ! printf("archive\n"); retval = archiveOldRecs( pilot_socket, hostdb, palmdb, hostuser, threshold ); if ( retval != 0 ) { *************** *** 769,773 **** return retval; } ! retval = remoteRecSanityCheck( pilot_socket, hostdb, palmdb, hostuser ); if ( retval != 0 ) { --- 786,790 ---- return retval; } ! printf("remoterec\n"); retval = remoteRecSanityCheck( pilot_socket, hostdb, palmdb, hostuser ); if ( retval != 0 ) { *************** *** 775,779 **** return retval; } ! retval = loadNewBcs( pilot_socket, hostdb, palmdb, hostuser, threshold, palmappinfo ); if ( retval != 0 ) { --- 792,796 ---- return retval; } ! printf("loadnew\n"); retval = loadNewBcs( pilot_socket, hostdb, palmdb, hostuser, threshold, palmappinfo ); if ( retval != 0 ) { *************** *** 781,785 **** return retval; } ! return 0; } --- 798,802 ---- return retval; } ! printf("ret0\n"); return 0; } Index: PalmAppInfo.C =================================================================== RCS file: /cvsroot/wepg/mythcond/src/PalmAppInfo.C,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PalmAppInfo.C 3 Aug 2004 17:15:25 -0000 1.3 --- PalmAppInfo.C 7 Aug 2004 18:53:50 -0000 1.4 *************** *** 98,102 **** sprintf( sql, "SELECT chanid,callsign,channum " ! "FROM channel " ); --- 98,102 ---- sprintf( sql, "SELECT chanid,callsign,channum " ! "FROM channel WHERE visible=1 ORDER BY channum" ); |
|
From: Leon v. S. <le...@us...> - 2004-08-07 18:53:00
|
Update of /cvsroot/wepg/mythcond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5879 Modified Files: myth.sql Added Files: serie.py Log Message: ok --- NEW FILE: serie.py --- # mythcond - a pilot-link conduit for wepg # Copyright (C) 2004 Leon van Stuivenberg <l.v...@ch...> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import MySQLdb import random import string import time import os.path import socket import sys import tempfile import mx # defines; flags: true = 1==1 false = not true #oneDay = mx.RelativeDateTime.oneDay oneDay = 1 # fixme: too large, but allows shifts between DST and noDST this way. TOLERANCE = 3.0/24 def mux(a,b,c): if a: return b return c def loadBroadcasts(mythdb, chanid, start_time, end_time, base_day_offset, day_offset, count, offsets): offsets.extend( range(base_day_offset, base_day_offset + count * day_offset, day_offset) ) print "loading off",offsets bca = [] for i in range(count): yc1 = start_time - offsets[i] * oneDay yc2 = end_time - offsets[i] * oneDay cc = mythdb.cursor() #note: includes overlap # fixme: uid cc.execute("""SELECT starttime, endtime, title, lower(left(title,31)) FROM program WHERE chanid=%s AND starttime<%s AND endtime>%s ORDER BY starttime""", (chanid, yc2, yc1)) tmp = [] while 1: row = cc.fetchone() if row == None: break; tuple = { "starttime":row[0], "endtime":row[1], "title":row[2], "uid":row[3] } tmp.append(tuple) cc.close() bca.append(tmp) print "in this tmp ",len(tmp) return bca def saveSerie(mythdb, bc): print "serie: ",len(bc) for i in bc: print i["starttime"],i["uid"] def matchEpisodes(a, b, delta, day_offset): a_st = a["starttime"] b_st = b["starttime"] margin_low = b_st - delta + day_offset; margin_high = b_st + delta + day_offset; if not (a_st > margin_low and a_st < margin_high): return None a_et = a["endtime"] b_et = b["endtime"] margin_low = b_et - delta + day_offset margin_high = b_et + delta + day_offset if not (a_et > margin_low and a_et < margin_high): return None if a["uid"] == b["uid"]: #fixme: move forward devi = (b_st + 0.5*(b_et - b_st)) - (a_st + 0.5*(a_et-a_st)) + day_offset return [b, devi] return None def findSerieInDay(master, candidates, day_offset): best = None besti = -1 for i in range(len(candidates)): c = candidates[i] if c == None: continue; r = matchEpisodes(master, c, TOLERANCE, day_offset) if r != None and (best == None or r[1] < best[1]): best = r besti = i if best != None: print "found match for ",master,"->",best[0] candidates[besti] = None return best[0] return None def findSerieStrings(mythdb, bca, day_offset): # for each day (except last) for i in range(0, len(bca)-1): # for each broadcast that day for j in range(0, len(bca[i])): m = bca[i][j] if m == None: # already assigned to a serie continue v = [m] # try finding a similar broadcast the previous day/week for k in range(i+1, len(bca)): f = findSerieInDay(m, bca[k], day_offset[k] - day_offset[i]); if f != None: v.append(f) if len(v) > 1: saveSerie(mythdb, v) return def findSeries2(mythdb, chanid, start_time, end_time, day_count, week_count, week_day_count): # Consecutive days. # find broadcasts that repeat daily on the current station. # 1. per day a list of broadcasts: # # [now] [yesterday] [now-2days] ... [now-(daycount-1)] # {bc, {bc, {bc, { { # bc, bc, bc, . . # bc, bc bc, . . # bc, } bc, . } # bc bc, } # } bc # } # # 2. for each available bc in these arrays, check if on previous day(s) it was also on. # 3. if a 'string' of bcs is found, save as a series, and mark the bcs unavailable # by setting the array element to null. # # note: to catch series that skip the weekend, use a day_count >3. offsets = [] bcs = loadBroadcasts(mythdb, chanid, start_time, end_time, 0, 1, day_count, offsets) findSerieStrings(mythdb, bcs, offsets) # if this runs every day, it's sufficient if week_day_count ==1. # otherwise, also weekly bcs that were on yesterday (and further back) # should be checked. for i in range(week_day_count): offsets = [] bcs = loadBroadcasts(mythdb, chanid, start_time, end_time, i, 7, week_count, offsets) findSerieStrings(mythdb, bcs, offsets) return mythdb = MySQLdb.connect(host="bender", user="mythtv", passwd="mythtv", db="mythconverg") day_offset = 0 day_count = 5 week_count = 3 week_day_count = 1 c1 = mx.DateTime.today() c1 = c1 + day_offset * oneDay c2 = c1 + oneDay cu=mythdb.cursor() cu.execute("SELECT chanid FROM channel WHERE visible=1") while 1: row = cu.fetchone() if row == None: break; chanid = row[0] print "processing channel ",chanid findSeries2(mythdb, chanid, c1, c2, day_count, week_count, week_day_count) cu.close() mythdb.close() print "done." Index: myth.sql =================================================================== RCS file: /cvsroot/wepg/mythcond/myth.sql,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** myth.sql 3 Aug 2004 17:15:25 -0000 1.2 --- myth.sql 7 Aug 2004 18:52:52 -0000 1.3 *************** *** 11,16 **** ); ! DROP TABLE IF EXISTS wepgbc; ! CREATE TABLE wepgbc ( user_id int(11) NOT NULL, chanid int(11) NOT NULL, --- 11,16 ---- ); ! DROP TABLE IF EXISTS UserBroadcast; ! CREATE TABLE UserBroadcast ( user_id int(11) NOT NULL, chanid int(11) NOT NULL, *************** *** 22,28 **** rec_id int(11) NOT NULL default '0', rec_status int(11) default '0', PRIMARY KEY (user_id,chanid,starttime), ! KEY wepgbc_archived (archived), ! KEY wepgbc_rec_id (rec_id) ); --- 22,32 ---- rec_id int(11) NOT NULL default '0', rec_status int(11) default '0', + uid varchar(31), + orgtitle varchar(128), + category varchar(63), PRIMARY KEY (user_id,chanid,starttime), ! KEY ub_archived (archived), ! KEY ub_rec_id (rec_id), ! KEY ub_uid (uid) ); |
Update of /cvsroot/wepg/pcond/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30803/src Modified Files: PalmAppInfo.C wepgsync.C Removed Files: GenErr.h HostUser.C HostUser.h PalmAppInfo.h PalmDB.C PalmDB.h wepgstruct.h Log Message: ok --- HostUser.h DELETED --- Index: wepgsync.C =================================================================== RCS file: /cvsroot/wepg/pcond/src/wepgsync.C,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** wepgsync.C 28 Nov 2003 17:36:13 -0000 1.1.1.1 --- wepgsync.C 3 Aug 2004 17:15:49 -0000 1.2 *************** *** 21,25 **** #include "PalmAppInfo.h" #include "wepgutil.h" ! #include "GenErr.h" #include <time.h> --- 21,26 ---- #include "PalmAppInfo.h" #include "wepgutil.h" ! #include "RecIDList.h" ! #include "TimeThreshold.h" #include <time.h> *************** *** 64,249 **** - class RecIdList - { - public: - RecIdList(); - ~RecIdList(); - - long load( int pilot_socket, PalmDB& palmdb ); - - int getLength() const { return m_length; } - - recordid_t getId( int index ) const; - - bool contains( recordid_t id ) const; - - protected: - int m_length; - recordid_t* m_ids; - }; - - - RecIdList::RecIdList() - { - m_length = 0; - m_ids = NULL; - } - - - RecIdList::~RecIdList() - { - if ( m_ids != NULL ) - delete[] m_ids; - } - - - long - RecIdList::load( int pilot_socket, PalmDB& palmdb ) - { - long retval; - - int numrecs = 0; - retval = dlp_ReadOpenDBInfo( - pilot_socket, - palmdb.getHandle(), - &numrecs ); - if ( retval < 0 ) { - errprintf( "ReadOpenDBInfo failed, %li\n", retval ); - return retval; - } - - m_length = numrecs; - if ( m_length == 0 ) - return 0; - if ( m_ids != NULL ) - delete[] m_ids; - - m_ids = new recordid_t[ m_length ]; - if ( m_ids == NULL ) { - errprintf( "out of mem\n" ); - return 1; - } - - int total = 0; - while (total < m_length) { - int count = 0; - retval = dlp_ReadRecordIDList( - pilot_socket, - palmdb.getHandle(), - 0, // sort - total, // start - m_length - total, //max - m_ids + total, - &count ); - if ( retval < 0 ) { - errprintf( "ReadRecordIDList failed, %li\n", retval ); - return retval; - } - total += count; - - if (count == 0) { - errprintf( "ReadRecordIDList, got %i out of %i\n", count, m_length); - return 1; - } - } - return 0; - } - - - recordid_t - RecIdList::getId( int index ) const - { - if ( (index < 0) || (index >= m_length) ) - return 0; - return m_ids[ index ]; - } - - - bool - RecIdList::contains( recordid_t id ) const - { - for ( int i=0; i<m_length; i++ ) - if ( id == getId( i ) ) - return true; - return false; - } - - - /////////////////////////////////////////////////////////////////////////////// - - - class TimeThreshold - { - public: - TimeThreshold( HostUser& hostuser ); - - const char* getPast() const { return m_pastStr; } - const char* getFuture() const { return m_futureStr; } - - protected: - - char m_pastStr[32]; - char m_futureStr[32]; - - private: - void printTime( struct tm* t, char* dst ); - - }; - - - TimeThreshold::TimeThreshold( HostUser& hostuser ) - { - int enddayGMT_hour = hostuser.getDayEndHourGMT(); - int enddayGMT_min = hostuser.getDayEndMinuteGMT(); - - time_t nowtime; - struct tm nowgmt; - struct tm thresholdgmt; - - //win32 _tzset(); - - time( &nowtime ); - - nowgmt = *gmtime( &nowtime ); - thresholdgmt = nowgmt; - - - thresholdgmt.tm_hour = enddayGMT_hour; - thresholdgmt.tm_min = enddayGMT_min; - thresholdgmt.tm_sec = 0; - - time_t thresholdgmt_time = mktime( &thresholdgmt ); - - if ( difftime( thresholdgmt_time, nowtime ) >= 0.0 ) { - thresholdgmt_time -= 60*60*24; // go back a day - thresholdgmt = *gmtime( &thresholdgmt_time ); - } - - printTime( &thresholdgmt, m_pastStr ); - - thresholdgmt_time += 60*60*24; - thresholdgmt = *gmtime( &thresholdgmt_time ); - - printTime( &thresholdgmt, m_futureStr ); - } - - - void - TimeThreshold::printTime( struct tm* t, char* dst ) - { - sprintf( dst, "%04i-%02i-%02i %02i:%02i:%02i", - t->tm_year + 1900, - t->tm_mon+1, - t->tm_mday, - t->tm_hour, - t->tm_min, - t->tm_sec - ); - } - - - /////////////////////////////////////////////////////////////////////////////// - - static void swapToPalm( WepgDBPackedRec* pac ) --- 65,68 ---- *************** *** 484,488 **** if ( uLen < strlen(buf)+1 ) ! return GEN_ERR_BUFFER_TOO_SMALL; strcpy( userid, buf ); --- 303,307 ---- if ( uLen < strlen(buf)+1 ) ! return -1; strcpy( userid, buf ); *************** *** 610,614 **** logprintf("wepg: archiving old recs\n"); ! RecIdList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) --- 429,433 ---- logprintf("wepg: archiving old recs\n"); ! RecIDList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) *************** *** 713,717 **** { int retval; ! RecIdList idlist; logprintf("wepg: remoteRecSanityCheck\n"); --- 532,536 ---- { int retval; ! RecIDList idlist; logprintf("wepg: remoteRecSanityCheck\n"); *************** *** 777,781 **** int retval; ! RecIdList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) --- 596,600 ---- int retval; ! RecIDList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) *************** *** 974,978 **** ) ) { errprintf( "connect to db failed\n%s\n\n",mysql_error(&mysql) ); ! return GEN_ERR_UNABLE_TO_OPEN_FILE; } --- 793,797 ---- ) ) { errprintf( "connect to db failed\n%s\n\n",mysql_error(&mysql) ); ! return -1; } --- PalmAppInfo.h DELETED --- --- PalmDB.C DELETED --- --- HostUser.C DELETED --- --- GenErr.h DELETED --- --- PalmDB.h DELETED --- Index: PalmAppInfo.C =================================================================== RCS file: /cvsroot/wepg/pcond/src/PalmAppInfo.C,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PalmAppInfo.C 28 Nov 2003 17:36:13 -0000 1.1.1.1 --- PalmAppInfo.C 3 Aug 2004 17:15:49 -0000 1.2 *************** *** 18,22 **** #include "PalmAppInfo.h" #include "wepgutil.h" - #include "GenErr.h" #include "wepginc.h" #include <stdlib.h> --- 18,21 ---- *************** *** 216,219 **** --- 215,219 ---- m_storage.day_end_hour = hostuser.getDayEndHour(); m_storage.day_end_min = hostuser.getDayEndMinute(); + m_storage.load_ahead = hostuser.getLoadAhead(); return 0; --- wepgstruct.h DELETED --- |
|
From: Leon v. S. <le...@us...> - 2004-08-03 17:15:58
|
Update of /cvsroot/wepg/pcond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30803 Modified Files: Makefile Log Message: ok Index: Makefile =================================================================== RCS file: /cvsroot/wepg/pcond/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 29 Jul 2004 15:58:26 -0000 1.2 --- Makefile 3 Aug 2004 17:15:49 -0000 1.3 *************** *** 5,9 **** PISOCK_LIBS = -lpisock ! COPTS = -Wall -O2 -I../common CFLAGS += $(COPTS) $(MYSQL_CFLAGS) $(PISOCK_CFLAGS) --- 5,9 ---- PISOCK_LIBS = -lpisock ! COPTS = -Wall -O2 -I../common -Isrc CFLAGS += $(COPTS) $(MYSQL_CFLAGS) $(PISOCK_CFLAGS) *************** *** 19,23 **** wepgcn.o \ wepgsync.o \ ! wepgutil.o pwepg: $(OBJS) Makefile --- 19,25 ---- wepgcn.o \ wepgsync.o \ ! wepgutil.o \ ! RecIDList.o \ ! TimeThreshold.o pwepg: $(OBJS) Makefile |
Update of /cvsroot/wepg/mythcond/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30727/src Modified Files: PalmAppInfo.C wepgsync.C Removed Files: GenErr.h HostUser.C HostUser.h PalmAppInfo.h PalmDB.C PalmDB.h wepgstruct.h Log Message: ok --- HostUser.h DELETED --- Index: wepgsync.C =================================================================== RCS file: /cvsroot/wepg/mythcond/src/wepgsync.C,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wepgsync.C 29 Jul 2004 16:00:33 -0000 1.2 --- wepgsync.C 3 Aug 2004 17:15:25 -0000 1.3 *************** *** 21,25 **** #include "PalmAppInfo.h" #include "wepgutil.h" ! #include "GenErr.h" #include <time.h> --- 21,26 ---- #include "PalmAppInfo.h" #include "wepgutil.h" ! #include "RecIDList.h" ! #include "TimeThreshold.h" #include <time.h> *************** *** 71,255 **** - /////////////////////////////////////////////////////////////////////////////// - - - class RecIdList - { - public: - RecIdList(); - ~RecIdList(); - - long load( int pilot_socket, PalmDB& palmdb ); - - int getLength() const { return m_length; } - - recordid_t getId( int index ) const; - - bool contains( recordid_t id ) const; - - protected: - int m_length; - recordid_t* m_ids; - }; - - - RecIdList::RecIdList() - { - m_length = 0; - m_ids = NULL; - } - - - RecIdList::~RecIdList() - { - if ( m_ids != NULL ) - delete[] m_ids; - } - - - long - RecIdList::load( int pilot_socket, PalmDB& palmdb ) - { - long retval; - - int numrecs = 0; - retval = dlp_ReadOpenDBInfo( - pilot_socket, - palmdb.getHandle(), - &numrecs ); - if ( retval < 0 ) { - errprintf( "ReadOpenDBInfo failed, %li\n", retval ); - return retval; - } - - m_length = numrecs; - if ( m_length == 0 ) - return 0; - if ( m_ids != NULL ) - delete[] m_ids; - - m_ids = new recordid_t[ m_length ]; - if ( m_ids == NULL ) { - errprintf( "out of mem\n" ); - return 1; - } - - int total = 0; - while (total < m_length) { - int count = 0; - retval = dlp_ReadRecordIDList( - pilot_socket, - palmdb.getHandle(), - 0, // sort - total, // start - m_length - total, //max - m_ids + total, - &count ); - if ( retval < 0 ) { - errprintf( "ReadRecordIDList failed, %li\n", retval ); - return retval; - } - total += count; - - if (count == 0) { - errprintf( "ReadRecordIDList, got %i out of %i\n", count, m_length); - return 1; - } - } - return 0; - } - - - recordid_t - RecIdList::getId( int index ) const - { - if ( (index < 0) || (index >= m_length) ) - return 0; - return m_ids[ index ]; - } - - - bool - RecIdList::contains( recordid_t id ) const - { - for ( int i=0; i<m_length; i++ ) - if ( id == getId( i ) ) - return true; - return false; - } - - - /////////////////////////////////////////////////////////////////////////////// - - - class TimeThreshold - { - public: - TimeThreshold( HostUser& hostuser ); - - const char* getPast() const { return m_pastStr; } - const char* getFuture() const { return m_futureStr; } - - protected: - - char m_pastStr[32]; - char m_futureStr[32]; - - private: - void printTime( struct tm* t, char* dst ); - - }; - - - TimeThreshold::TimeThreshold( HostUser& hostuser ) - { - int enddayGMT_hour = hostuser.getDayEndHourGMT(); - int enddayGMT_min = hostuser.getDayEndMinuteGMT(); - - time_t nowtime; - struct tm nowgmt; - struct tm thresholdgmt; - - //win32 _tzset(); - - time( &nowtime ); - - nowgmt = *gmtime( &nowtime ); - thresholdgmt = nowgmt; - - - thresholdgmt.tm_hour = enddayGMT_hour; - thresholdgmt.tm_min = enddayGMT_min; - thresholdgmt.tm_sec = 0; - - time_t thresholdgmt_time = mktime( &thresholdgmt ); - - if ( difftime( thresholdgmt_time, nowtime ) >= 0.0 ) { - thresholdgmt_time -= 60*60*24; // go back a day - thresholdgmt = *gmtime( &thresholdgmt_time ); - } - - printTime( &thresholdgmt, m_pastStr ); - - thresholdgmt_time += 60*60*24; - thresholdgmt = *gmtime( &thresholdgmt_time ); - - printTime( &thresholdgmt, m_futureStr ); - } - - - void - TimeThreshold::printTime( struct tm* t, char* dst ) - { - sprintf( dst, "%04i-%02i-%02i %02i:%02i:%02i", - t->tm_year + 1900, - t->tm_mon+1, - t->tm_mday, - t->tm_hour, - t->tm_min, - t->tm_sec - ); - } - /////////////////////////////////////////////////////////////////////////////// --- 72,75 ---- *************** *** 395,399 **** int f = atol( row[ mysql_field_index( rs, "flags" ) ] ); ! if (row[ mysql_field_index( rs, "willrecord" ) ] != NULL) f |= FLAG_SYSRECORD; if (row[ mysql_field_index( rs, "isrecorded" ) ] != NULL) f |= FLAG_RECORDED; m_storage.flags.watched = (f & FLAG_WATCHED) != 0; --- 215,219 ---- int f = atol( row[ mysql_field_index( rs, "flags" ) ] ); ! // if (row[ mysql_field_index( rs, "willrecord" ) ] != NULL) f |= FLAG_SYSRECORD; if (row[ mysql_field_index( rs, "isrecorded" ) ] != NULL) f |= FLAG_RECORDED; m_storage.flags.watched = (f & FLAG_WATCHED) != 0; *************** *** 502,506 **** if ( uLen < strlen(buf)+1 ) ! return GEN_ERR_BUFFER_TOO_SMALL; strcpy( userid, buf ); --- 322,326 ---- if ( uLen < strlen(buf)+1 ) ! return -1; strcpy( userid, buf ); *************** *** 632,636 **** logprintf("wepg: archiving old recs\n"); ! RecIdList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) --- 452,456 ---- logprintf("wepg: archiving old recs\n"); ! RecIDList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) *************** *** 663,667 **** recordid_t rec_id = strtoul( row[ mysql_field_index( rs, "rec_id" ) ], NULL, 10 ); ! if ( rec_id != 0 ) for ( int j=0; j<idlist.getLength(); j++ ) { --- 483,487 ---- recordid_t rec_id = strtoul( row[ mysql_field_index( rs, "rec_id" ) ], NULL, 10 ); ! if ( rec_id != 0 ) for ( int j=0; j<idlist.getLength(); j++ ) { *************** *** 717,721 **** } } ! retval = dlp_CleanUpDatabase( pilot_socket, palmdb.getHandle() ); if ( retval < 0 ) --- 537,541 ---- } } ! retval = dlp_CleanUpDatabase( pilot_socket, palmdb.getHandle() ); if ( retval < 0 ) *************** *** 726,732 **** ret: delete[] to_remove; ! return retval; } ! --- 546,553 ---- ret: delete[] to_remove; ! return retval; } ! ! *************** *** 737,741 **** { int retval; ! RecIdList idlist; logprintf("wepg: remoteRecSanityCheck\n"); --- 558,562 ---- { int retval; ! RecIDList idlist; logprintf("wepg: remoteRecSanityCheck\n"); *************** *** 768,772 **** if ( (row = mysql_fetch_row(rs)) == NULL ) { ! logprintf("deleting dangling record %i\n", (int)idlist.getId(i) ); --- 589,593 ---- if ( (row = mysql_fetch_row(rs)) == NULL ) { ! logprintf("deleting dangling record %i\n", (int)idlist.getId(i) ); *************** *** 793,799 **** } } ! return 0; ! } ! static long --- 614,620 ---- } } ! return 0; ! } ! static long *************** *** 803,807 **** int retval; ! RecIdList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) --- 624,628 ---- int retval; ! RecIDList idlist; retval = idlist.load( pilot_socket, palmdb ); if ( retval != 0 ) *************** *** 821,835 **** hostuser.getInternalId(), threshold.getPast() ); mymysql_exec( hostdb, sql ); ! //select programs //FIXME: record.starttime/startdate !! ARGH!@%$# sprintf( sql, "SELECT program.chanid,program.starttime,program.endtime,program.title,program.category,CONCAT(program.subtitle,';',program.description) AS info," "wepgbc.rec_id,wepgbc.rec_status,wepgbc.flags,wepgbc.system_rating,wepgbc.user_rating," ! "record.recordid AS willrecord, recorded.chanid AS isrecorded " ! "FROM program,wepgbc " ! "LEFT JOIN record ON (program.chanid=record.chanid AND program.starttime=record.starttime ) " "LEFT JOIN recorded ON (program.chanid=recorded.chanid AND program.starttime=recorded.starttime) " ! "WHERE program.chanid=wepgbc.chanid AND program.starttime=wepgbc.starttime AND " "user_id=%i AND archived='N' AND wepgbc.starttime>"DLIM"%s"DLIM" AND wepgbc.starttime<="DLIM"%s"DLIM" ", hostuser.getInternalId(), --- 642,659 ---- hostuser.getInternalId(), threshold.getPast() ); + mymysql_exec( hostdb, sql ); ! //table 'record' does not contain what i thought.. ! // "LEFT JOIN record ON (program.chanid=record.chanid AND UNIX_TIMESTAMP(program.starttime)=UNIX_TIMESTAMP(record.startdate)+TIME_TO_SEC(record.starttime)) " ! ! //select programs sprintf( sql, "SELECT program.chanid,program.starttime,program.endtime,program.title,program.category,CONCAT(program.subtitle,';',program.description) AS info," "wepgbc.rec_id,wepgbc.rec_status,wepgbc.flags,wepgbc.system_rating,wepgbc.user_rating," ! "recorded.chanid AS isrecorded " ! "FROM program INNER JOIN wepgbc ON (program.chanid=wepgbc.chanid AND program.starttime=wepgbc.starttime) " "LEFT JOIN recorded ON (program.chanid=recorded.chanid AND program.starttime=recorded.starttime) " ! "WHERE " "user_id=%i AND archived='N' AND wepgbc.starttime>"DLIM"%s"DLIM" AND wepgbc.starttime<="DLIM"%s"DLIM" ", hostuser.getInternalId(), *************** *** 911,915 **** if ( retval != 0 ) { errprintf("wepg: hostuser.save %i\n", retval); - return retval; } --- 735,738 ---- *************** *** 1013,1017 **** ) ) { errprintf( "connect to db failed\n%s\n\n",mysql_error(&mysql) ); ! return GEN_ERR_UNABLE_TO_OPEN_FILE; } --- 836,840 ---- ) ) { errprintf( "connect to db failed\n%s\n\n",mysql_error(&mysql) ); ! return -1; } --- PalmAppInfo.h DELETED --- --- PalmDB.C DELETED --- --- HostUser.C DELETED --- --- GenErr.h DELETED --- --- PalmDB.h DELETED --- Index: PalmAppInfo.C =================================================================== RCS file: /cvsroot/wepg/mythcond/src/PalmAppInfo.C,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PalmAppInfo.C 29 Jul 2004 16:00:33 -0000 1.2 --- PalmAppInfo.C 3 Aug 2004 17:15:25 -0000 1.3 *************** *** 18,22 **** #include "PalmAppInfo.h" #include "wepgutil.h" - #include "GenErr.h" #include "wepginc.h" #include <stdlib.h> --- 18,21 ---- *************** *** 157,161 **** --- 156,162 ---- m_storage.day_end_hour = hostuser.getDayEndHour(); m_storage.day_end_min = hostuser.getDayEndMinute(); + m_storage.load_ahead = hostuser.getLoadAhead(); return 0; } + --- wepgstruct.h DELETED --- |
|
From: Leon v. S. <le...@us...> - 2004-08-03 17:15:33
|
Update of /cvsroot/wepg/mythcond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30727 Modified Files: Makefile myth.sql Log Message: ok Index: Makefile =================================================================== RCS file: /cvsroot/wepg/mythcond/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 29 Jul 2004 16:00:32 -0000 1.2 --- Makefile 3 Aug 2004 17:15:25 -0000 1.3 *************** *** 5,9 **** PISOCK_LIBS = -lpisock ! COPTS = -Wall -O2 -I../common CFLAGS += $(COPTS) $(MYSQL_CFLAGS) $(PISOCK_CFLAGS) --- 5,9 ---- PISOCK_LIBS = -lpisock ! COPTS = -Wall -O2 -I../common -Isrc CFLAGS += $(COPTS) $(MYSQL_CFLAGS) $(PISOCK_CFLAGS) *************** *** 19,23 **** wepgcn.o \ wepgsync.o \ ! wepgutil.o mythwepg: $(OBJS) Makefile --- 19,25 ---- wepgcn.o \ wepgsync.o \ ! wepgutil.o \ ! RecIDList.o \ ! TimeThreshold.o mythwepg: $(OBJS) Makefile Index: myth.sql =================================================================== RCS file: /cvsroot/wepg/mythcond/myth.sql,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** myth.sql 28 Jul 2004 19:02:35 -0000 1.1.1.1 --- myth.sql 3 Aug 2004 17:15:25 -0000 1.2 *************** *** 7,10 **** --- 7,11 ---- view_start int(11) default NULL, day_end int(11) default NULL, + load_ahead int(11) default NULL, PRIMARY KEY (id) ); |
|
From: Leon v. S. <le...@us...> - 2004-08-03 17:15:20
|
Update of /cvsroot/wepg/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30678 Added Files: PalmAppInfo.h PalmDB.C PalmDB.h RecIDList.C RecIDList.h TimeThreshold.C TimeThreshold.h wepgstruct.h Log Message: ok --- NEW FILE: TimeThreshold.h --- /* Copyright (C) 2004 Leon van Stuivenberg <l.v...@ch...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __TIMETHRESHOLD_H #define __TIMETHRESHOLD_H #include "HostUser.h" class TimeThreshold { public: TimeThreshold( HostUser& hostuser ); const char* getPast() const { return m_pastStr; } const char* getFuture() const { return m_futureStr; } protected: char m_pastStr[32]; char m_futureStr[32]; private: void printTime( struct tm* t, char* dst ); }; #endif --- NEW FILE: PalmAppInfo.h --- #ifndef __PalmAppInfo_H #define __PalmAppInfo_H #include <mysql.h> #include "wepgstruct.h" #include "HostUser.h" class PalmAppInfo { public: PalmAppInfo(); int init( int psock, int db_handle ); int load( MYSQL *hostdb, HostUser& hostuser ); const char* getUserId() const; unsigned long getTimeZone() const; void setTimeZone( unsigned long tz ); const WepgAppInfoData* getPacked() const { return &m_storage; } int getPackedSize() const { return sizeof( m_storage ); } protected: WepgAppInfoData m_storage; private: }; #endif --- NEW FILE: RecIDList.C --- /* Copyright (C) 2004 Leon van Stuivenberg <l.v...@ch...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "RecIDList.h" #include "wepgutil.h" RecIDList::RecIDList() { m_length = 0; m_ids = NULL; } RecIDList::~RecIDList() { if ( m_ids != NULL ) delete[] m_ids; } long RecIDList::load( int pilot_socket, PalmDB& palmdb ) { long retval; int numrecs = 0; retval = dlp_ReadOpenDBInfo( pilot_socket, palmdb.getHandle(), &numrecs ); if ( retval < 0 ) { errprintf( "ReadOpenDBInfo failed, %li\n", retval ); return retval; } m_length = numrecs; if ( m_length == 0 ) return 0; if ( m_ids != NULL ) delete[] m_ids; m_ids = new recordid_t[ m_length ]; if ( m_ids == NULL ) { errprintf( "out of mem\n" ); return 1; } int total = 0; while (total < m_length) { int count = 0; retval = dlp_ReadRecordIDList( pilot_socket, palmdb.getHandle(), 0, // sort total, // start m_length - total, //max m_ids + total, &count ); if ( retval < 0 ) { errprintf( "ReadRecordIDList failed, %li\n", retval ); return retval; } total += count; if (count == 0) { errprintf( "ReadRecordIDList, got %i out of %i\n", count, m_length); return 1; } } return 0; } recordid_t RecIDList::getId( int index ) const { if ( (index < 0) || (index >= m_length) ) return 0; return m_ids[ index ]; } bool RecIDList::contains( recordid_t id ) const { for ( int i=0; i<m_length; i++ ) if ( id == getId( i ) ) return true; return false; } --- NEW FILE: RecIDList.h --- /* Copyright (C) 2004 Leon van Stuivenberg <l.v...@ch...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __RECIDLIST_H #define __RECIDLIST_H #include "wepginc.h" #include "PalmDB.h" class RecIDList { public: RecIDList(); ~RecIDList(); long load( int pilot_socket, PalmDB& palmdb ); int getLength() const { return m_length; } recordid_t getId( int index ) const; bool contains( recordid_t id ) const; protected: int m_length; recordid_t* m_ids; }; #endif --- NEW FILE: TimeThreshold.C --- /* Copyright (C) 2004 Leon van Stuivenberg <l.v...@ch...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "TimeThreshold.h" #include "wepgutil.h" #include <time.h> #include <asm/types.h> #include <stdlib.h> #include <stdio.h> TimeThreshold::TimeThreshold( HostUser& hostuser ) { int enddayGMT_hour = hostuser.getDayEndHourGMT(); int enddayGMT_min = hostuser.getDayEndMinuteGMT(); time_t nowtime; struct tm nowgmt; struct tm thresholdgmt; //win32 _tzset(); time( &nowtime ); nowgmt = *gmtime( &nowtime ); thresholdgmt = nowgmt; thresholdgmt.tm_hour = enddayGMT_hour; thresholdgmt.tm_min = enddayGMT_min; thresholdgmt.tm_sec = 0; time_t thresholdgmt_time = mktime( &thresholdgmt ); if ( difftime( thresholdgmt_time, nowtime ) >= 0.0 ) { thresholdgmt_time -= 60*60*24; // go back a day thresholdgmt = *gmtime( &thresholdgmt_time ); } printTime( &thresholdgmt, m_pastStr ); thresholdgmt_time += (60*60*24) * hostuser.getLoadAhead(); thresholdgmt = *gmtime( &thresholdgmt_time ); printTime( &thresholdgmt, m_futureStr ); } void TimeThreshold::printTime( struct tm* t, char* dst ) { sprintf( dst, "%04i-%02i-%02i %02i:%02i:%02i", t->tm_year + 1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec ); } --- NEW FILE: PalmDB.C --- /* Copyright (C) 2004 Leon van Stuivenberg <l.v...@ch...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "PalmDB.h" #include "wepginc.h" #include "wepgutil.h" PalmDB::PalmDB( int pilot_socket ) { m_sock = pilot_socket; m_open = false; } PalmDB::~PalmDB() { close(); } int PalmDB::open() { int retval; if ( m_open ) return 1; retval = dlp_OpenDB( m_sock, 0, dlpOpenSecret | dlpOpenExclusive | dlpOpenWrite | dlpOpenRead, DB_NAME, &m_handle); if ( retval < 0 ) { errprintf( "OpenDB failed, %i\n", retval ); return retval; } m_open = true; return 0; } int PalmDB::close() { if ( !m_open ) return 1; dlp_CloseDB( m_sock, m_handle); m_open = false; return 0; } --- NEW FILE: PalmDB.h --- #ifndef __PalmDB_H #define __PalmDB_H #define DB_NAME "WepgDB" class PalmDB { public: PalmDB( int pilot_socket ); ~PalmDB(); int open(); int close(); int getHandle() const { return m_handle; } protected: int m_sock; bool m_open; int m_handle; private: }; #endif --- NEW FILE: wepgstruct.h --- #ifndef __wepgstruct_H #define __wepgstruct_H extern "C" { #pragma pack(1) typedef struct { unsigned long minute :6; // 0..59 (lsb's in dword) unsigned long hour :5; // 0..23 unsigned long day :5; // 1..31 unsigned long month :4; // 1..12 unsigned long year :12; // 0..1999..4095 (msb's in dword) } WepgDBTimeStamp; typedef struct { unsigned long have_title :1; unsigned long have_info :1; unsigned long watched :1; unsigned long seen_it :1; unsigned long must_see :1; unsigned long alarm :1; unsigned long sys_seen_it :1; unsigned long res1 :1; unsigned long category :4; unsigned long system_rating :3; unsigned long res2 :1; unsigned long user_rating :3; unsigned long res3 :1; unsigned long unread :1; unsigned long record :1; unsigned long sysrecord :1; unsigned long recorded :1; //... unsigned long reserved :8; } WepgDBRecordFlags; // see UserBroadcast.java #define FLAG_WATCHED 0x01 #define FLAG_SEENIT 0x02 #define FLAG_MUSTSEE 0x04 #define FLAG_ALARM 0x08 #define FLAG_SYSSEENIT 0x10 #define FLAG_UNREAD 0x20 #define FLAG_RECORD 0x40 #define FLAG_SYSRECORD 0x80 #define FLAG_RECORDED 0x100 #define STATUS_NONE 0x00 #define STATUS_UPDATE 0x02 typedef struct { WepgDBRecordFlags flags; WepgDBTimeStamp start_time; WepgDBTimeStamp end_time; unsigned char station_id; //title (asciiz) //info (asciiz) } WepgDBPackedRec; #define APPNUMSTATIONS 64 #define APPNUMCATEGORIES 16 #define APPLABELLENGTH 16 #define UIDLEN 16 typedef struct { char appinfo[ 2+16*16+16+1 +3 ]; // standard palm appinfo char user_id[ UIDLEN ]; char station_labels[APPNUMSTATIONS][ APPLABELLENGTH ]; char station_enabled[APPNUMSTATIONS]; unsigned char station_listpos[APPNUMSTATIONS]; char category_labels[APPNUMCATEGORIES][ APPLABELLENGTH ]; char category_dirty[APPNUMCATEGORIES]; unsigned long timezone; char db_credit; char sort_order; char view_mode; unsigned char view_start_hour; unsigned char view_start_min; unsigned char day_end_hour; unsigned char day_end_min; unsigned char load_ahead; // unsigned char _pad[1]; } WepgAppInfoData; #pragma pack() }//C #endif |
|
From: Leon v. S. <le...@us...> - 2004-08-03 17:13:06
|
Update of /cvsroot/wepg/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30230 Added Files: HostUser.C HostUser.h Log Message: ok --- NEW FILE: HostUser.C --- /* a pilot-link conduit for wepg Copyright (C) 2004 Leon van Stuivenberg <l.v...@ch...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "HostUser.h" #include "PalmAppInfo.h" #include "wepgutil.h" #include <string.h> #include <stdlib.h> #include <stdio.h> #include <time.h> #include <pi-dlp.h> HostUser::HostUser( const char* user_id ) { m_userId = strdup( user_id ); m_newUserId = false; m_euserId = (char*)malloc( strlen( m_userId ) * 2 + 1); escapeString( getUserId(), m_euserId, '\'' ); } HostUser::~HostUser() { free( m_userId ); free( m_euserId ); } int HostUser::internalInit( MYSQL_RES *rs, MYSQL_ROW row ) { m_id = atol( row[ mysql_field_index( rs, "id" ) ] ); m_timezone = atol( row[ mysql_field_index( rs, "timezone" ) ] ); m_viewStart = atol( row[ mysql_field_index( rs, "view_start" ) ] ); m_dayEnd = atol( row[ mysql_field_index( rs, "day_end" ) ] ); m_loadAhead = atol( row[ mysql_field_index( rs, "load_ahead" ) ] ); return 0; } long HostUser::init( int psock, MYSQL *hostdb ) { int retval; const char* ufields = "id, name, user_id, timezone, view_start, day_end, load_ahead"; char sql[512]; char sql2[512]; MYSQL_RES *rs; MYSQL_ROW row; sprintf( sql, "SELECT %s FROM User WHERE user_id='%s'", ufields, m_euserId ); if ( mymysql_store( hostdb, sql, &rs ) ) { errprintf( "Query failed (%s)\n%s\n", mysql_error(hostdb), sql ); return 1; } if ( (row = mysql_fetch_row(rs)) == NULL ) { mysql_free_result( rs ); retry: struct PilotUser info; retval = dlp_ReadUserInfo( psock, &info ); if ( retval < 0 ) { errprintf( "ReadUserInfo failed, %i\n", retval ); return retval; } // for (unsigned j=0; j<sizeof(info); j++) printf("%c", ((char*)&info)[j] ); // printf("\n"); char euser_name[257]; escapeString( info.username, euser_name, '\'' ); sprintf( sql2, "SELECT %s FROM User " "WHERE (user_id is NULL OR user_id='') AND name='%s'", ufields, euser_name ); if ( mymysql_store( hostdb, sql2, &rs ) ) { errprintf( "Query failed (%s)\n%s\n", mysql_error(hostdb), sql2 ); return 1; } if ( (row = mysql_fetch_row(rs)) != NULL ) { long internal_user_id = atol( row[ mysql_field_index( rs, "id" ) ] ); mysql_free_result( rs ); sprintf( sql2, "UPDATE User SET user_id='%s' WHERE id=%i", m_euserId, (int)internal_user_id ); retval = mymysql_exec( hostdb, sql2 ); if ( retval ) return retval; if ( mymysql_store( hostdb, sql, &rs ) ) { errprintf( "Query failed (%s)\n%s\n", mysql_error(hostdb), sql ); return 1; } row = mysql_fetch_row(rs); m_newUserId = true; } else { printf("user:'%s'\n", info.username); errprintf( "unanounced user %s", (const char*)info.username ); mysql_free_result( rs ); sprintf( sql2, "INSERT INTO User (name,timezone,view_start,day_end,load_ahead) VALUES ('%s',%i,%i,%i,%i)", euser_name, 0, 1080, 120, 1); retval = mymysql_exec( hostdb, sql2 ); if ( retval ) return retval; goto retry; } } if ( row != NULL ) { retval = internalInit( rs, row ); mysql_free_result( rs ); if ( retval != 0 ) return retval; return 0; } errprintf( "no user record\n" ); mysql_free_result( rs ); return 1; } int HostUser::save( MYSQL *hostdb, PalmAppInfo& appinfo ) { char sql[ 512 ]; int retval; m_timezone = appinfo.getTimeZone(); setViewStartHour( appinfo.getPacked()->view_start_hour ); setViewStartMinute( appinfo.getPacked()->view_start_min ); setDayEndHour( appinfo.getPacked()->day_end_hour ); setDayEndMinute( appinfo.getPacked()->day_end_min ); m_loadAhead = appinfo.getPacked()->load_ahead; sprintf( sql, "UPDATE User SET timezone=%i, view_start=%i, day_end=%i, load_ahead=%i " "WHERE user_id='%s';", m_timezone, m_viewStart, m_dayEnd, m_loadAhead, (const char*)m_euserId ); retval = mymysql_exec( hostdb, sql ); if ( retval ) return retval; return 0; } --- NEW FILE: HostUser.h --- #ifndef __HostUser_H #define __HostUser_H #include <mysql.h> class HostUser { public: HostUser( const char* user_id ); ~HostUser(); long init( int psock, MYSQL *hostdb ); int save( MYSQL *hostdb, class PalmAppInfo& appinfo ); int getInternalId() const { return m_id; } const char* getUserId() const { return m_userId; } long getTimezone() const { return m_timezone; } int getLoadAhead() const { return m_loadAhead; } int getViewStartHour() { return m_viewStart / 60; } void setViewStartHour( int h ) { m_viewStart = (m_viewStart % 60) + (h * 60); } int getViewStartMinute() { return m_viewStart % 60; } void setViewStartMinute( int m ) { m_viewStart = (m_viewStart/60) * 60 + m; } int getDayEndHour() { return m_dayEnd / 60; } void setDayEndHour( int h ) { m_dayEnd = (m_dayEnd % 60) + (h * 60); } int getDayEndMinute() { return m_dayEnd % 60; } void setDayEndMinute( int m ) { m_dayEnd = (m_dayEnd/60) * 60 + m; } int getDayEndHourGMT() const { return getDayEndGMT() / 60; } int getDayEndMinuteGMT() const { return getDayEndGMT() % 60; } bool isNewUserId() const { return m_newUserId; } protected: char* m_userId; char* m_euserId; int m_id; int m_timezone; int m_viewStart; int m_dayEnd; int m_loadAhead; bool m_newUserId; private: int internalInit( MYSQL_RES *rs, MYSQL_ROW row ); int getDayEndGMT() const { int t = m_dayEnd-(m_timezone/60); while ( t < 0 ) t += 24*60; while ( t > 24*60) t-= 24*60; return t/60; } }; #endif |
|
From: Leon v. S. <le...@us...> - 2004-07-29 16:00:44
|
Update of /cvsroot/wepg/mythcond/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv740/src Modified Files: HostUser.C PalmAppInfo.C wepgsync.C Removed Files: wepginc.h wepgutil.C wepgutil.h Log Message: ok Index: wepgsync.C =================================================================== RCS file: /cvsroot/wepg/mythcond/src/wepgsync.C,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** wepgsync.C 28 Jul 2004 19:02:37 -0000 1.1.1.1 --- wepgsync.C 29 Jul 2004 16:00:33 -0000 1.2 *************** *** 380,384 **** } ! fi = mysql_field_index( rs, "description" ); if ( row[ fi ] != NULL ) { m_info = strdup( row[ fi ] ); --- 380,384 ---- } ! fi = mysql_field_index( rs, "info" ); if ( row[ fi ] != NULL ) { m_info = strdup( row[ fi ] ); *************** *** 395,398 **** --- 395,400 ---- int f = atol( row[ mysql_field_index( rs, "flags" ) ] ); + if (row[ mysql_field_index( rs, "willrecord" ) ] != NULL) f |= FLAG_SYSRECORD; + if (row[ mysql_field_index( rs, "isrecorded" ) ] != NULL) f |= FLAG_RECORDED; m_storage.flags.watched = (f & FLAG_WATCHED) != 0; m_storage.flags.seen_it = (f & FLAG_SEENIT) != 0; *************** *** 409,413 **** MYSQL_ROW row2; ! char sql[256]; sprintf( sql, "SELECT * " --- 411,415 ---- MYSQL_ROW row2; ! char sql[1024]; sprintf( sql, "SELECT * " *************** *** 550,553 **** --- 552,556 ---- } + retval = dlp_ReadRecordByIndex( pilot_socket, palmdb.getHandle(), *************** *** 585,589 **** new_flags |= pacrec->flags.recorded ? FLAG_RECORDED : 0; ! char sql[256]; sprintf( sql, "UPDATE wepgbc " --- 588,592 ---- new_flags |= pacrec->flags.recorded ? FLAG_RECORDED : 0; ! char sql[1024]; sprintf( sql, "UPDATE wepgbc " *************** *** 622,627 **** MYSQL_RES *rs; MYSQL_ROW row; ! char sql[256]; ! char cond[256]; const char* threshold_str = threshold.getPast(); --- 625,630 ---- MYSQL_RES *rs; MYSQL_ROW row; ! char sql[1024]; ! char cond[1024]; const char* threshold_str = threshold.getPast(); *************** *** 728,731 **** --- 731,735 ---- + static int remoteRecSanityCheck( int pilot_socket, MYSQL *hostdb, *************** *** 749,753 **** for ( int i=0; i<idlist.getLength(); i++ ) { ! char sql[256]; sprintf( sql, "SELECT rec_id " --- 753,757 ---- for ( int i=0; i<idlist.getLength(); i++ ) { ! char sql[1024]; sprintf( sql, "SELECT rec_id " *************** *** 809,813 **** MYSQL_ROW row; ! char sql[512]; //first seed wepgbc with any new programs; dups will be avoided via PK --- 813,817 ---- MYSQL_ROW row; ! char sql[1024]; //first seed wepgbc with any new programs; dups will be avoided via PK *************** *** 819,827 **** mymysql_exec( hostdb, sql ); ! //select programs sprintf( sql, ! "SELECT program.chanid,program.starttime,program.endtime,program.title,program.category,program.description," ! "wepgbc.rec_id,wepgbc.rec_status,wepgbc.flags,wepgbc.system_rating,wepgbc.user_rating " "FROM program,wepgbc " "WHERE program.chanid=wepgbc.chanid AND program.starttime=wepgbc.starttime AND " "user_id=%i AND archived='N' AND wepgbc.starttime>"DLIM"%s"DLIM" AND wepgbc.starttime<="DLIM"%s"DLIM" ", --- 823,834 ---- mymysql_exec( hostdb, sql ); ! //select programs //FIXME: record.starttime/startdate !! ARGH!@%$# sprintf( sql, ! "SELECT program.chanid,program.starttime,program.endtime,program.title,program.category,CONCAT(program.subtitle,';',program.description) AS info," ! "wepgbc.rec_id,wepgbc.rec_status,wepgbc.flags,wepgbc.system_rating,wepgbc.user_rating," ! "record.recordid AS willrecord, recorded.chanid AS isrecorded " "FROM program,wepgbc " + "LEFT JOIN record ON (program.chanid=record.chanid AND program.starttime=record.starttime ) " + "LEFT JOIN recorded ON (program.chanid=recorded.chanid AND program.starttime=recorded.starttime) " "WHERE program.chanid=wepgbc.chanid AND program.starttime=wepgbc.starttime AND " "user_id=%i AND archived='N' AND wepgbc.starttime>"DLIM"%s"DLIM" AND wepgbc.starttime<="DLIM"%s"DLIM" ", *************** *** 859,863 **** } // update rec id ! char sql2[256]; sprintf( sql2, "UPDATE wepgbc " --- 866,870 ---- } // update rec id ! char sql2[1024]; sprintf( sql2, "UPDATE wepgbc " *************** *** 904,907 **** --- 911,915 ---- if ( retval != 0 ) { errprintf("wepg: hostuser.save %i\n", retval); + return retval; } --- wepgutil.h DELETED --- Index: HostUser.C =================================================================== RCS file: /cvsroot/wepg/mythcond/src/HostUser.C,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HostUser.C 28 Jul 2004 19:02:37 -0000 1.1.1.1 --- HostUser.C 29 Jul 2004 16:00:33 -0000 1.2 *************** *** 91,96 **** return retval; } ! for (int j=0; j<sizeof(info); j++) printf("%c", ((char*)&info)[j] ); ! printf("\n"); char euser_name[257]; --- 91,96 ---- return retval; } ! // for (unsigned j=0; j<sizeof(info); j++) printf("%c", ((char*)&info)[j] ); ! // printf("\n"); char euser_name[257]; --- wepginc.h DELETED --- --- wepgutil.C DELETED --- Index: PalmAppInfo.C =================================================================== RCS file: /cvsroot/wepg/mythcond/src/PalmAppInfo.C,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PalmAppInfo.C 28 Jul 2004 19:02:37 -0000 1.1.1.1 --- PalmAppInfo.C 29 Jul 2004 16:00:33 -0000 1.2 *************** *** 142,153 **** while( (row = mysql_fetch_row(rs)) != NULL ) { ! int cat_id = i; if ( cat_id < 0 ) cat_id = 0; if ( cat_id >= APPNUMCATEGORIES ) cat_id = APPNUMCATEGORIES-1; char* name = row[ mysql_field_index( rs, "category" ) ]; - strncpy( m_storage.category_labels[ cat_id ], name, APPLABELLENGTH ); - } mysql_free_result( rs ); --- 142,151 ---- while( (row = mysql_fetch_row(rs)) != NULL ) { ! int cat_id = i++; if ( cat_id < 0 ) cat_id = 0; if ( cat_id >= APPNUMCATEGORIES ) cat_id = APPNUMCATEGORIES-1; char* name = row[ mysql_field_index( rs, "category" ) ]; strncpy( m_storage.category_labels[ cat_id ], name, APPLABELLENGTH ); } mysql_free_result( rs ); |
|
From: Leon v. S. <le...@us...> - 2004-07-29 16:00:43
|
Update of /cvsroot/wepg/mythcond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv740 Modified Files: AUTHORS Makefile Log Message: ok Index: Makefile =================================================================== RCS file: /cvsroot/wepg/mythcond/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 28 Jul 2004 19:02:35 -0000 1.1.1.1 --- Makefile 29 Jul 2004 16:00:32 -0000 1.2 *************** *** 2,9 **** MYSQL_CFLAGS = -I/usr/include/mysql MYSQL_LIBS = -L/usr/lib/mysql -lmysqlclient ! PISOCK_CFLAGS = -I/usr/include PISOCK_LIBS = -lpisock ! COPTS = -Wall -O2 CFLAGS += $(COPTS) $(MYSQL_CFLAGS) $(PISOCK_CFLAGS) --- 2,9 ---- MYSQL_CFLAGS = -I/usr/include/mysql MYSQL_LIBS = -L/usr/lib/mysql -lmysqlclient ! PISOCK_CFLAGS = PISOCK_LIBS = -lpisock ! COPTS = -Wall -O2 -I../common CFLAGS += $(COPTS) $(MYSQL_CFLAGS) $(PISOCK_CFLAGS) *************** *** 12,16 **** LDFLAGS += $(MYSQL_LIBS) $(PISOCK_LIBS) -lstdc++ ! VPATH = src OBJS = HostUser.o \ --- 12,16 ---- LDFLAGS += $(MYSQL_LIBS) $(PISOCK_LIBS) -lstdc++ ! VPATH = src:../common OBJS = HostUser.o \ Index: AUTHORS =================================================================== RCS file: /cvsroot/wepg/mythcond/AUTHORS,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** AUTHORS 28 Jul 2004 19:02:34 -0000 1.1.1.1 --- AUTHORS 29 Jul 2004 16:00:32 -0000 1.2 *************** *** 1,2 **** ! l.v...@ch... --- 1,2 ---- ! Leon van Stuivenberg leon van stuivenberg at chello nl |
|
From: Leon v. S. <le...@us...> - 2004-07-29 15:59:04
|
Update of /cvsroot/wepg/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv413 Modified Files: palmdef.h Added Files: wepginc.h wepgutil.C wepgutil.h Log Message: ok --- NEW FILE: wepginc.h --- #ifndef __wepginc_h #define __wepginc_h #include <pi-source.h> #include <pi-socket.h> #include <pi-dlp.h> #include <pi-version.h> #include <pi-args.h> #include <pi-appinfo.h> #include <string.h> #include <stdio.h> #endif --- NEW FILE: wepgutil.C --- /* pcond - a pilot-link conduit for wepg Copyright (C) 2003 Leon van Stuivenberg <l.v...@ch...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "wepginc.h" #include "wepgutil.h" #include <stdio.h> unsigned long swapDWordToMotor(unsigned long dwSubj) { unsigned long dwAnswer = 0; unsigned char oneByte; int maxCars = sizeof(dwAnswer) - 1; // 3 for (int i=0; i <= maxCars; i++) { oneByte = (unsigned char)((dwSubj >> (i * 8)) & 0xFF); dwAnswer |= oneByte << ((maxCars - i) * 8); } return(dwAnswer); } unsigned long swapDWordToIntel(unsigned long dwSubj) { unsigned long dwAnswer = 0; unsigned char oneByte; int maxCars = sizeof(unsigned long) - 1; // 3 for (int i=0; i <= maxCars; i++) { oneByte = (unsigned char)((dwSubj >> ((maxCars - i) * 8)) & 0xFF); dwAnswer |= oneByte << (i * 8); } return(dwAnswer); } unsigned short flipWord(unsigned short wSubj) { unsigned short wAnswer; wAnswer = ((wSubj >> 8) & 0xff) | ((wSubj & 0xff) << 8); return(wAnswer); } // escape 'esc' with 'escesc' void escapeString( const char* src, char* dst, char esc ) { while ( *src ) { char c = *src++; if ( c == esc ) { *dst++ = c; *dst++ = c; } else { *dst++ = c; } } *dst = '\0'; } int mysql_field_index( MYSQL_RES *rs, const char* field_name ) { unsigned int num_fields; unsigned int i; MYSQL_FIELD *fields; num_fields = mysql_num_fields( rs ); fields = mysql_fetch_fields( rs ); for(i = 0; i < num_fields; i++) { if ( strcmp( fields[i].name, field_name ) == 0 ) return i; } errprintf( "field %s not found in RES %p\n", field_name, rs ); return -1; } int mymysql_exec( MYSQL *sock, const char* sql ) { MYSQL_RES *res; if ( mysql_query( sock, sql ) ) { errprintf( "Query failed (%s)\n%s\n",mysql_error(sock), sql); return 1; } if ( (res=mysql_store_result( sock )) != NULL ) { mysql_free_result( res ); } return 0; } int mymysql_store( MYSQL *sock, const char* sql, MYSQL_RES **rs ) { if ( mysql_query( sock, sql ) ) { errprintf( "Query failed (%s)\n%s\n",mysql_error(sock), sql); return 1; } if ( !(*rs=mysql_store_result( sock )) ) { errprintf( "store failed (%s)\n%s\n",mysql_error(sock), sql); return 1; } return 0; } Index: palmdef.h =================================================================== RCS file: /cvsroot/wepg/common/palmdef.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** palmdef.h 17 Apr 2002 11:45:40 -0000 1.1.1.1 --- palmdef.h 29 Jul 2004 15:58:55 -0000 1.2 *************** *** 19,22 **** --- 19,23 ---- typedef UInt32 DmResType; typedef Int DmResID; + typedef Ptr MemPtr; #define winUp up --- NEW FILE: wepgutil.h --- #ifndef __wepgutil_H #define __wepgutil_H #include <mysql.h> #define errprintf(format,args...) fprintf( stderr, format, ##args) #define logprintf(format,args...) { fprintf( stdout, format, ##args); fflush(stdout); } extern "C" { unsigned long swapDWordToMotor(unsigned long dwSubj); unsigned long swapDWordToIntel(unsigned long dwSubj); unsigned short flipWord(unsigned short wSubj); int mysql_field_index( MYSQL_RES *rs, const char* field_name ); int mymysql_exec( MYSQL *sock, const char* sql ); int mymysql_store( MYSQL *sock, const char* sql, MYSQL_RES **rs ); void escapeString( const char* src, char* dst, char esc ); } #endif |
|
From: Leon v. S. <le...@us...> - 2004-07-29 15:58:35
|
Update of /cvsroot/wepg/pcond/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv327/src Modified Files: HostUser.C Removed Files: wepginc.h wepgutil.C wepgutil.h Log Message: ok Index: HostUser.C =================================================================== RCS file: /cvsroot/wepg/pcond/src/HostUser.C,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HostUser.C 28 Nov 2003 17:36:11 -0000 1.1.1.1 --- HostUser.C 29 Jul 2004 15:58:27 -0000 1.2 *************** *** 91,94 **** --- 91,96 ---- return retval; } + for (int j=0; j<sizeof(info); j++) printf("%c", ((char*)&info)[j] ); + printf("\n"); char euser_name[257]; *************** *** 128,131 **** --- 130,134 ---- } else { + printf("user:'%s'\n", info.username); errprintf( "unanounced user %s", (const char*)info.username ); mysql_free_result( rs ); --- wepginc.h DELETED --- --- wepgutil.C DELETED --- --- wepgutil.h DELETED --- |
|
From: Leon v. S. <le...@us...> - 2004-07-29 15:58:35
|
Update of /cvsroot/wepg/pcond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv327 Modified Files: Makefile Log Message: ok Index: Makefile =================================================================== RCS file: /cvsroot/wepg/pcond/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 28 Nov 2003 17:36:10 -0000 1.1.1.1 --- Makefile 29 Jul 2004 15:58:26 -0000 1.2 *************** *** 5,9 **** PISOCK_LIBS = -lpisock ! COPTS = -Wall -O2 CFLAGS += $(COPTS) $(MYSQL_CFLAGS) $(PISOCK_CFLAGS) --- 5,9 ---- PISOCK_LIBS = -lpisock ! COPTS = -Wall -O2 -I../common CFLAGS += $(COPTS) $(MYSQL_CFLAGS) $(PISOCK_CFLAGS) *************** *** 12,16 **** LDFLAGS += $(MYSQL_LIBS) $(PISOCK_LIBS) -lstdc++ ! VPATH = src OBJS = HostUser.o \ --- 12,16 ---- LDFLAGS += $(MYSQL_LIBS) $(PISOCK_LIBS) -lstdc++ ! VPATH = src:../common OBJS = HostUser.o \ |
|
From: Leon v. S. <le...@us...> - 2004-07-29 15:53:32
|
Update of /cvsroot/wepg/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31859 Added Files: BUGS HISTORY INSTALL TODO Log Message: ok --- NEW FILE: TODO --- --- NEW FILE: INSTALL --- do: pilot-xfer -i palmwepg.prc --- NEW FILE: HISTORY --- --- NEW FILE: BUGS --- |
Update of /cvsroot/wepg/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31690 Modified Files: AUTHORS Makefile README WepgAlarm.cxx WepgAlarm.h WepgAppInfo.cxx WepgApplic.cxx WepgApplic.h WepgBCInfView.cxx WepgBCInfView.h WepgBusy.cxx WepgBusy.h WepgDB.cxx WepgDB.h WepgLUT.h WepgListView.cxx WepgListView.h WepgPackedRec.cxx WepgPackedRec.h WepgRecord.cxx WepgRecord.h WepgTableView.h main.cxx resource.h resource.rcp wepgexg.h wepgnonp.cxx Added Files: wepgicon8.bmp Removed Files: palmwepg.h Log Message: ok Index: WepgListView.h =================================================================== RCS file: /cvsroot/wepg/app/WepgListView.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgListView.h 17 Apr 2002 12:34:01 -0000 1.1.1.1 --- WepgListView.h 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 2,6 **** #define __WEPGLISTVIEW_H ! #include "palmwepg.h" #include "WepgDB.h" #include "WepgTableView.h" --- 2,6 ---- #define __WEPGLISTVIEW_H ! #include "palmdef.h" #include "WepgDB.h" #include "WepgTableView.h" *************** *** 29,32 **** --- 29,33 ---- WepgTableView* getTable() const { return m_table; } + Boolean eventHook(EventPtr event); protected: Index: WepgApplic.h =================================================================== RCS file: /cvsroot/wepg/app/WepgApplic.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgApplic.h 17 Apr 2002 12:33:56 -0000 1.1.1.1 --- WepgApplic.h 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 2,6 **** #define __WEPGAPPLIC_H ! #include "palmwepg.h" #include "PalmApplic.h" --- 2,6 ---- #define __WEPGAPPLIC_H ! #include "palmdef.h" #include "PalmApplic.h" *************** *** 36,43 **** Boolean m_wasBacklit; ! class IRDevicePalm* m_irdev; class IRDBPalm* m_irdb; ! private: --- 36,43 ---- Boolean m_wasBacklit; ! #ifdef USEIR class IRDevicePalm* m_irdev; class IRDBPalm* m_irdb; ! #endif private: Index: wepgnonp.cxx =================================================================== RCS file: /cvsroot/wepg/app/wepgnonp.cxx,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** wepgnonp.cxx 17 Apr 2002 12:34:01 -0000 1.1.1.1 --- wepgnonp.cxx 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 1,22 **** ! #include "wepgnonp.h" ! //#define NON_PORTABLE ! //#include <SystemPrv.h> ! ! Boolean ! wepg_isBacklightOn() { ! //return HwrBacklight( false, true ) == true; ! //return (GSysMiscFlags & sysMiscFlagBacklightDisable) ? false : true; ! return true; ! } ! ! ! void ! wepg_setBacklight( Boolean on ) ! { ! //fixme: figure out how to do this on >3.5 ! // HwrBacklight( true, on ); ! ! ! } ! ! --- 1,22 ---- ! #include "wepgnonp.h" ! //#define NON_PORTABLE ! //#include <SystemPrv.h> ! ! Boolean ! wepg_isBacklightOn() { ! //return HwrBacklight( false, true ) == true; ! //return (GSysMiscFlags & sysMiscFlagBacklightDisable) ? false : true; ! return true; ! } ! ! ! void ! wepg_setBacklight( Boolean on ) ! { ! //fixme: figure out how to do this on >3.5 ! // HwrBacklight( true, on ); ! ! ! } ! ! --- NEW FILE: wepgicon8.bmp --- (This appears to be a binary file; contents omitted.) Index: AUTHORS =================================================================== RCS file: /cvsroot/wepg/app/AUTHORS,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AUTHORS 8 Mar 2003 10:16:05 -0000 1.1 --- AUTHORS 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 1,6 **** original author: ! Leon van Stuivenberg leon.van.stuivenberg at iae dot nl contributions by: ! Anthony Veale veale at fafnir dot dyndns dot org --- 1,6 ---- original author: ! Leon van Stuivenberg leon van stuivenberg at chello nl contributions by: ! Anthony Veale veale at fafnir dyndns org Index: resource.h =================================================================== RCS file: /cvsroot/wepg/app/resource.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** resource.h 8 Mar 2003 09:59:05 -0000 1.2 --- resource.h 29 Jul 2004 15:52:08 -0000 1.3 *************** *** 1,50 **** ! #define FRM_LIST 1000 ! #define FRM_LIST_TABLE 1001 ! #define FRM_LIST_RATINGLIST 1002 ! #define FRM_LIST_LEFT 1004 ! #define FRM_LIST_RIGHT 1005 ! #define FRM_LIST_CAPTIONEX1 1006 ! #define FRM_LIST_CAPTIONEX2 1007 ! #define FRM_LIST_CAPTIONEX3 1008 ! #define FRM_LIST_CAP2LIST 1009 ! #define FRM_LIST_UP 1011 ! #define FRM_LIST_DOWN 1012 ! #define FRM_LIST_RATFLTTRIG 1013 ! #define FRM_LIST_RATFLTLIST 1014 ! #define FRM_LIST_GUIDE 1018 ! #define FRM_LIST_SCHED 1019 ! #define FRM_LIST_SCHEDLIST 1020 ! #define FRM_BCINF 1100 ! #define FRM_BCINF_TITLE 1101 ! #define FRM_BCINF_INFO 1102 ! #define FRM_BCINF_OK 1104 ! #define FRM_BCINF_MUSTSEE 1105 ! #define FRM_BCINF_WATCHED 1106 ! #define FRM_BCINF_SEENIT 1107 ! #define FRM_BCINF_ALARM 1108 ! #define FRM_BCINF_UP 1109 ! #define FRM_BCINF_DOWN 1110 ! #define FRM_BCINF_SYSSEENIT 1111 ! #define FRM_BCINF_RECORD 1112 ! #define FRM_BCINF_SYSRECORD 1113 ! #define FRM_BCINF_RECORDED 1114 ! #define FRM_GLOBALMENU 1200 ! #define FRM_GLOBALMENU_ARCHIVE 1201 ! #define FRM_GLOBALMENU_SENDDB 1202 ! #define FRM_GLOBALMENU_SETDAY 1203 ! #define FRM_GLOBALMENU_SETVIEW 1204 ! #define FRM_GLOBALMENU_SETTZ 1205 ! #define FRM_GLOBALMENU_TODAY 1206 ! #define ALERT_DBCORRUPT 1300 ! #define ALERT_DEBUG 1301 ! #define ALERT_ONNOW 1302 ! #define CAT_DEFAULT 1401 // +0..7 --- 1,52 ---- ! //1000 is reserved + #define FRM_LIST 2000 + #define FRM_LIST_TABLE 2001 + #define FRM_LIST_RATINGLIST 2002 + #define FRM_LIST_LEFT 2003 + #define FRM_LIST_RIGHT 2004 + #define FRM_LIST_CAPTIONEX1 2005 + #define FRM_LIST_CAPTIONEX2 2006 + #define FRM_LIST_CAPTIONEX3 2007 + #define FRM_LIST_CAP2LIST 2008 + #define FRM_LIST_UP 2009 + #define FRM_LIST_DOWN 2010 + #define FRM_LIST_RATFLTTRIG 2011 + #define FRM_LIST_RATFLTLIST 2012 + #define FRM_LIST_GUIDE 2013 + #define FRM_LIST_SCHED 2014 + #define FRM_LIST_SCHEDLIST 2015 ! #define FRM_BCINF 2100 ! #define FRM_BCINF_TITLE 2101 ! #define FRM_BCINF_INFO 2102 ! #define FRM_BCINF_OK 2103 ! #define FRM_BCINF_MUSTSEE 2104 ! #define FRM_BCINF_WATCHED 2105 ! #define FRM_BCINF_SEENIT 2106 ! #define FRM_BCINF_ALARM 2107 ! #define FRM_BCINF_UP 2108 ! #define FRM_BCINF_DOWN 2109 ! #define FRM_BCINF_SYSSEENIT 2110 ! #define FRM_BCINF_RECORD 2111 ! #define FRM_BCINF_SYSRECORD 2112 ! #define FRM_BCINF_RECORDED 2113 + #define FRM_GLOBALMENU 2200 + #define FRM_GLOBALMENU_ARCHIVE 2201 + #define FRM_GLOBALMENU_SENDDB 2202 + #define FRM_GLOBALMENU_SETDAY 2203 + #define FRM_GLOBALMENU_SETVIEW 2204 + #define FRM_GLOBALMENU_SETTZ 2205 + #define FRM_GLOBALMENU_TODAY 2206 ! #define ALERT_DBCORRUPT 2300 ! #define ALERT_DEBUG 2301 ! #define ALERT_ONNOW 2302 ! #define CAT_DEFAULT 2401 ! #define APPNAMEID 2501 // +0..7 Index: WepgListView.cxx =================================================================== RCS file: /cvsroot/wepg/app/WepgListView.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WepgListView.cxx 8 Mar 2003 09:59:05 -0000 1.2 --- WepgListView.cxx 29 Jul 2004 15:52:08 -0000 1.3 *************** *** 33,37 **** #define SCHEDFILT_REC 3 //recorded #define SCHEDFILT_TOREC 4 //record ! --- 33,45 ---- #define SCHEDFILT_REC 3 //recorded #define SCHEDFILT_TOREC 4 //record ! ! //HACK! ! #ifndef vchrRockerUp ! #define vchrRockerUp 0x0132 // 5-way rocker up ! #define vchrRockerDown 0x0133 // 5-way rocker down ! #define vchrRockerLeft 0x0134 // 5-way rocker left ! #define vchrRockerRight 0x0135 // 5-way rocker right ! #endif ! *************** *** 159,162 **** --- 167,198 ---- Boolean + WepgListView::eventHook(EventPtr event) + { + Boolean handled = false; + + if (event->eType == keyDownEvent) { + + if (event->data.keyDown.modifiers & commandKeyMask) { + // virtual events + switch (event->data.keyDown.keyCode) { //FIXME doesnt work + case vchrRockerLeft: + if ( m_mode == lvm_Plan ) { + ui_selectNewStation( -1 ); + handled = true; + } + break; + case vchrRockerRight: + if ( m_mode == lvm_Plan ) { + ui_selectNewStation( 1 ); + handled = true; + } + break; + } + } + } + return handled; + } + + Boolean WepgListView::eventHandler( EventPtr event ) { *************** *** 164,174 **** if (event->eType == keyDownEvent) { ! if (event->data.keyDown.chr == pageUpChr) { ui_pageUp(); handled = true; ! } ! else if (event->data.keyDown.chr == pageDownChr) { ui_pageDown(); handled = true; } } --- 200,212 ---- if (event->eType == keyDownEvent) { ! switch (event->data.keyDown.chr) { ! case chrPageUp: ui_pageUp(); handled = true; ! break; ! case chrPageDown: ui_pageDown(); handled = true; + break; } } *************** *** 192,195 **** --- 230,234 ---- if ( m_mode == lvm_Plan ) { ui_selectNewStation( -1 ); + handled = true; } break; *************** *** 198,201 **** --- 237,241 ---- if ( m_mode == lvm_Plan ) { ui_selectNewStation( 1 ); + handled = true; } break; *************** *** 203,206 **** --- 243,247 ---- case FRM_LIST_GUIDE: ui_setViewMode( lvm_Plan ); + handled = true; break; *************** *** 210,221 **** --- 251,265 ---- else ui_setViewMode( lvm_OnNow ); + handled = true; break; case FRM_LIST_UP: ui_lineUp(); + handled = true; break; case FRM_LIST_DOWN: ui_lineDown(); + handled = true; break; } Index: WepgDB.cxx =================================================================== RCS file: /cvsroot/wepg/app/WepgDB.cxx,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgDB.cxx 17 Apr 2002 12:34:00 -0000 1.1.1.1 --- WepgDB.cxx 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 56,60 **** WepgDB::allocBusy( PalmBusy*& b ) { ! WepgBusy* busy = new WepgBusy(); if ( busy->init() != 0 ) { delete busy; --- 56,60 ---- WepgDB::allocBusy( PalmBusy*& b ) { ! PalmBusyGfx* busy = new WepgBusy(); if ( busy->init() != 0 ) { delete busy; Index: WepgBCInfView.cxx =================================================================== RCS file: /cvsroot/wepg/app/WepgBCInfView.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WepgBCInfView.cxx 8 Mar 2003 09:59:05 -0000 1.2 --- WepgBCInfView.cxx 29 Jul 2004 15:52:08 -0000 1.3 *************** *** 5,8 **** --- 5,9 ---- + #define INFOHEIGHT 7 static WepgBCInfView* tmp_z = 0; *************** *** 121,125 **** //FldScrollField( z->fld_info, field_height, up ); ! for ( i=0; i<8; i++ ) FldScrollField( m_fldInfo, 1, winUp ); handled = true; --- 122,126 ---- //FldScrollField( z->fld_info, field_height, up ); ! for ( i=0; i<INFOHEIGHT; i++ ) FldScrollField( m_fldInfo, 1, winUp ); handled = true; *************** *** 131,135 **** //FldScrollField( z->fld_info, field_height, down ); ! for ( i=0; i<8; i++ ) FldScrollField( m_fldInfo, 1, winDown ); handled = true; --- 132,136 ---- //FldScrollField( z->fld_info, field_height, down ); ! for ( i=0; i<INFOHEIGHT; i++ ) FldScrollField( m_fldInfo, 1, winDown ); handled = true; Index: main.cxx =================================================================== RCS file: /cvsroot/wepg/app/main.cxx,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** main.cxx 17 Apr 2002 12:33:59 -0000 1.1.1.1 --- main.cxx 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 3,84 **** started: feb 1999 ! author: Leon van Stuivenberg (le...@ia...) */ ! #include "palmwepg.h" #include "WepgApplic.h" ! #include "WepgAlarm.h" ! ! ! ! ! static Err mainLaunch() ! { ! Err err = 0; ! WepgApplic* applic = new WepgApplic(); ! if ( applic != NULL ) { ! err = applic->start(); ! if ( err == 0 ) { ! applic->run(); ! applic->stop(); ! } ! delete applic; ! } ! return err; ! } ! ! ! ! static Err mainSync() ! { ! Err err = 0; ! ! DmOpenRef hDb = DmOpenDatabaseByTypeCreator( WEPG_DB_TYPE, WEPG_CREATOR, dmModeReadOnly ); ! if ( hDb != 0 ) { ! ! // get local id of db ! LocalID dbId; ! UInt dbCard; ! err = DmOpenDatabaseInfo( ! hDb, ! &dbId, ! NULL,NULL, ! &dbCard, ! NULL ! ); ! ! LocalID appinfoId; ! err |= DmDatabaseInfo( ! dbCard,dbId, ! NULL,NULL,NULL,NULL,NULL,NULL,NULL, ! &appinfoId, ! NULL,NULL,NULL ! ); ! ! if ( !err ) { ! WepgAppInfoData* appinfo = (WepgAppInfoData*)MemLocalIDToLockedPtr( ! appinfoId, dbCard ); ! if ( appinfo != NULL ) { ! err = WepgAlarm_resetAll( hDb, appinfo, 1 ); ! MemPtrUnlock( appinfo ); ! } ! } ! ! DmCloseDatabase( hDb ); ! } ! ! return err; ! } ! ! ! DWord PilotMain( Word cmd, Ptr cmdPBP, Word launchFlags ) { if (cmd == sysAppLaunchCmdNormalLaunch) { return mainLaunch(); } ! else if (cmd == sysAppLaunchCmdSyncNotify) { ! return mainSync(); } return 0; } - --- 3,83 ---- started: feb 1999 ! author: Leon van Stuivenberg (leon van stuivenberg at chello nl) */ ! ! #include "palmdef.h" #include "WepgApplic.h" ! #include "WepgAlarm.h" ! ! static Err mainLaunch() ! { ! Err err = 0; ! WepgApplic* applic = new WepgApplic(); ! if ( applic != NULL ) { ! err = applic->start(); ! if ( err == 0 ) { ! applic->run(); ! applic->stop(); ! } ! delete applic; ! } ! return err; ! } ! ! ! ! static Err mainSync() ! { ! Err err = 0; ! ! DmOpenRef hDb = DmOpenDatabaseByTypeCreator( WEPG_DB_TYPE, WEPG_CREATOR, dmModeReadOnly ); ! if ( hDb != 0 ) { ! ! // get local id of db ! LocalID dbId; ! UInt dbCard; ! err = DmOpenDatabaseInfo( ! hDb, ! &dbId, ! NULL,NULL, ! &dbCard, ! NULL ! ); ! ! LocalID appinfoId; ! err |= DmDatabaseInfo( ! dbCard,dbId, ! NULL,NULL,NULL,NULL,NULL,NULL,NULL, ! &appinfoId, ! NULL,NULL,NULL ! ); ! ! if ( !err ) { ! WepgAppInfoData* appinfo = (WepgAppInfoData*)MemLocalIDToLockedPtr( ! appinfoId, dbCard ); ! if ( appinfo != NULL ) { ! err = WepgAlarm_resetAll( hDb, appinfo, 1 ); ! MemPtrUnlock( appinfo ); ! } ! } ! ! DmCloseDatabase( hDb ); ! } ! ! return err; ! } ! ! ! ! ! UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) { if (cmd == sysAppLaunchCmdNormalLaunch) { return mainLaunch(); } ! else if (cmd == sysAppLaunchCmdSyncNotify) { ! return mainSync(); } return 0; } --- palmwepg.h DELETED --- Index: WepgAlarm.cxx =================================================================== RCS file: /cvsroot/wepg/app/WepgAlarm.cxx,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgAlarm.cxx 17 Apr 2002 12:34:01 -0000 1.1.1.1 --- WepgAlarm.cxx 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 1,265 **** ! #include "WepgAlarm.h" ! #include "WepgLUT.h" ! #include "wepgutils.h" ! #include "WepgAppInfo.h" ! ! ! #if 0 ! ! ! extern "C" { ! #include "DateDB.h" ! #include "DateAlarm.h" ! } ! ! ! #define datebookDBType 'DATA' ! #define emptySlot -1 ! ! ! static Err addAlarmEntry( DmOpenRef dbP, ! DateType start_date, ! TimeType start_time, ! TimeType end_time, ! char* desc ) ! { ! Err error; ! UInt16 recordNum; ! ! ApptDBRecordType newAppt; ! ApptDateTimeType when; ! AlarmInfoType alarm; ! ! when.startTime = start_time; ! when.endTime = end_time; ! when.date = start_date; ! ! alarm.advance = 5; // default: 5 min ! alarm.advanceUnit = aauMinutes; ! ! MemSet( &newAppt, sizeof (newAppt), 0 ); ! newAppt.when = &when; ! newAppt.alarm = &alarm; ! newAppt.description = desc; ! error = ApptNewRecord( dbP, &newAppt, &recordNum ); ! ! if (error) ! return error; ! ! return 0; ! } ! ! ! static int checkExists( DmOpenRef dbP, DateType when, TimeType t_start, TimeType t_end, UInt16* found_recnr ) ! { ! MemHandle h_appts; ! UInt16 num_appts; ! ApptInfoPtr appts; ! UInt16 recnr = 0; ! ApptDBRecordType apptRec; ! MemHandle recordH; ! UInt16 i; ! int found; ! ! ApptGetAppointments( dbP, when, 1, &h_appts, &num_appts ); ! ! if ( h_appts == 0 ) { ! return 0; ! } ! ! appts = (ApptInfoPtr)MemHandleLock( h_appts ); ! ! found = 0; ! for ( i=0; (i<num_appts) && !found; i++ ) { ! recnr = appts[i].recordNum; ! if ( recnr != emptySlot ) { ! ApptGetRecord( dbP, recnr, &apptRec, &recordH); ! ! if ( apptRec.when ) { ! if ( ( *(short*)&apptRec.when->startTime == *(short*)&t_start ) && ! ( *(short*)&apptRec.when->endTime == *(short*)&t_end ) ) { ! found = 1; ! } ! } ! MemHandleUnlock( recordH ); ! } ! } ! MemPtrUnlock( appts ); ! MemHandleFree( h_appts ); ! if ( found ) ! *found_recnr = recnr; ! return found; ! } ! ! ! ! static void getAlarmProps( WepgPackedRec* rec, WepgAppInfoData* appinfo, ! DateType* start_date, ! TimeType* start_time, ! TimeType* end_time, ! char* desc, ! int cb_desc ! ) ! { ! const char* p; ! char* q; ! char* r; ! ! WepgTimeStampType rstart; ! WepgTimeStampType rend; ! ! rstart = rec->start_time; ! rend = rec->end_time; ! ! timeAdjustTS( &rstart, appinfo->timezone ); ! timeAdjustTS( &rend, appinfo->timezone ); ! ! start_date->year = rstart.t.year - firstYear; ! start_date->month = rstart.t.month; ! start_date->day = rstart.t.day; ! ! start_time->hours = rstart.t.hour; ! start_time->minutes = rstart.t.minute; ! if ( rend.t.day != rstart.t.day ) { ! // midnight wrap; datebook can't handle this, right? ! end_time->hours = 23; ! end_time->minutes = 59; ! } ! else { ! end_time->hours = rend.t.hour; ! end_time->minutes = rend.t.minute; ! } ! ! q = desc; ! r = desc + (cb_desc/sizeof(desc[0])) -1; ! ! #define QSTRCAT(a) { p = (a); while ( (*p) && (q<r) ) *q++ = *p++; } ! ! QSTRCAT( appinfo->station_labels[ rec->station_id ] ); ! ! const char* title = rec_getTitle( rec ); ! if ( title != NULL ) { ! QSTRCAT( ": " ); ! QSTRCAT( title ); ! } ! *q = '\0'; ! } ! ! ! ! ! ! static Err openAlarmDB( DmOpenRef* dbP ) ! { ! UInt16 mode; ! DmOpenRef date_db; ! ! mode = dmModeReadWrite | dmModeShowSecret; ! ! date_db = DmOpenDatabaseByTypeCreator( datebookDBType, sysFileCDatebook, mode ); ! if ( !date_db ) { ! return -1; ! } ! *dbP = date_db; ! return 0; ! } ! ! ! static Err ! WepgAlarm_modify( WepgPackedRec* rec, WepgAppInfoData* appinfo, int set ) ! { ! Err err; ! DmOpenRef date_db; ! ! DateType start_date; ! TimeType start_time; ! TimeType end_time; ! Char desc[ 128 ]; ! UInt16 recnr; ! int found; ! ! err = openAlarmDB( &date_db ); ! if ( err != 0 ) { ! return err; ! } ! ! getAlarmProps( rec, appinfo, ! &start_date, ! &start_time, ! &end_time, ! desc, sizeof(desc) ); ! ! found = checkExists( date_db, start_date, start_time, end_time, &recnr ); ! if ( set ) { ! if ( !found ) { ! err = addAlarmEntry( date_db, start_date, start_time, end_time, desc ); ! } ! } ! else { ! if ( found ) { ! err = DmRemoveRecord( date_db, recnr ); ! } ! } ! ! RescheduleAlarms( date_db ); ! ! DmCloseDatabase( date_db ); ! ! return err; ! } ! ! ! Err WepgAlarm_set( WepgPackedRec* rec, WepgAppInfoData* appinfo ) ! { ! return WepgAlarm_modify( rec, appinfo, 1 ); ! } ! ! Err WepgAlarm_clear( WepgPackedRec* rec, WepgAppInfoData* appinfo ) ! { ! return WepgAlarm_modify( rec, appinfo, 0 ); ! } ! ! ! ! Err WepgAlarm_resetAll( DmOpenRef hDb, WepgAppInfoData* appinfo, int set ) ! { ! UInt16 record_nr = 0; ! while ( true ) { ! MemHandle h_rec = DmQueryRecord( hDb, record_nr ); ! if ( h_rec == 0 ) ! break; ! WepgPackedRec* rec = (WepgPackedRec*)MemHandleLock( h_rec ); ! if ( rec == 0 ) ! break; ! if ( rec->flags.alarm ) { ! SndPlaySystemSound( sndClick ); ! WepgAlarm_modify( rec, appinfo, set ); ! } ! ! MemHandleUnlock( h_rec ); ! record_nr++; ! } ! return 0; ! } ! ! ! #else ! ! ! Err WepgAlarm_set( WepgPackedRec* rec, WepgAppInfoData* appinfo ) ! { ! return 0; ! } ! ! Err WepgAlarm_clear( WepgPackedRec* rec, WepgAppInfoData* appinfo ) ! { ! return 0; ! } ! ! Err WepgAlarm_resetAll( DmOpenRef hDb, WepgAppInfoData* appinfo, int set ) ! { ! return 0; ! } ! ! ! #endif --- 1,265 ---- ! #include "WepgAlarm.h" ! #include "WepgLUT.h" ! #include "wepgutils.h" ! #include "WepgAppInfo.h" ! ! ! #if 0 ! ! ! extern "C" { ! #include "DateDB.h" ! #include "DateAlarm.h" ! } ! ! ! #define datebookDBType 'DATA' ! #define emptySlot -1 ! ! ! static Err addAlarmEntry( DmOpenRef dbP, ! DateType start_date, ! TimeType start_time, ! TimeType end_time, ! char* desc ) ! { ! Err error; ! UInt16 recordNum; ! ! ApptDBRecordType newAppt; ! ApptDateTimeType when; ! AlarmInfoType alarm; ! ! when.startTime = start_time; ! when.endTime = end_time; ! when.date = start_date; ! ! alarm.advance = 5; // default: 5 min ! alarm.advanceUnit = aauMinutes; ! ! MemSet( &newAppt, sizeof (newAppt), 0 ); ! newAppt.when = &when; ! newAppt.alarm = &alarm; ! newAppt.description = desc; ! error = ApptNewRecord( dbP, &newAppt, &recordNum ); ! ! if (error) ! return error; ! ! return 0; ! } ! ! ! static int checkExists( DmOpenRef dbP, DateType when, TimeType t_start, TimeType t_end, UInt16* found_recnr ) ! { ! MemHandle h_appts; ! UInt16 num_appts; ! ApptInfoPtr appts; ! UInt16 recnr = 0; ! ApptDBRecordType apptRec; ! MemHandle recordH; ! UInt16 i; ! int found; ! ! ApptGetAppointments( dbP, when, 1, &h_appts, &num_appts ); ! ! if ( h_appts == 0 ) { ! return 0; ! } ! ! appts = (ApptInfoPtr)MemHandleLock( h_appts ); ! ! found = 0; ! for ( i=0; (i<num_appts) && !found; i++ ) { ! recnr = appts[i].recordNum; ! if ( recnr != emptySlot ) { ! ApptGetRecord( dbP, recnr, &apptRec, &recordH); ! ! if ( apptRec.when ) { ! if ( ( *(short*)&apptRec.when->startTime == *(short*)&t_start ) && ! ( *(short*)&apptRec.when->endTime == *(short*)&t_end ) ) { ! found = 1; ! } ! } ! MemHandleUnlock( recordH ); ! } ! } ! MemPtrUnlock( appts ); ! MemHandleFree( h_appts ); ! if ( found ) ! *found_recnr = recnr; ! return found; ! } ! ! ! ! static void getAlarmProps( WepgPackedRec* rec, WepgAppInfoData* appinfo, ! DateType* start_date, ! TimeType* start_time, ! TimeType* end_time, ! char* desc, ! int cb_desc ! ) ! { ! const char* p; ! char* q; ! char* r; ! ! WepgTimeStampType rstart; ! WepgTimeStampType rend; ! ! rstart = rec->start_time; ! rend = rec->end_time; ! ! timeAdjustTS( &rstart, appinfo->timezone ); ! timeAdjustTS( &rend, appinfo->timezone ); ! ! start_date->year = rstart.t.year - firstYear; ! start_date->month = rstart.t.month; ! start_date->day = rstart.t.day; ! ! start_time->hours = rstart.t.hour; ! start_time->minutes = rstart.t.minute; ! if ( rend.t.day != rstart.t.day ) { ! // midnight wrap; datebook can't handle this, right? ! end_time->hours = 23; ! end_time->minutes = 59; ! } ! else { ! end_time->hours = rend.t.hour; ! end_time->minutes = rend.t.minute; ! } ! ! q = desc; ! r = desc + (cb_desc/sizeof(desc[0])) -1; ! ! #define QSTRCAT(a) { p = (a); while ( (*p) && (q<r) ) *q++ = *p++; } ! ! QSTRCAT( appinfo->station_labels[ rec->station_id ] ); ! ! const char* title = rec_getTitle( rec ); ! if ( title != NULL ) { ! QSTRCAT( ": " ); ! QSTRCAT( title ); ! } ! *q = '\0'; ! } ! ! ! ! ! ! static Err openAlarmDB( DmOpenRef* dbP ) ! { ! UInt16 mode; ! DmOpenRef date_db; ! ! mode = dmModeReadWrite | dmModeShowSecret; ! ! date_db = DmOpenDatabaseByTypeCreator( datebookDBType, sysFileCDatebook, mode ); ! if ( !date_db ) { ! return -1; ! } ! *dbP = date_db; ! return 0; ! } ! ! ! static Err ! WepgAlarm_modify( WepgPackedRec* rec, WepgAppInfoData* appinfo, int set ) ! { ! Err err; ! DmOpenRef date_db; ! ! DateType start_date; ! TimeType start_time; ! TimeType end_time; ! Char desc[ 128 ]; ! UInt16 recnr; ! int found; ! ! err = openAlarmDB( &date_db ); ! if ( err != 0 ) { ! return err; ! } ! ! getAlarmProps( rec, appinfo, ! &start_date, ! &start_time, ! &end_time, ! desc, sizeof(desc) ); ! ! found = checkExists( date_db, start_date, start_time, end_time, &recnr ); ! if ( set ) { ! if ( !found ) { ! err = addAlarmEntry( date_db, start_date, start_time, end_time, desc ); ! } ! } ! else { ! if ( found ) { ! err = DmRemoveRecord( date_db, recnr ); ! } ! } ! ! RescheduleAlarms( date_db ); ! ! DmCloseDatabase( date_db ); ! ! return err; ! } ! ! ! Err WepgAlarm_set( WepgPackedRec* rec, WepgAppInfoData* appinfo ) ! { ! return WepgAlarm_modify( rec, appinfo, 1 ); ! } ! ! Err WepgAlarm_clear( WepgPackedRec* rec, WepgAppInfoData* appinfo ) ! { ! return WepgAlarm_modify( rec, appinfo, 0 ); ! } ! ! ! ! Err WepgAlarm_resetAll( DmOpenRef hDb, WepgAppInfoData* appinfo, int set ) ! { ! UInt16 record_nr = 0; ! while ( true ) { ! MemHandle h_rec = DmQueryRecord( hDb, record_nr ); ! if ( h_rec == 0 ) ! break; ! WepgPackedRec* rec = (WepgPackedRec*)MemHandleLock( h_rec ); ! if ( rec == 0 ) ! break; ! if ( rec->flags.alarm ) { ! SndPlaySystemSound( sndClick ); ! WepgAlarm_modify( rec, appinfo, set ); ! } ! ! MemHandleUnlock( h_rec ); ! record_nr++; ! } ! return 0; ! } ! ! ! #else ! ! ! Err WepgAlarm_set( WepgPackedRec* rec, WepgAppInfoData* appinfo ) ! { ! return 0; ! } ! ! Err WepgAlarm_clear( WepgPackedRec* rec, WepgAppInfoData* appinfo ) ! { ! return 0; ! } ! ! Err WepgAlarm_resetAll( DmOpenRef hDb, WepgAppInfoData* appinfo, int set ) ! { ! return 0; ! } ! ! ! #endif Index: WepgPackedRec.cxx =================================================================== RCS file: /cvsroot/wepg/app/WepgPackedRec.cxx,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgPackedRec.cxx 17 Apr 2002 12:34:01 -0000 1.1.1.1 --- WepgPackedRec.cxx 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 1,26 **** ! #include "WepgPackedRec.h" ! ! ! const char* ! rec_getTitle( WepgPackedRec* rec ) ! { ! if ( rec->flags.have_title ) { ! return (const char*)&rec->var_start; ! } ! return NULL; ! } ! ! ! const char* ! rec_getInfo( WepgPackedRec* rec ) ! { ! if ( rec->flags.have_info ) { ! const char* t = rec_getTitle( rec ); ! if ( t != NULL ) ! t = StrChr( t, '\0' )+1; ! else ! t = (const char*)&rec->var_start; ! return t; ! } ! return NULL; ! } --- 1,26 ---- ! #include "WepgPackedRec.h" ! ! ! const char* ! rec_getTitle( WepgPackedRec* rec ) ! { ! if ( rec->flags.have_title ) { ! return (const char*)&rec->var_start; ! } ! return NULL; ! } ! ! ! const char* ! rec_getInfo( WepgPackedRec* rec ) ! { ! if ( rec->flags.have_info ) { ! const char* t = rec_getTitle( rec ); ! if ( t != NULL ) ! t = StrChr( t, '\0' )+1; ! else ! t = (const char*)&rec->var_start; ! return t; ! } ! return NULL; ! } Index: WepgLUT.h =================================================================== RCS file: /cvsroot/wepg/app/WepgLUT.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgLUT.h 17 Apr 2002 12:33:59 -0000 1.1.1.1 --- WepgLUT.h 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 2,6 **** #define __WEPGLUT_H ! #include "palmwepg.h" #include "WepgAppInfo.h" --- 2,6 ---- #define __WEPGLUT_H ! #include "palmdef.h" #include "WepgAppInfo.h" Index: WepgAppInfo.cxx =================================================================== RCS file: /cvsroot/wepg/app/WepgAppInfo.cxx,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgAppInfo.cxx 17 Apr 2002 12:33:59 -0000 1.1.1.1 --- WepgAppInfo.cxx 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 1,34 **** ! #include "WepgAppInfo.h" ! #include "resource.h" ! ! ! WepgAppInfo::WepgAppInfo( PalmDB* db, LocalID id ) ! : PalmAppInfo( db, &m_storage, sizeof(WepgAppInfoData), id ) ! { ! } ! ! ! UInt16 ! WepgAppInfo::getLocalCategoriesResID() const ! { ! return CAT_DEFAULT; ! } ! ! ! void ! WepgAppInfo::initInfo() ! { ! WepgAppInfoData* z = getMirror(); ! ! z->timezone = 0; ! ! z->db_credit = 0; ! z->sort_order = -1; ! z->view_mode = -1; ! ! z->view_start_hour = 18; ! z->view_start_min = 0; ! z->day_end_hour = 2; ! z->day_end_min = 0; ! } ! --- 1,34 ---- ! #include "WepgAppInfo.h" ! #include "resource.h" ! ! ! WepgAppInfo::WepgAppInfo( PalmDB* db, LocalID id ) ! : PalmAppInfo( db, &m_storage, sizeof(WepgAppInfoData), id ) ! { ! } ! ! ! UInt16 ! WepgAppInfo::getLocalCategoriesResID() const ! { ! return CAT_DEFAULT; ! } ! ! ! void ! WepgAppInfo::initInfo() ! { ! WepgAppInfoData* z = getMirror(); ! ! z->timezone = 0; ! ! z->db_credit = 0; ! z->sort_order = -1; ! z->view_mode = -1; ! ! z->view_start_hour = 18; ! z->view_start_min = 0; ! z->day_end_hour = 2; ! z->day_end_min = 0; ! } ! Index: WepgAlarm.h =================================================================== RCS file: /cvsroot/wepg/app/WepgAlarm.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgAlarm.h 17 Apr 2002 12:34:01 -0000 1.1.1.1 --- WepgAlarm.h 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 2,6 **** #define __WEPGALARM_H ! #include "palmwepg.h" //#include "WepgRecord.h" //#include "WepgDB.h" --- 2,6 ---- #define __WEPGALARM_H ! #include "palmdef.h" //#include "WepgRecord.h" //#include "WepgDB.h" Index: WepgRecord.h =================================================================== RCS file: /cvsroot/wepg/app/WepgRecord.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgRecord.h 17 Apr 2002 12:34:00 -0000 1.1.1.1 --- WepgRecord.h 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 2,6 **** #define __WEPGRECORD_H ! #include "palmwepg.h" #include "PalmRecord.h" #include "WepgPackedRec.h" --- 2,6 ---- #define __WEPGRECORD_H ! #include "palmdef.h" #include "PalmRecord.h" #include "WepgPackedRec.h" Index: WepgBCInfView.h =================================================================== RCS file: /cvsroot/wepg/app/WepgBCInfView.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WepgBCInfView.h 8 Mar 2003 09:59:05 -0000 1.2 --- WepgBCInfView.h 29 Jul 2004 15:52:08 -0000 1.3 *************** *** 2,6 **** #define __WEPGBCINFVIEW_H ! #include "palmwepg.h" #include "WepgDB.h" --- 2,6 ---- #define __WEPGBCINFVIEW_H ! #include "palmdef.h" #include "WepgDB.h" Index: WepgPackedRec.h =================================================================== RCS file: /cvsroot/wepg/app/WepgPackedRec.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgPackedRec.h 17 Apr 2002 12:34:01 -0000 1.1.1.1 --- WepgPackedRec.h 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 2,6 **** #define __WepgPackedRec_H ! #include "palmwepg.h" #ifdef __cplusplus --- 2,6 ---- #define __WepgPackedRec_H ! #include "palmdef.h" #ifdef __cplusplus Index: WepgDB.h =================================================================== RCS file: /cvsroot/wepg/app/WepgDB.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgDB.h 17 Apr 2002 12:33:56 -0000 1.1.1.1 --- WepgDB.h 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 2,6 **** #define __WEPGDB_H ! #include "palmwepg.h" #include "PalmDB.h" #include "WepgAppInfo.h" --- 2,6 ---- #define __WEPGDB_H ! #include "palmdef.h" #include "PalmDB.h" #include "WepgAppInfo.h" Index: wepgexg.h =================================================================== RCS file: /cvsroot/wepg/app/wepgexg.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** wepgexg.h 17 Apr 2002 12:34:02 -0000 1.1.1.1 --- wepgexg.h 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 2,6 **** #define __wepgexg_H ! #include "palmwepg.h" Err wepgexg_sendDB(); --- 2,6 ---- #define __wepgexg_H ! #include "palmdef.h" Err wepgexg_sendDB(); Index: resource.rcp =================================================================== RCS file: /cvsroot/wepg/app/resource.rcp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** resource.rcp 8 Mar 2003 09:59:05 -0000 1.2 --- resource.rcp 29 Jul 2004 15:52:08 -0000 1.3 *************** *** 161,170 **** ! ICON "wepgicon.bmp" CATEGORIES ID CAT_DEFAULT "All" ! ! // see makefile ! VERSION 1 "0.19b" --- 161,173 ---- ! ICON ! BEGIN ! BITMAP "wepgicon.bmp" BPP 1 DENSITY 72 ! BITMAP "wepgicon8.bmp" BPP 8 DENSITY 144 ! END + APPLICATIONICONNAME ID APPNAMEID "Whatch" CATEGORIES ID CAT_DEFAULT "All" ! VERSION 1 "0.20" Index: WepgTableView.h =================================================================== RCS file: /cvsroot/wepg/app/WepgTableView.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgTableView.h 17 Apr 2002 12:34:01 -0000 1.1.1.1 --- WepgTableView.h 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 2,6 **** #define __WEPGTABLEVIEW_H ! #include "palmwepg.h" #include "WepgDB.h" #include "WepgRecord.h" --- 2,6 ---- #define __WEPGTABLEVIEW_H ! #include "palmdef.h" #include "WepgDB.h" #include "WepgRecord.h" Index: WepgBusy.h =================================================================== RCS file: /cvsroot/wepg/app/WepgBusy.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgBusy.h 17 Apr 2002 12:34:01 -0000 1.1.1.1 --- WepgBusy.h 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 2,32 **** #define __WEPGBUSY_H ! #include "palmwepg.h" ! #include "PalmBusy.h" ! ! ! #define NBUSYBMP 8 ! class WepgBusy : public PalmBusy { public: WepgBusy(); - ~WepgBusy(); - - Err init(); - - virtual void yield(); - virtual void clear(); protected: - MemHandle m_hBmp[ NBUSYBMP ]; - BitmapPtr m_pBmp[ NBUSYBMP ]; - - RectangleType m_rect; - UInt16 m_bmpIdx; - UInt32 m_lastTicks; - private: }; --- 2,15 ---- #define __WEPGBUSY_H ! #include "PalmBusyGfx.h" ! class WepgBusy : public PalmBusyGfx { public: WepgBusy(); protected: private: }; Index: Makefile =================================================================== RCS file: /cvsroot/wepg/app/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 24 Feb 2003 18:54:50 -0000 1.3 --- Makefile 29 Jul 2004 15:52:08 -0000 1.4 *************** *** 1,5 **** # palmwepg makefile # ! # Leon van Stuivenberg le...@ia... # --- 1,5 ---- # palmwepg makefile # ! # Leon van Stuivenberg leon van stuivenberg at chello nl # *************** *** 30,42 **** -L../PalmDm \ -lPalmDm \ - -L../irXxD \ - -lIRXxD \ \ -lnoexcept CFLAGS = -Wall $(INCS) CFLAGS += -fno-exceptions -fno-rtti CFLAGS += -Os -fnonnull-objects ! CFLAGS += -DUSEIR #crash? : -fomit-frame-pointer --- 30,42 ---- -L../PalmDm \ -lPalmDm \ \ -lnoexcept + #LIBS += -L../irXxD -lIRXxD + CFLAGS = -Wall $(INCS) CFLAGS += -fno-exceptions -fno-rtti CFLAGS += -Os -fnonnull-objects ! #CFLAGS += -DUSEIR #crash? : -fomit-frame-pointer Index: WepgRecord.cxx =================================================================== RCS file: /cvsroot/wepg/app/WepgRecord.cxx,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgRecord.cxx 17 Apr 2002 12:34:00 -0000 1.1.1.1 --- WepgRecord.cxx 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 1,187 **** ! #include "WepgRecord.h" ! #include "WepgDB.h" ! #include "WepgAppInfo.h" ! #include "wepgutils.h" ! ! ! //////////////// ! ! static void printTime( char* p, WepgTimeStampType ts ) ! { ! p[0] = '0' + ts.t.hour/10; ! p[1] = '0' + ts.t.hour%10; ! p[2] = ':'; ! p[3] = '0' + ts.t.minute/10; ! p[4] = '0' + ts.t.minute%10; ! p[5] = 0; ! } ! ! //////////////// ! ! ! WepgRecord::WepgRecord( PalmDB* db, MemHandle recordH, PalmPackedRec* payload, UInt16 recnr ) ! : PalmRecord( db, recordH, payload, recnr ) ! { ! m_title = NULL; ! m_info = NULL; ! m_storage = NULL; ! ! PalmRecord::unpack(); ! } ! ! ! WepgRecord::~WepgRecord() ! { ! // freeMembers(); ! } ! ! ! /* ! void ! WepgRecord::freeMembers() ! { ! if ( m_title != NULL ) { ! if ( m_storage != m_pRec ) ! StrFree( m_title ); ! } ! m_title = NULL; ! if ( m_info != NULL ) { ! if ( m_storage != m_pRec ) ! StrFree( m_info ); ! } ! m_info = NULL; ! } ! */ ! ! ! Err ! WepgRecord::packedSize( UInt32& size ) ! { ! UInt32 l = (UInt32)(&((WepgPackedRec*)0)->var_start); ! ! if ( m_storage->flags.have_title && (m_title != NULL) ) ! l += StrLen( m_title ) + 1; ! ! if ( m_storage->flags.have_info && (m_info != NULL ) ) ! l += StrLen( m_info ) + 1; ! ! size = l; ! return 0; ! } ! ! ! Err ! WepgRecord::pack( void* dest ) ! { ! WepgPackedRec* packedrec = (WepgPackedRec*)dest; ! char * pbuf; ! UInt16 l; ! ! packedrec->flags = m_storage->flags; ! packedrec->start_time = m_storage->start_time; ! packedrec->end_time = m_storage->end_time; ! packedrec->station_id = m_storage->station_id; ! ! pbuf = (char*) &packedrec->var_start; ! ! if ( m_storage->flags.have_title ) { ! StrCopy( pbuf, m_title ); ! l = StrLen( m_title ); ! pbuf += l + 1; ! } ! ! if ( m_storage->flags.have_info ) { ! StrCopy( pbuf, m_info ); ! l = StrLen( m_info ); ! pbuf += l + 1; ! } ! ! return 0; ! } ! ! ! ! ! Err ! WepgRecord::unpack( void* src ) ! { ! // freeMembers(); ! ! //WepgPackedRec* packedrec = (WepgPackedRec*)src; ! // CharPtr pbuf; ! // Word l; ! ! if ( src != m_pRec ) ! return 1; ! m_storage = (WepgPackedRec*)src; ! ! ! //m_storage.flags = packedrec->flags; ! //m_storage.start_time = packedrec->start_time; ! //m_storage.end_time = packedrec->end_time; ! //m_storage.station_id = packedrec->station_id; ! ! /* ! pbuf = (CharPtr) &packedrec->var_start; ! ! // title ! if ( m_storage.flags.have_title ) { ! m_title = StrDup( pbuf ); ! l = StrLen( pbuf ); ! pbuf += l + 1; ! } ! else ! m_title = NULL; ! ! // info ! if ( m_storage.flags.have_info ) { ! m_info = StrDup( pbuf ); ! l = StrLen( pbuf ); ! pbuf += l + 1; ! } ! else ! m_info = NULL; ! */ ! m_title = rec_getTitle( m_storage ); ! m_info = rec_getInfo( m_storage ); ! ! ! WepgTimeStampType tmpts; ! ! tmpts = m_storage->start_time; ! timeAdjustTS( &tmpts, getDB()->getAppInfo()->getMirror()->timezone ); ! printTime( m_startTimeStr, tmpts ); ! ! tmpts = m_storage->end_time; ! timeAdjustTS( &tmpts, getDB()->getAppInfo()->getMirror()->timezone ); ! printTime( m_endTimeStr, tmpts ); ! ! return 0; ! } ! ! ! Err ! WepgRecord::edit() ! { ! m_editStorage.flags = m_storage->flags; ! m_editStorage.start_time = m_storage->start_time; ! m_editStorage.end_time = m_storage->end_time; ! m_editStorage.station_id = m_storage->station_id; ! ! m_storage = &m_editStorage; ! // title and info currently unmutable; no edit storage req. ! return 0; ! } ! ! ! Err ! WepgRecord::editDone() ! { ! Err err; ! ! err = write(); ! m_storage = (WepgPackedRec*)m_pRec; ! err = PalmRecord::unpack(); ! return err; ! } ! --- 1,187 ---- ! #include "WepgRecord.h" ! #include "WepgDB.h" ! #include "WepgAppInfo.h" ! #include "wepgutils.h" ! ! ! //////////////// ! ! static void printTime( char* p, WepgTimeStampType ts ) ! { ! p[0] = '0' + ts.t.hour/10; ! p[1] = '0' + ts.t.hour%10; ! p[2] = ':'; ! p[3] = '0' + ts.t.minute/10; ! p[4] = '0' + ts.t.minute%10; ! p[5] = 0; ! } ! ! //////////////// ! ! ! WepgRecord::WepgRecord( PalmDB* db, MemHandle recordH, PalmPackedRec* payload, UInt16 recnr ) ! : PalmRecord( db, recordH, payload, recnr ) ! { ! m_title = NULL; ! m_info = NULL; ! m_storage = NULL; ! ! PalmRecord::unpack(); ! } ! ! ! WepgRecord::~WepgRecord() ! { ! // freeMembers(); ! } ! ! ! /* ! void ! WepgRecord::freeMembers() ! { ! if ( m_title != NULL ) { ! if ( m_storage != m_pRec ) ! StrFree( m_title ); ! } ! m_title = NULL; ! if ( m_info != NULL ) { ! if ( m_storage != m_pRec ) ! StrFree( m_info ); ! } ! m_info = NULL; ! } ! */ ! ! ! Err ! WepgRecord::packedSize( UInt32& size ) ! { ! UInt32 l = (UInt32)(&((WepgPackedRec*)0)->var_start); ! ! if ( m_storage->flags.have_title && (m_title != NULL) ) ! l += StrLen( m_title ) + 1; ! ! if ( m_storage->flags.have_info && (m_info != NULL ) ) ! l += StrLen( m_info ) + 1; ! ! size = l; ! return 0; ! } ! ! ! Err ! WepgRecord::pack( void* dest ) ! { ! WepgPackedRec* packedrec = (WepgPackedRec*)dest; ! char * pbuf; ! UInt16 l; ! ! packedrec->flags = m_storage->flags; ! packedrec->start_time = m_storage->start_time; ! packedrec->end_time = m_storage->end_time; ! packedrec->station_id = m_storage->station_id; ! ! pbuf = (char*) &packedrec->var_start; ! ! if ( m_storage->flags.have_title ) { ! StrCopy( pbuf, m_title ); ! l = StrLen( m_title ); ! pbuf += l + 1; ! } ! ! if ( m_storage->flags.have_info ) { ! StrCopy( pbuf, m_info ); ! l = StrLen( m_info ); ! pbuf += l + 1; ! } ! ! return 0; ! } ! ! ! ! ! Err ! WepgRecord::unpack( void* src ) ! { ! // freeMembers(); ! ! //WepgPackedRec* packedrec = (WepgPackedRec*)src; ! // CharPtr pbuf; ! // Word l; ! ! if ( src != m_pRec ) ! return 1; ! m_storage = (WepgPackedRec*)src; ! ! ! //m_storage.flags = packedrec->flags; ! //m_storage.start_time = packedrec->start_time; ! //m_storage.end_time = packedrec->end_time; ! //m_storage.station_id = packedrec->station_id; ! ! /* ! pbuf = (CharPtr) &packedrec->var_start; ! ! // title ! if ( m_storage.flags.have_title ) { ! m_title = StrDup( pbuf ); ! l = StrLen( pbuf ); ! pbuf += l + 1; ! } ! else ! m_title = NULL; ! ! // info ! if ( m_storage.flags.have_info ) { ! m_info = StrDup( pbuf ); ! l = StrLen( pbuf ); ! pbuf += l + 1; ! } ! else ! m_info = NULL; ! */ ! m_title = rec_getTitle( m_storage ); ! m_info = rec_getInfo( m_storage ); ! ! ! WepgTimeStampType tmpts; ! ! tmpts = m_storage->start_time; ! timeAdjustTS( &tmpts, getDB()->getAppInfo()->getMirror()->timezone ); ! printTime( m_startTimeStr, tmpts ); ! ! tmpts = m_storage->end_time; ! timeAdjustTS( &tmpts, getDB()->getAppInfo()->getMirror()->timezone ); ! printTime( m_endTimeStr, tmpts ); ! ! return 0; ! } ! ! ! Err ! WepgRecord::edit() ! { ! m_editStorage.flags = m_storage->flags; ! m_editStorage.start_time = m_storage->start_time; ! m_editStorage.end_time = m_storage->end_time; ! m_editStorage.station_id = m_storage->station_id; ! ! m_storage = &m_editStorage; ! // title and info currently unmutable; no edit storage req. ! return 0; ! } ! ! ! Err ! WepgRecord::editDone() ! { ! Err err; ! ! err = write(); ! m_storage = (WepgPackedRec*)m_pRec; ! err = PalmRecord::unpack(); ! return err; ! } ! Index: WepgApplic.cxx =================================================================== RCS file: /cvsroot/wepg/app/WepgApplic.cxx,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgApplic.cxx 17 Apr 2002 12:33:59 -0000 1.1.1.1 --- WepgApplic.cxx 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 7,14 **** #include "wepgnonp.h" #include "IRDevicePalm.h" #include "IRDBPalm.h" #include "IRModules.h" ! --- 7,15 ---- #include "wepgnonp.h" + #ifdef USEIR #include "IRDevicePalm.h" #include "IRDBPalm.h" #include "IRModules.h" ! #endif *************** *** 23,29 **** m_db = new WepgDB(); ! m_irdev = new IRDevicePalm(); m_irdb = new IRDBPalm( 3 ); } --- 24,31 ---- m_db = new WepgDB(); ! #ifdef USEIR m_irdev = new IRDevicePalm(); m_irdb = new IRDBPalm( 3 ); + #endif } *************** *** 31,43 **** WepgApplic::~WepgApplic() { - if ( m_listView != NULL ) - delete m_listView; - - if ( m_bcInfView != NULL ) - delete m_bcInfView; - if ( m_db != NULL ) delete m_db; if ( m_irdev != NULL ) delete m_irdev; --- 33,40 ---- WepgApplic::~WepgApplic() { if ( m_db != NULL ) delete m_db; + #ifdef USEIR if ( m_irdev != NULL ) delete m_irdev; *************** *** 45,51 **** --- 42,50 ---- if ( m_irdb != NULL ) delete m_irdb; + #endif } + Err WepgApplic::unhideToday() *************** *** 135,138 **** --- 134,138 ---- } + #ifdef USEIR err = m_irdev->open( NULL ); if ( err ) { *************** *** 146,150 **** m_irdb->registerModule( new IRModSony12( m_irdb ) ); m_irdb->registerModule( new IRModKeyGap( m_irdb ) ); ! FrmGotoForm( FRM_LIST ); --- 146,150 ---- m_irdb->registerModule( new IRModSony12( m_irdb ) ); m_irdb->registerModule( new IRModKeyGap( m_irdb ) ); ! #endif FrmGotoForm( FRM_LIST ); *************** *** 159,170 **** Err err = 0; FrmCloseAllForms(); err = m_db->close(); err = m_irdev->close(); err = m_irdb->close(); ! return err; } --- 159,179 ---- Err err = 0; + if ( m_listView != NULL ) + delete m_listView; + m_listView = NULL; + + if ( m_bcInfView != NULL ) + delete m_bcInfView; + m_bcInfView = NULL; + FrmCloseAllForms(); err = m_db->close(); + #ifdef USEIR err = m_irdev->close(); err = m_irdb->close(); ! #endif return err; } *************** *** 269,272 **** --- 278,282 ---- { if ( attr_idx == ATTR_STATION ) { + #ifdef USEIR WepgRecord* rec = NULL; m_listView->getSelected( rec ); *************** *** 276,279 **** --- 286,290 ---- m_irdb->fireEvent( m_irdev, 'Wepg', ir_id, NULL ); } + #endif } } *************** *** 287,291 **** FormPtr frm; WepgRecord* rec; ! Err err; if (event->eType == frmLoadEvent) { --- 298,302 ---- FormPtr frm; WepgRecord* rec; ! // Err err; if (event->eType == frmLoadEvent) { *************** *** 365,372 **** if ( event->eType == menuEvent ) { switch ( event->data.menu.itemID ) { ! /* ! case FRM_GLOBALMENU_ARCHIVE: ! return (true); ! */ case FRM_GLOBALMENU_SETDAY: setDayEnd(); --- 376,381 ---- if ( event->eType == menuEvent ) { switch ( event->data.menu.itemID ) { ! // case FRM_GLOBALMENU_ARCHIVE: ! // return (true); case FRM_GLOBALMENU_SETDAY: setDayEnd(); *************** *** 383,389 **** case FRM_GLOBALMENU_SENDDB: ! err = m_irdev->close(); wepgexg_sendDB(); err = m_irdev->open( NULL ); return (true); --- 392,402 ---- case FRM_GLOBALMENU_SENDDB: ! #ifdef USEIR ! err = m_irdev->close(); ! #endif wepgexg_sendDB(); + #ifdef USEIR err = m_irdev->open( NULL ); + #endif return (true); *************** *** 413,421 **** --- 426,439 ---- wepg_setBacklight( 0xff ); //m_wasBacklit ); m_wasBacklit = 0; + #ifdef USEIR m_irdev->reInit(); + #endif return true; //} } } + if (m_listView != NULL) { + if (m_listView->eventHook(event)) return true; + } return false; } Index: README =================================================================== RCS file: /cvsroot/wepg/app/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README 8 Mar 2003 10:16:05 -0000 1.1 --- README 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 1,5 **** wepg - Whatch EPG ! Copyright (C) 1997-2003 Leon van Stuivenberg (le...@ia...) This program is free software; you can redistribute it and/or modify --- 1,5 ---- wepg - Whatch EPG ! Copyright (C) 1997-2004 Leon van Stuivenberg (leon van stuivenberg at chello nl) This program is free software; you can redistribute it and/or modify Index: WepgBusy.cxx =================================================================== RCS file: /cvsroot/wepg/app/WepgBusy.cxx,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WepgBusy.cxx 17 Apr 2002 12:33:59 -0000 1.1.1.1 --- WepgBusy.cxx 29 Jul 2004 15:52:08 -0000 1.2 *************** *** 1,90 **** ! #include "WepgBusy.h" ! #include "resource.h" ! ! ! WepgBusy::WepgBusy() : PalmBusy() ! { ! for ( int i=0; i<NBUSYBMP; i++ ) ! m_hBmp[ i ] = NULL; ! } ! ! ! WepgBusy::~WepgBusy() ! { ! for ( int i=0; i<NBUSYBMP; i++ ) { ! if ( m_hBmp[ i ] != NULL ) { ! MemPtrUnlock( m_pBmp[ i ] ); ! DmReleaseResource( m_hBmp[ i ] ); ! } ! } ! } ! ! ! ! Err ! WepgBusy::init() ! { ! int load_error; ! ! load_error = false; ! for ( int i=0; i<NBUSYBMP; i++ ) { ! m_hBmp[ i ] = DmGetResource( bitmapRsc, BUSYRESID + i ); ! if ( m_hBmp[ i ] != NULL ) ! m_pBmp[ i ] = (BitmapPtr)MemHandleLock( m_hBmp[ i ] ); ! else ! load_error = true; ! } ! m_bmpIdx = 0; ! m_rect.topLeft.x = 0; //145; ! m_rect.topLeft.y = 0; ! m_rect.extent.x = 15; ! m_rect.extent.y = 15; ! m_lastTicks = TimGetTicks(); ! ! if ( load_error ) ! return 1; ! return 0; ! } ! ! ! ! ! void ! WepgBusy::yield() ! { ! UInt32 tik; ! UInt32 dtik; ! ! tik = TimGetTicks(); ! dtik = tik - m_lastTicks; ! if ( dtik > 15 ) { ! m_lastTicks = tik; ! ! WinDrawBitmap( m_pBmp[ m_bmpIdx ], m_rect.topLeft.x, m_rect.topLeft.y ); ! ! m_bmpIdx++; ! if ( m_bmpIdx == NBUSYBMP ) ! m_bmpIdx = 0; ! } ! } ! ! ! void ! WepgBusy::clear() ! { ! /* ! very irritating ! ! static Word pat[] = { 0xffff, 0xffff, 0xffff, 0xffff }; ! ! RectangleType t; ! t.topLeft.x = 0; ! t.topLeft.y = 0; ! t.extent.x = 1; ! t.extent.y = 1; ! WinSetPattern( (Word*)&pat ); ! WinFillRectangle( &m_rect, 0 ); ! WinEraseRectangle( &t, 0 ); ! */ ! } ! --- 1,7 ---- ! #include "WepgBusy.h" ! #include "resource.h" ! ! ! WepgBusy::WepgBusy() : PalmBusyGfx(BUSYRESID) ! { ! } |
|
From: <ben...@id...> - 2004-05-22 12:26:17
|
Dear Open Source developer I am doing a research project on "Fun and Software Development" in which I kindly invite you to participate. You will find the online survey under http://fasd.ethz.ch/qsf/. The questionnaire consists of 53 questions and you will need about 15 minutes to complete it. With the FASD project (Fun and Software Development) we want to define the motivational significance of fun when software developers decide to engage in Open Source projects. What is special about our research project is that a similar survey is planned with software developers in commercial firms. This procedure allows the immediate comparison between the involved individuals and the conditions of production of these two development models. Thus we hope to obtain substantial new insights to the phenomenon of Open Source Development. With many thanks for your participation, Benno Luthiger PS: The results of the survey will be published under http://www.isu.unizh.ch/fuehrung/blprojects/FASD/. We have set up the mailing list fa...@we... for this study. Please see http://fasd.ethz.ch/qsf/mailinglist_en.html for registration to this mailing list. _______________________________________________________________________ Benno Luthiger Swiss Federal Institute of Technology Zurich 8092 Zurich Mail: benno.luthiger(at)id.ethz.ch _______________________________________________________________________ |
|
From: <le...@us...> - 2004-01-01 10:52:15
|
Update of /cvsroot/wepg/parsers/gparse
In directory sc8-pr-cvs1:/tmp/cvs-serv10494
Modified Files:
EuroTVCollector.java EuroTVTokenizer.java
Log Message:
parser fix for main listing page (theme unknown)
Index: EuroTVCollector.java
===================================================================
RCS file: /cvsroot/wepg/parsers/gparse/EuroTVCollector.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** EuroTVCollector.java 8 Mar 2003 18:25:04 -0000 1.2
--- EuroTVCollector.java 1 Jan 2004 10:52:12 -0000 1.3
***************
*** 77,86 ****
{
try {
- Element cat = doc.createElement( "theme" );
- cat.setAttribute( "id", "unknown" );
- root.appendChild( cat );
-
String url = urlForPage( station_id, time_reference );
if ( url != null ) {
Reader r = getReaderFor( url );
EuroTVTokenizer t = new EuroTVTokenizer( r, time_reference );
--- 77,86 ----
{
try {
String url = urlForPage( station_id, time_reference );
if ( url != null ) {
+ Element cat = doc.createElement( "theme" );
+ cat.setAttribute( "id", "unknown" );
+ root.appendChild( cat );
+
Reader r = getReaderFor( url );
EuroTVTokenizer t = new EuroTVTokenizer( r, time_reference );
***************
*** 92,96 ****
x.printStackTrace();
}
-
return 0;
}
--- 92,95 ----
***************
*** 102,106 ****
Document doc, Node root, Calendar time_reference )
{
! // categories
// <id>1 (movie)
// <id>2 (serie)
--- 101,105 ----
Document doc, Node root, Calendar time_reference )
{
! // categories
// <id>1 (movie)
// <id>2 (serie)
***************
*** 139,147 ****
!
private String urlForPage( String station_id, Calendar time_reference )
{
- // find page for specified day
- // url for index = sl<id>
String day_page = null;
String url = s_urlBase + "/sl" + station_id + ".htm";
--- 138,144 ----
! /* searches for url for specified day in index page sl<id> */
private String urlForPage( String station_id, Calendar time_reference )
{
String day_page = null;
String url = s_urlBase + "/sl" + station_id + ".htm";
***************
*** 162,167 ****
Calendar page_cal = Tokenizer.fixDate( page_date, time_reference );
if ( (page_cal.get( Calendar.DAY_OF_MONTH ) == time_reference.get( Calendar.DAY_OF_MONTH ) ) &&
! (page_cal.get( Calendar.MONTH ) == time_reference.get( Calendar.MONTH ) ) )
break;
}
day_page = null;
--- 159,165 ----
Calendar page_cal = Tokenizer.fixDate( page_date, time_reference );
if ( (page_cal.get( Calendar.DAY_OF_MONTH ) == time_reference.get( Calendar.DAY_OF_MONTH ) ) &&
! (page_cal.get( Calendar.MONTH ) == time_reference.get( Calendar.MONTH ) ) ) {
break;
+ }
}
day_page = null;
Index: EuroTVTokenizer.java
===================================================================
RCS file: /cvsroot/wepg/parsers/gparse/EuroTVTokenizer.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** EuroTVTokenizer.java 5 May 2002 12:12:52 -0000 1.1.1.1
--- EuroTVTokenizer.java 1 Jan 2004 10:52:12 -0000 1.2
***************
*** 14,18 ****
public class EuroTVTokenizer extends EuroTVTokBase
{
! private static final int ETS_SCANDATE = 1;
private static final int ETS_SCANTIME = 2;
private static final int ETS_TITLE = 3;
--- 14,18 ----
public class EuroTVTokenizer extends EuroTVTokBase
{
! // private static final int ETS_SCANDATE = 1;
private static final int ETS_SCANTIME = 2;
private static final int ETS_TITLE = 3;
***************
*** 34,38 ****
prg_info = new StringBuffer();
! setState( ETS_SCANDATE );
}
--- 34,38 ----
prg_info = new StringBuffer();
! setState( ETS_SCANTIME );
}
***************
*** 41,44 ****
--- 41,45 ----
{
while (true) switch ( m_state ) {
+ /*
case ETS_SCANDATE:
if ( segmentize( m_segBuf ) == ETT_EOF )
***************
*** 47,51 ****
; // nop
break;
! case ETS_SCANTIME:
case ETS_TITLE:
case ETS_INFO:
--- 48,52 ----
; // nop
break;
! */ case ETS_SCANTIME:
case ETS_TITLE:
case ETS_INFO:
***************
*** 112,116 ****
return null;
}
!
private boolean scanDate()
{
--- 113,118 ----
return null;
}
!
! /*
private boolean scanDate()
{
***************
*** 124,128 ****
return false;
}
!
private boolean scanTime()
--- 126,130 ----
return false;
}
! */
private boolean scanTime()
***************
*** 183,184 ****
--- 185,187 ----
}
}
+
|
|
From: <le...@us...> - 2003-11-28 17:39:27
|
Update of /cvsroot/wepg/pcond/src/.deps In directory sc8-pr-cvs1:/tmp/cvs-serv25580 Removed Files: HostUser.P HostUser.Plo PalmAppInfo.P PalmAppInfo.Plo PalmDB.P PalmDB.Plo wepgcn.P wepgcn.Plo wepgsync.P wepgsync.Plo wepgutil.P wepgutil.Plo Log Message: oops --- HostUser.P DELETED --- --- HostUser.Plo DELETED --- --- PalmAppInfo.P DELETED --- --- PalmAppInfo.Plo DELETED --- --- PalmDB.P DELETED --- --- PalmDB.Plo DELETED --- --- wepgcn.P DELETED --- --- wepgcn.Plo DELETED --- --- wepgsync.P DELETED --- --- wepgsync.Plo DELETED --- --- wepgutil.P DELETED --- --- wepgutil.Plo DELETED --- |