Justin Wetherell wrote: > Actually, try this patch instead. Have you ever done any game programming? The algorithm is the same as when a sprite is touching or over an object, except in this case everything is a line and there are only two points to check.
All that is needed is a sorted list of programmes, sorted by start time and a loop. You don't need any SQL queries, this is overkill. However, what is needed is a way to show when two or more programs overlap, so an extra field in the TvProgram object is required to indicate this condition. Then the TV guide, scheduled recordings, favourites and the webserver need to indicate this probable with a yellow/orange background. Oddly, this is the hard part. I've added overlap to the TvProgram object, so it can be accessed and set with prog.overlap. I have already done some of this code in the wakeupserver I wrote. HTH Duncan > > On 12/30/06, *Justin Wetherell* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > I've done a quick hack for duplicate detection, if you want ro run > with the idea. > > Attached is the diff. > > > On 12/30/06, *Dirk Meyer* < [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Hi, > > "Andrew Flegg" wrote: > > Anamorphic skin > > ~~~~~~~~~~~~~~~ > > I've got a 16:9 CRT TV in the UK, connected over S-Video. X is > running > > at 800x600 (with overscan). Since the TV stretches the image > > horizontally, this means non-square pixels. The current themes > look > > rather "fat" like this, so I'm thinking of working on an anamorphic > > skin which would look better on these widescreen TVs. > > > > Since I'm not an artist, I imagine this will mostly be done by > > squishing images in a current theme horizontally, and modifying the > > co-ordinates to take it into account. Since font width/height > can't be > > specified separately, I'm currently using Deja Vu Sans Condensed, > > which looks alright stretched back out. > > > > Is there such a theme already, or would there be a better way of > > scaling everything horizontally (perhaps in kaa?) giving the > ability > > to define a theme which has ~1400 pixels horizontally to play > with, > > which get squished to 800 on output? > > I know this problem. I now also have a 16:9 tv. I have square pixels > (running Freevo on 1360x768) but the skin still looks kind of > odd. The > next gui redesign will get some information about monitor aspect to > fix this. But I don't use 1.x anymore (I don't even know the > code), so > a simple 16:9 skin should be created by someone. > > > Ideally when scheduling favourites, it would look through the > list of > > previously recorded programmes and identify duplicates by > subtitle or > > - if no subtitle - description. It'd then not record it again. > > Nice idea. > > > Dischi > > -- > Clothes make the man. Naked people have little or no influence on > society. - Mark Twain > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance > to share your > opinions on IT & business topics through brief surveys - and > earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> > _______________________________________________ > Freevo-devel mailing list > Freevo-devel@lists.sourceforge.net > <mailto:Freevo-devel@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/freevo-devel > <https://lists.sourceforge.net/lists/listinfo/freevo-devel> > > > > > > ------------------------------------------------------------------------ > > Index: src/helpers/recordserver.py > =================================================================== > --- src/helpers/recordserver.py (revision 8873) > +++ src/helpers/recordserver.py (working copy) > @@ -27,10 +27,16 @@ > # ----------------------------------------------------------------------- > > > -import sys, string, random, time, os, re, pwd, stat, threading > +import sys, string, random, time, os, re, pwd, stat, threading, pickle > import config > from util import vfs > > +##sql database util > +try: > + from util.dbutil import * > +except ImportError: > + pass > + > appname = os.path.splitext(os.path.basename(sys.argv[0]))[0] > appconf = appname.upper() > > @@ -252,7 +258,69 @@ > pass > > return TRUE > + > + def duplicate(self, prog=None): > > + # Geta sql object > + db = MetaDatabase() > + _debug_('Databse is available') > + > + # Create initial table, if needed > + dbschema = """CREATE TABLE tv (id INTEGER PRIMARY KEY, \ > + title VARCHAR(255), \ > + sub_title VARCHAR(255), \ > + desc VARCHAR(255), \ > + categories VARCHAR(255), \ > + ratings VARCHAR(255))""" > + if not db.checkTable('tv'): > + _debug_('Create TV table') > + db.runQuery(dbschema) > + _debug_('Databse is available and TV table exists') > + > + # Iterate through the table and check for duplicates > + query='SELECT *,COUNT(title) FROM tv GROUP BY title HAVING > COUNT(title)>=1' > + results=db.runQuery(query) > + if results: > + duplicateProgram=False > + _debug_('Program: "%s" "%s" "%s"' % \ > + (prog.title, prog.sub_title, prog.desc)) > + for row in results: > + _debug_('Previous: "%s" "%s" "%s"' % \ > + (row['title'], row['sub_title'], row['desc'])) > + if row['title'] == prog.title and row['sub_title'] == > prog.sub_title: > + duplicateProgram=True > + _debug_('Found Duplicate w/ title and > sub_title') > + if row['title'] == prog.title and row['desc'] == > prog.desc: > + duplicateProgram=True > + _debug_('Found Duplicate w/ title and desc') > + if duplicateProgram==False: > + values = "(null,\'%s\',\'%s\',\'%s\',\'%s\',\'%s\')" % \ > + (util.escape(prog.title), \ > + util.escape(prog.sub_title), \ > + util.escape(prog.desc), \ > + util.escape(pickle.dumps(prog.categories)), \ > + util.escape(pickle.dumps(prog.ratings))) > + sql = 'INSERT OR IGNORE INTO tv VALUES '+values > + _debug_(sql) > + db.runQuery(sql) > + _debug_('Not Duplicate') > + db.close() > + return FALSE > + else: > + values = "(null,\'%s\',\'%s\',\'%s\',\'%s\',\'%s\')" % \ > + (util.escape(prog.title), \ > + util.escape(prog.sub_title), \ > + util.escape(prog.desc), \ > + util.escape(pickle.dumps(prog.categories)), \ > + util.escape(pickle.dumps(prog.ratings))) > + sql = 'INSERT OR IGNORE INTO tv VALUES '+values > + _debug_(sql) > + db.runQuery(sql) > + _debug_('No previous recordings, so not duplicate') > + db.close() > + return FALSE > + db.close() > + return TRUE > > def scheduleRecording(self, prog=None): > global guide > @@ -271,9 +339,12 @@ > _debug_('scheduleRecording: "%s"' % (prog)) > prog.tunerid = chan.tunerid > > - scheduledRecordings = self.getScheduledRecordings() > - scheduledRecordings.addProgram(prog, tv_util.getKey(prog)) > - self.saveScheduledRecordings(scheduledRecordings) > + if not self.duplicate(prog): > + scheduledRecordings = self.getScheduledRecordings() > + scheduledRecordings.addProgram(prog, tv_util.getKey(prog)) > + self.saveScheduledRecordings(scheduledRecordings) > + else: > + return (FALSE, 'duplicate recording') > > # check, maybe we need to start right now > self.checkToRecord() > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > ------------------------------------------------------------------------ > > _______________________________________________ > Freevo-devel mailing list > Freevo-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/freevo-devel ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel