TODO items, sorted by priority (68 items)
Last updated: Sat Jan 31 22:46:41 2004
- /isnLib/net/webServer.py:205
return "Not found..."
data = imgdb.getImgData(id)
if data: # TODO0: return a proper Content-type here. Some mozilla browsers may not detect image type correctly
request.setHeader("Content-Type", "image")
return data \
- /isnLib/net/imgClient.py:155
def errKarma(self,reason):
#TODO: err callbacks could be abstracted
self.debug("error getting remote node karma:" + repr(reason))
\
- /isnLib/net/imgClient.py:83
assert type(data[1]) == types.IntType
assert type(data[2]) == types.IntType
#TODO: better type checks.
self.addr = data[0]
try: # TODO5: investigate: could this reverse name lookup cause a freeze and annoy people ? i think its nice to have it because eventually this avoids having a lot of hostnames info travelling across the network. ips are faster i guess... \
- /isnLib/net/imgClient.py:74
def summon(self,data):
#TODO: move this function to __init__
"""brings this instance into a working (or at least properly initialized) state from the data parameter, and tries to connect
""" \
- /isnLib/net/imgServer.py:73
#TODO5: implement an access logging system. See how to use a different logging target on the logging module
#TODO: check all functions that receive parameters by remote method invocation, and flag as such, since they demand special attention regarding type checking, data sanity, exploits, etc
class imgServer(pb.Root):
def __init__(self, env): \
- /isnLib/gui/MainFrame.py:288
os.remove(fswap)
self.thumbList.SetItemImage(idx,ix,ix)
#TODO: on win32, there was a problem: wxListCtrl bitmaps had to be 128x128. Does this problem still exist ?
def onNewQuery(self): \
- /isnLib/coreEnv.py:262
"""makes sure dir exists. Also checking read/write permissions
"""
#TODO: check permissions
#TODO3: check/create dirs recursively, so all intermediate paths are created
if not os.path.exists(settDir): \
- /isnLib/coreEnv.py:237
import sys,os
#TODO0: fix this. How the hell can i figure out c:\program files\imgSeeknET\ ?
if sys.platform.find('win') != -1: # DIE WINDOWS DIE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
return sys.path[0] + "\\share\\imgSeekNet\\" \
- /isnLib/coreEnv.py:105
default = '/tmp'
if sys.platform.find('win') != -1: # DIE WINDOWS DIE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#TODO: test under winxp and win98. Perhaps read something from registry here ?
default = sys.path[0] + "\\share\\imgSeekLite"
else: \
- /isnLib/img/ShelfDB.py:166
def checkNewFiles(self):
logging.debug('Checking for new files on database directories')
#TODO1: implement
if self.env.opts['imagedb']['check_new_files']: \
- /isnLib/net/imgServer.py:142
#assert(env.app)
env.imgServer = imgServer(env)
try: #TODO2: use opts.server.ext_ip so it binds on the correct ip
#reactor.listenTCP(8789, pb.PBServerFactory(Echoer()))
reactor.listenTCP(sport, pb.PBServerFactory(env.imgServer)) \
- /isnLib/net/imgServer.py:124
def getKarma(self):
"""#TODO2: how do i find out how many connections this pb.Root currently has ?
"""
return 10 \
- /isnLib/img/Img_DB.py:65
#### Thumbnail stuff
if not os.name in ["nt","dos"]: # *NIX system #TODO2: find the proper way for detecting host OS
self.thdir = os.path.expanduser(os.path.join("~",".thumbnails","")) # path for storing thumbnails. Calculate it only once here.
self.thdir2 = os.path.expanduser(os.path.join("~",".thumbnails","normal","")) # path for storing thumbnails. Calculate it only once here. \
- /isnLib/img/Img_DB.py:48
try:
if os.name in ["nt","dos"] or sys.platform in ['win32','cygwin']: # TODO2: find the proper way for detecting host OS
logging.debug("NT/Win32 detected")
import _imgdb as imgdb \
- /isnLib/gui/MainFrame.py:246
self.peersListCtrl.SetStringItem(cnt,1,str(peer.port))
self.peersListCtrl.SetStringItem(cnt,2,self.env.imgClient.stateDict[peer.state])
#TODO2: inspect peer.state and show with a diff color perhaps
def cbDownloadFinished(self,dn): \
- /isnLib/coreEnv.py:84
from what user passed at command line.
#TODO2: perhaps cmdline parsing can move here...
"""
global isnDataDir \
- /isnLib/net/webServer.py:319
env.webServer = WebServer()
############TODO3: remove this crap later:
global mainmenu, htmlhead
funcs = "" \
- /isnLib/net/webServer.py:202
id = extractImageID(request.postpath[0])
if id == -1: #TODO3: return error 404 here
return "Not found..."
data = imgdb.getImgData(id) \
- /isnLib/net/webServer.py:202
id = extractImageID(request.postpath[0])
if id == -1: #TODO3: return error 404 here
return "Not found..."
data = imgdb.getImgData(id) \
- /isnLib/net/webServer.py:202
id = extractImageID(request.postpath[0])
if id == -1: #TODO3: return error 404 here
return "Not found..."
data = imgdb.getImgData(id) \
- /isnLib/net/webServer.py:202
id = extractImageID(request.postpath[0])
if id == -1: #TODO3: return error 404 here
return "Not found..."
data = imgdb.getImgData(id) \
- /isnLib/net/queryManager.py:89
def queryKeyword(self, key, nres):
#TODO3: this should issue queries to other nodes, and not just current
work = [] # list of pairs [imgCLient-object, num_res]
healthy = self.env.peerMgr.getHealthyPeers() # only assign work to nodes connected and rooted \
- /isnLib/net/imgClient.py:28
from time import time # for timeouts
#TODO3: this twisted import code is reused on imgServer. perhaps refactor it ?
try:
from twisted.spread import pb \
- /isnLib/net/peerManager.py:137
peer.deadCount = 0 # was ok, now dead. Reset dead count
continue
try: #TODO3: its annoying to do this check on every callRemote(). How can i refactor it ?
peer.root.callRemote("getStatus").addCallbacks(peer.gotStatus,peer.errStatus)
except DeadReferenceError: \
- /isnLib/img/Img_DB.py:58
#logging.exception("Unable to import c++ image processing module")
print '-'*25 + "\nUnable to import c++ image processing module, make sure imgSeekNet was compiled and installed properly.\nConsult the INSTALL and README files." + '-'*25
self.env.sim_imgdb = None # TODO3: env.sim_imgdb should be checked before being invoked later
sys.exit(1)
else: \
- /isnLib/img/ShelfDB.py:373
self.meta[fid]['JPEGThumbnail'] = "False"
def extractIPTC(self,fid): #TODO3: finish this
"""hook for iptc PIL library.
\
- /isnLib/img/ShelfDB.py:343
return self.images[id][2]
def extractEXIF(self,fid): #TODO3: finish this
"""hook for exif library.
\
- /isnLib/img/ShelfDB.py:242
def regenThumbs(self,force = 0):
"""#TODO3: finish - regenerate missing thumbnails. if force, regen even if they already exist
"""
logging.error("not yet implemented") \
- /isnLib/img/ShelfDB.py:175
logging.error("inconsistent db sizes")
return 0
#TODO3: implement db fix engine here
# should i iterate self.keywords and check for non-existant ids here ?
\
- /isnLib/coreEnv.py:263
"""
#TODO: check permissions
#TODO3: check/create dirs recursively, so all intermediate paths are created
if not os.path.exists(settDir):
logging.debug(settDir + " doesn't exist, creating it.") \
- /isnLib/coreEnv.py:46
'log_level': logging.DEBUG,
'db_module': "ShelfDB",
'db_adddir_batch': 6, # batch size in ImgDB when adding files #TODO3: this should go to imagedb.cfg
'user_download_dir': None,
"ext_ip": "127.0.0.1", \
- /setup.py:154
cmdclass = { 'build_ext': fallible_build_ext},
license = 'GPL2',
#TODO3: this data_files list is an ugly hack. A nominal list should be generated on makedist.sh, and the tarball should be shipped with this listing. This will avoid the problem of the user copying something to isnData, and then when root install imgSeekNet, everything is also copied there inadvertidly
data_files = [("share/imgSeekNet",map(lambda x: 'isnData/'+x, filter(lambda x: x.find('CVS') == -1 and x.find('svn') == -1, os.listdir("isnData"))))], # include all isnData/ contents
#TODO7: find out how to install i18n .mo files on user site. \
- /isnLib/net/queryManager.py:186
#TODO5: this assert on peer state should be refactored somewhere else, so i don't have to do this stupid check on every single remote request :(
assert self.resultMap[id][0].state == imgClient.stRooted, "peer must be rooted before remote request"
#TODO4: do i need to check the return value of a callRemote() call ? or is it ok to blindly invoke the deferred's addCallbacks() immediately ?
try:
self.resultMap[id][0].root.callRemote("getImgData",self.resultMap[id][1]).addCallbacks(self.requestImageOK, self.requestImageErr,[id]) \
- /isnLib/net/imgClient.py:120
def errRoot(self,reason):
self.debug("error getting root object: " + repr(reason))
#TODO4: i should probably create a method called changeState(newstate), which warned peerManager that peer state changed. But i wont, as GUI client doesn't care much about all this peer state changing nonsense
self.state = imgClient.stDead
\
- /isnLib/net/peerManager.py:206
"""returns a list of peers suitable for this query
#TODO4: currently the query is ignored. Later, some known peer info should be used when selecting query target peers
"""
return self.getHealthyPeers() \
- /isnLib/net/peerManager.py:196
def getHealthyPeers(self, local = 1):
"""returns a list of connected and alive peers.
#TODO4: this should be cached for performance reasons. Iterating this on every query forward for example might be slow
"""
if local: \
- /isnLib/net/peerManager.py:45
"can_serve": 1, # accept incoming connections by default
"dead_count_limit": 6, # number of times a node is spotted as dead before it's removed from cache
"average_peer_count": 10, # average number of peers to be connected to. TODO4: this should be adjusted to peer karma or capacity
"peer_request_count": 5, # number of peers should be asked for more peers
} \
- /isnLib/net/imgServer.py:32
except ImportError:
print "Twisted import failed. Attempting alternative dirs"
#TODO4: is there a standard way for also trying user home dir for python modules ?
import os,sys # try to import from other dirs. THIS IS A HACK. WILL BE REMOVED ON A FINAL RELEASE
failsafe = ['/usr/local/lib/python2.2/site-packages', \
- /isnLib/img/ShelfDB.py:207
def addImg(self, fname):
"""TODO4: check if image path already in db
returns -1 on error or newid on success
""" \
- /isnLib/img/ShelfDB.py:190
### Sort keywords by popul
#TODO4: optimize
for k in self.keywords.keys():
cpy = self.keywords[k][:] \
- /isnLib/gui/MainFrame.py:403
def onExceptionMsg(self,type,value,tback):
"""User friendly error handling """ #TODO4: user can't copy/paste the text appended to the listctrl
stack = ''.join(traceback.format_exception(type, value, tback))
\
- /setup.py:60
"""
if sys.platform.find('cygwin') != -1 or sys.platform.find('linux') != -1: # *NIX systems #TODO4: what's the value of sys.platform on other *nix systems
print "*NIX detected"
print "#################################### Check Python development environment" \
- /isnLib/net/queryManager.py:184
return 0
assert self.resultMap[id][0], "invalid (NULL) peer"
#TODO5: this assert on peer state should be refactored somewhere else, so i don't have to do this stupid check on every single remote request :(
assert self.resultMap[id][0].state == imgClient.stRooted, "peer must be rooted before remote request"
#TODO4: do i need to check the return value of a callRemote() call ? or is it ok to blindly invoke the deferred's addCallbacks() immediately ? \
- /isnLib/net/imgClient.py:85
#TODO: better type checks.
self.addr = data[0]
try: # TODO5: investigate: could this reverse name lookup cause a freeze and annoy people ? i think its nice to have it because eventually this avoids having a lot of hostnames info travelling across the network. ips are faster i guess...
import socket
self.addr = socket.gethostbyname(self.addr) \
- /isnLib/net/peerManager.py:166
def getPeers(self, max):
""" returns a list of managed peers """
#TODO5: warning. This function may return max-1 nodes, if the local peer on the max slice
self.peers.sort(sortKarma)
plist = self.peers[:max] \
- /isnLib/net/imgServer.py:113
def remote_getStatus(self):
"""#TODO5: this may be uneeded later...
"""
stat = {'uptime': time() - self.startTime, \
- /isnLib/net/imgServer.py:72
}
#TODO5: implement an access logging system. See how to use a different logging target on the logging module
#TODO: check all functions that receive parameters by remote method invocation, and flag as such, since they demand special attention regarding type checking, data sanity, exploits, etc
class imgServer(pb.Root): \
- /isnLib/img/Img_DB.py:43
logging.error("Twisted reactor not found on environment container. Adding files will fail.")
#TODO5: this is currently hardcoded...
self.supported_ext = ["jpe","jpg","jpeg","png","bmp","png","gif","tiff"]
logging.info("[supported_ext] = %s" % self.supported_ext) \
- /isnLib/gui/MainFrame.py:353
for id in idlist:
if not self.env.queryMgr.requestImage(id):
#TODO5: add this (and other) errors to the status window
self.showMessage("Error requesting image.",wxICON_ERROR)
return \
- /isnLib/gui/MainFrame.py:295
def onThumbActivated_queryByID(self,evt):
#TODO5: abstract thumblist usage, so i can use better iconview implementation (custom widgets) later.
id = evt.GetData()
sig = self.env.imgdb.calcSig(self.thumbSwapName(id)) \
- /isnLib/gui/MainFrame.py:224
def onAddDir(self,evt):
newKey = self.newKeyCtrl.GetValue()
if 0:#not newKey: #TODO5: make this nag msg an option and improve nag message
self.showMessage("You are not setting keywords to the images about to be added. It's important for images to have a keyword, so they can be searched by text later.")
self.env.imgdb.addDir(self.dirTree.GetPath(), \
- /isnLib/__init__.py:50
logging.getLogger("").addHandler(hdlr)
#TODO5: there is also a similar log handler setup code on gui/MainFrame.py:__init__
setFileLog()
setStdErrLog() \
- /isnLib/net/peerManager.py:158
self.env.reactor.callLater(self.env.opts['net']['refresh_status_interval'], self.refreshPeers)
self.onPeerChange() # update UI #TODO6: perhaps i should only invoke this is there was indeed a peer change. So i'd use a hasChanged var on this fcn
def maintain(self): \
- /isnLib/net/peerManager.py:152
peer.connect() # try to connect again
# check if more peers are needed
#TODO6: verify if a node will be constantly requesting more peers
diff = self.env.opts['net']['average_peer_count'] - healthyPeers
if diff > 0: \
- /isnLib/img/Img_DB.py:134
def generateImageID(self):
""" need to return something unique"""
#TODO6: is this random hack safe ? should I hash a resource somehow ? should I check if this ID already exists somewhere ? How much will extra checks slow things down ?
try:
a = random.randrange(999999999) \
- /isnLib/img/ShelfDB.py:401
self.meta[fid][k] = metacache[k]
class Category: #TODO6: place this class somewhere else
""" Not yet used, and probably never will
This class is a node for the category tree \
- /isnLib/gui/MainFrame.py:479
"""%str(__version__), wxCENTRE|wxICON_INFORMATION)
"""#TODO6: implement tray icon:
Flashing exmaple (win): http://wiki.wxpython.org/index.cgi/FlashingTaskbarIcon
Simple Linux example: http://varmint.moongroup.com/pipermail/xfce4-dev/2003-April/003447.html \
- /isnLib/gui/MainFrame.py:325
"""called when user right-clicks thumbnail
"""
#TODO6: make sure that when a rightclickevt occurs, the item is selected. Right now user has to click on image, and then rightclick for context menu
pos = evt.GetPoint()
menu = wxMenu() \
- /isnLib/gui/MainFrame.py:284
return
#ix = self.thumbImageList.Add(wxBitmapFromBits(data, 128,128))
#TODO6: there is no need to save a temp swap file with bitmap data, find out why the line above doesn't work. ie. using wxBitmapFromBits with binary data read from file won't work. I get an empty image.
ix = self.thumbImageList.Add(wxBitmap(fswap))
os.remove(fswap) \
- /isnLib/imgSeekNetApp.py:76
opts, args = getopt.getopt(sys.argv[1:], "dxsh", ["help", "logfile=", "adddir=","addnr","webport=","config=","extip="])
except getopt.GetoptError:
print 'Invalid command line parameter' #TODO6: print which command caused the error
showUsage()
\
- /isnLib/img/Img_DB.py:283
rsc = -100.0*rsc/34.50
#sanity checks
#TODO7: investigate why some results are above 100 or below 0
if rsc < 0: rsc = 0
if rsc > 100: rsc = 100 \
- /isnLib/img/Img_DB.py:211
apply(callback[0], [status] + callback[1])
#TODO7: should i sync on every db add ?
#if added: self.env.imgdb.sync()
\
- /isnLib/coreEnv.py:49
'user_download_dir': None,
"ext_ip": "127.0.0.1",
'pbport': 8848, # default port to listen to. TODO7: make it random
}
\
- /setup.py:156
#TODO3: this data_files list is an ugly hack. A nominal list should be generated on makedist.sh, and the tarball should be shipped with this listing. This will avoid the problem of the user copying something to isnData, and then when root install imgSeekNet, everything is also copied there inadvertidly
data_files = [("share/imgSeekNet",map(lambda x: 'isnData/'+x, filter(lambda x: x.find('CVS') == -1 and x.find('svn') == -1, os.listdir("isnData"))))], # include all isnData/ contents
#TODO7: find out how to install i18n .mo files on user site.
packages=['isnLib','isnLib.gui','isnLib.img','isnLib.net',],
scripts= ['imgSeekNet'], \
- /isnLib/net/imgServer.py:84
logging.debug('Local node external ip: [%s]' % self.env.opts['core']['ext_ip'])
#TODO9: refactor this. It could be a dict of modules and methods to expose
# ImgDB methods to expose
\
- /isnLib/gui/MainFrame.py:430
def onImportQuery(self,event):
dlg = wxFileDialog(self,"Choose an image", self.lastImportQueryDir, "","Supported images|*.bmp;*.gif;*.tiff;*.png;*.jpg;*.jpeg;*.jpe|All files (*)|*.*" ) #TODO9: set wildcard according to supported extensions
if dlg.ShowModal() == wxID_OK:
chosen = dlg.GetPath() \
- /isnLib/gui/MainFrame.py:255
nIdx = self.thumbList.InsertStringItem(0, "%.2f %%" % item[1])
assert nIdx != -1, "error inserting string"
#TODO9: i guess the error return value is -1. TEST
self.thumbList.SetItemData(nIdx, item[0])
\
- /isnLib/imgSeekNetApp.py:220
env.peerMgr.refreshPeers()
if 0: # TODO9: run the profiling code below:
# example code
import profile \