bitmagnet-cvs Mailing List for BitMagnet
Brought to you by:
d0c54v4g3
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(19) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: d0c 5. <d0c...@us...> - 2005-01-13 21:30:26
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5252 Modified Files: g3rss.py Log Message: Small changes to fix display problem 0x0A now removed from the end of row data . Index: g3rss.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/g3rss.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- g3rss.py 12 Jan 2005 19:03:25 -0000 1.4 +++ g3rss.py 13 Jan 2005 21:30:13 -0000 1.5 @@ -312,7 +312,8 @@ titlelink = entry.get('link', "") entrytitle = entry.get('title', "") entrysummary = entry.get('summary', "") - row = (html2text(entrytitle), url) + fixed_row = html2text(entrytitle) + row = (fixed_row[:len(fixed_row)-1], url) # removes CR from end of string (thanks to Matias for spotting this one) key = hash(row) self.rowdata.append(row) self.descriptions[key] = feedbase, feedtitle, titlelink, entrytitle , entrysummary, url @@ -400,14 +401,6 @@ print "ERROR: reading from RSS ini file" - def unescape(self, m): - print m - code = m.group(1) - if code.isdigit(): code = int(code) - else: code = int(code[1:], 16) - if code<256: return chr(code) - else: unichr(code) - if __name__ == "__main__": app = wx.PySimpleApp() frame = wx.Frame(None, -1, '', size=(800,500)) |
From: d0c 5. <d0c...@us...> - 2005-01-12 19:03:35
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2226 Modified Files: g3rss.py Log Message: Fixed an issue where non-english characters were not being displayed correctly in the list window. Lets try that again... Index: g3rss.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/g3rss.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- g3rss.py 12 Jan 2005 19:02:00 -0000 1.3 +++ g3rss.py 12 Jan 2005 19:03:25 -0000 1.4 @@ -23,7 +23,6 @@ from threading import Thread from os.path import join import HTMLParser -import iso2unicode _ = lambda x: x # for internationalisation |
From: d0c 5. <d0c...@us...> - 2005-01-12 19:02:13
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1908 Modified Files: g3rss.py Added Files: html2text.py Log Message: Fixed an issue where non-english characters were not being displayed correctly in the list window. Index: g3rss.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/g3rss.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- g3rss.py 10 Jan 2005 16:33:15 -0000 1.2 +++ g3rss.py 12 Jan 2005 19:02:00 -0000 1.3 @@ -22,6 +22,8 @@ from string import split from threading import Thread from os.path import join +import HTMLParser +import iso2unicode _ = lambda x: x # for internationalisation @@ -270,6 +272,8 @@ def Populate(self, e=None): + from html2text import html2text + self.html.SetPage("") self.rowdata = [] self.descriptions = {} @@ -288,32 +292,28 @@ result = parse(url) + if result.entries: - if result['entries']: - feed = result['feed'] #feed title - feedtitle = feed.get('title', "") + feedtitle = result.feed.title #base URL - feedlink = feed.get('links', "") - feedbase = feedlink[0].get('href2', "") + feedlink = result.feed.link + feedbase = result.feed.title_detail.base - for entry in result['entries']: + for entry in result.entries: #print entry - enclosures = entry.get('enclosures') - links = entry.get('links') + url = "..." - - if enclosures: - url = enclosures[0].get('url') - else: - url = links[0].get('href') + try: + url = entry.enclosures.url + except: + url = entry.links[0].href titlelink = entry.get('link', "") entrytitle = entry.get('title', "") entrysummary = entry.get('summary', "") - - row = (entrytitle, url) + row = (html2text(entrytitle), url) key = hash(row) self.rowdata.append(row) self.descriptions[key] = feedbase, feedtitle, titlelink, entrytitle , entrysummary, url @@ -401,6 +401,14 @@ print "ERROR: reading from RSS ini file" + def unescape(self, m): + print m + code = m.group(1) + if code.isdigit(): code = int(code) + else: code = int(code[1:], 16) + if code<256: return chr(code) + else: unichr(code) + if __name__ == "__main__": app = wx.PySimpleApp() frame = wx.Frame(None, -1, '', size=(800,500)) --- NEW FILE: html2text.py --- """html2text: Turn HTML into equivalent Markdown-structured text.""" __version__ = "2.23" __author__ = "Aaron Swartz (me...@aa...)" __copyright__ = "(C) 2004 Aaron Swartz. GNU GPL 2." __contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes"] # TODO: # Support decoded entities with unifiable. # Relative URL resolution if not hasattr(__builtins__, 'True'): True, False = 1, 0 import re, sys, urllib, htmlentitydefs, codecs, StringIO, types import sgmllib sgmllib.charref = re.compile('&#([xX]?[0-9a-fA-F]+)[^0-9a-fA-F]') try: from textwrap import wrap except: pass # Use Unicode characters instead of their ascii psuedo-replacements UNICODE_SNOB = 1 # Put the links after each paragraph instead of at the end. LINKS_EACH_PARAGRAPH = 0 # Wrap long lines at position. 0 for no wrapping. (Requires Python 2.3.) BODY_WIDTH = 0 ### Entity Nonsense ### def name2cp(k): if k == 'apos': return ord("'") if hasattr(htmlentitydefs, "name2codepoint"): # requires Python 2.3 return htmlentitydefs.name2codepoint[k] else: k = htmlentitydefs.entitydefs[k] if k.startswith("&#") and k.endswith(";"): return int(k[2:-1]) # not in latin-1 return ord(codecs.latin_1_decode(k)[0]) unifiable = {'rsquo':"'", 'lsquo':"'", 'rdquo':'"', 'ldquo':'"', 'copy':'(C)', 'mdash':'--', 'nbsp':' ', 'rarr':'->', 'larr':'<-', 'middot':'*', 'ndash':'-', 'oelig':'oe', 'aelig':'ae', 'agrave':'a', 'aacute':'a', 'acirc':'a', 'atilde':'a', 'auml':'a', 'aring':'a', 'egrave':'e', 'eacute':'e', 'ecirc':'e', 'euml':'e', 'igrave':'i', 'iacute':'i', 'icirc':'i', 'iuml':'i', 'ograve':'o', 'oacute':'o', 'ocirc':'o', 'otilde':'o', 'ouml':'o', 'ugrave':'u', 'uacute':'u', 'ucirc':'u', 'uuml':'u'} unifiable_n = {} for k in unifiable.keys(): unifiable_n[name2cp(k)] = unifiable[k] def charref(name): if name[0] in ['x','X']: c = int(name[1:], 16) else: c = int(name) if not UNICODE_SNOB and c in unifiable_n.keys(): return unifiable_n[c] else: return unichr(c) def entityref(c): if not UNICODE_SNOB and c in unifiable.keys(): return unifiable[c] else: try: name2cp(c) except KeyError: return "&" + c else: return unichr(name2cp(c)) def replaceEntities(s): s = s.group(1) if s[0] == "#": return charref(s[1:]) else: return entityref(s) r_unescape = re.compile(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));") def unescape(s): return r_unescape.sub(replaceEntities, s) def fixattrs(attrs): # Fix bug in sgmllib.py if not attrs: return attrs newattrs = [] for attr in attrs: newattrs.append((attr[0], unescape(attr[1]))) return newattrs ### End Entity Nonsense ### def onlywhite(line): """Return true if the line does only consist of whitespace characters.""" for c in line: if c is not ' ' and c is not ' ': return c is ' ' return line def optwrap(text): """Wrap all paragraphs in the provided text.""" if not BODY_WIDTH: return text assert wrap # Requires Python 2.3. result = '' newlines = 0 for para in text.split("\n"): if len(para) > 0: if para[0] is not ' ' and para[0] is not '-' and para[0] is not '*': for line in wrap(para, BODY_WIDTH): result += line + "\n" result += "\n" newlines = 2 else: if not onlywhite(para): result += para + "\n" newlines = 1 else: if newlines < 2: result += "\n" newlines += 1 return result def hn(tag): if tag[0] == 'h' and len(tag) == 2: try: n = int(tag[1]) if n in range(1, 10): return n except ValueError: return 0 class _html2text(sgmllib.SGMLParser): def __init__(self, out=sys.stdout.write): sgmllib.SGMLParser.__init__(self) if out is None: self.out = self.outtextf else: self.out = out self.outtext = u'' self.quiet = 0 self.p_p = 0 self.outcount = 0 self.start = 1 self.space = 0 self.a = [] self.astack = [] self.acount = 0 self.list = [] self.blockquote = 0 self.pre = 0 self.startpre = 0 self.lastWasNL = 0 def outtextf(self, s): if type(s) is type(''): s = codecs.utf_8_decode(s)[0] self.outtext += s def close(self): sgmllib.SGMLParser.close(self) self.pbr() self.o('', 0, 'end') return self.outtext def handle_charref(self, c): self.o(charref(c)) def handle_entityref(self, c): self.o(entityref(c)) def unknown_starttag(self, tag, attrs): self.handle_tag(tag, attrs, 1) def unknown_endtag(self, tag): self.handle_tag(tag, None, 0) def previousIndex(self, attrs): """ returns the index of certain set of attributes (of a link) in the self.a list If the set of attributes is not found, returns None """ if not attrs.has_key('href'): return None i = -1 for a in self.a: i += 1 match = 0 if a.has_key('href') and a['href'] == attrs['href']: if a.has_key('title') or attrs.has_key('title'): if (a.has_key('title') and attrs.has_key('title') and a['title'] == attrs['title']): match = True else: match = True if match: return i def handle_tag(self, tag, attrs, start): attrs = fixattrs(attrs) if hn(tag): self.p() if start: self.o(hn(tag)*"#" + ' ') if tag in ['p', 'div']: self.p() if tag == "br" and start: self.o(" \n") if tag == "hr" and start: self.p() self.o("* * *") self.p() if tag in ["head", "style", 'script']: if start: self.quiet += 1 else: self.quiet -= 1 if tag == "blockquote": if start: self.p(); self.o('> ', 0, 1); self.start = 1 self.blockquote += 1 else: self.blockquote -= 1 self.p() if tag in ['em', 'i', 'u']: self.o("_") if tag in ['strong', 'b']: self.o("**") if tag == "code" and not self.pre: self.o('`') #TODO: `` `this` `` if tag == "a": if start: attrsD = {} for (x, y) in attrs: attrsD[x] = y attrs = attrsD if attrs.has_key('href'): self.astack.append(attrs) self.o("[") else: self.astack.append(None) else: if self.astack: a = self.astack.pop() if a: i = self.previousIndex(a) if i is not None: a = self.a[i] else: self.acount += 1 a['count'] = self.acount a['outcount'] = self.outcount self.a.append(a) self.o("][" + `a['count']` + "]") if tag == "img" and start: attrsD = {} for (x, y) in attrs: attrsD[x] = y attrs = attrsD if attrs.has_key('src'): attrs['href'] = attrs['src'] alt = attrs.get('alt', '') i = self.previousIndex(attrs) if i is not None: attrs = self.a[i] else: self.acount += 1 attrs['count'] = self.acount attrs['outcount'] = self.outcount self.a.append(attrs) self.o("![") self.o(alt) self.o("]["+`attrs['count']`+"]") if tag in ["ol", "ul"]: if start: self.list.append({'name':tag, 'num':0}) else: if self.list: self.list.pop() self.p() if tag == 'li': if start: self.pbr() if self.list: li = self.list[-1] else: li = {'name':'ul', 'num':0} self.o(" "*len(self.list)) #TODO: line up <ol><li>s > 9 correctly. if li['name'] == "ul": self.o("* ") elif li['name'] == "ol": li['num'] += 1 self.o(`li['num']`+". ") self.start = 1 else: self.pbr() if tag in ['tr']: self.pbr() if tag == "pre": if start: self.startpre = 1 self.pre = 1 else: self.pre = 0 self.p() def pbr(self): if self.p_p == 0: self.p_p = 1 def p(self): self.p_p = 2 def o(self, data, puredata=0, force=0): if not self.quiet: if puredata and not self.pre: data = re.sub('\s+', ' ', data) if data and data[0] == ' ': self.space = 1 data = data[1:] if not data and not force: return if self.startpre: #self.out(" :") #TODO: not output when already one there self.startpre = 0 bq = (">" * self.blockquote) if not (force and data and data[0] == ">") and self.blockquote: bq += " " if self.pre: bq += " " data = data.replace("\n", "\n"+bq) if self.start: self.space = 0 self.p_p = 0 self.start = 0 if force == 'end': # It's the end. self.p_p = 0 self.out("\n") self.space = 0 if self.p_p: self.out(('\n'+bq)*self.p_p) self.space = 0 if self.space: if not self.lastWasNL: self.out(' ') self.space = 0 if self.a and ((self.p_p == 2 and LINKS_EACH_PARAGRAPH) or force == "end"): if force == "end": self.out("\n") newa = [] for link in self.a: if self.outcount > link['outcount']: self.out(" ["+`link['count']`+"]: " + link['href']) #TODO: base href if link.has_key('title'): self.out(" ("+link['title']+")") self.out("\n") else: newa.append(link) if self.a != newa: self.out("\n") # Don't need an extra line when nothing was done. self.a = newa self.p_p = 0 self.out(data) self.lastWasNL = data and data[-1] == '\n' self.outcount += 1 def handle_data(self, data): self.o(data, 1) def unknown_decl(self, data): pass def html2text_file(html, out=sys.stdout.write): h = _html2text(out) h.feed(html) h.feed("") return h.close() def html2text(html): return optwrap(html2text_file(html, None)) if __name__ == "__main__": if sys.argv[1:]: arg = sys.argv[1] if arg.startswith('http://'): data = urllib.urlopen(arg).read() else: data = open(arg, 'r').read() else: data = sys.stdin.read() html2text_file(data) |
From: d0c 5. <d0c...@us...> - 2005-01-10 16:33:26
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26152 Modified Files: g3rss.py Log Message: Added a save feature. Index: g3rss.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/g3rss.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- g3rss.py 24 Nov 2004 09:49:30 -0000 1.1 +++ g3rss.py 10 Jan 2005 16:33:15 -0000 1.2 @@ -1,69 +1,63 @@ #----------------------------------------------------------------------------- -# Name: g3listctrl.py +# Name: g3rss.py # Purpose: # -# Author: Jeremy Arendt +# Author: d0c 54v4g3, Jeremy Arendt # # Created: 2004/23/02 -# RCS-ID: $Id$ +# RCS-ID: $Id: # Copyright: (c) 2002 # Licence: See G3.LICENCE.TXT #----------------------------------------------------------------------------- import wx import wx.html as html +import webbrowser +import urlparse +import ConfigParser from wx.lib.mixins.listctrl import ColumnSorterMixin, ListCtrlAutoWidthMixin from btconfig import BTConfig from images import Images from g3listctrl import * from feedparser import parse +from string import split +from threading import Thread +from os.path import join +_ = lambda x: x # for internationalisation class RSSList(G3ListCtrl, ListCtrlAutoWidthMixin, ColumnSorterMixin): - def __init__(self, parent, btconfig, bmps=None, onclickfunc=None, ondblclickfunc=None): + def __init__(self, parent, btconfig, bmps=None, onclickfunc=None, ondblclickfunc=None, onurlfunc=None, onbrowfunc=None, oncopyfunc=None): G3ListCtrl.__init__(self, parent, btconfig, "RSSList", size=(100,100)) self.CmdOnClick = onclickfunc self.CmdDblClick = ondblclickfunc + self.CmdURL = onurlfunc + self.CmdBrowFunc = onbrowfunc + self.CmdCopyFunc = oncopyfunc self.btconfig = btconfig ListCtrlAutoWidthMixin.__init__(self) ColumnSorterMixin.__init__(self, 2) self.itemDataMap = {} self.list_rows = {} - - #commented all image related stuff out to stop error with image path - #if bmps == None: - # bmps = Images(self.btconfig['path']) - + self.previtem = 0 # used to limit html refresh to once a selection self.pl_unchoked = wx.Color(255,255,240) - - #self.images = [1] * 4 - #self.i_list = wx.ImageList(12, 12) - #mask_color = wx.Color(255,255,255) - #b_mask_color = wx.Color(0,0,0) - #self.images[0] = self.i_list.AddWithColourMask(bmps.GetImage('blank.bmp'), b_mask_color) - #self.images[1] = self.i_list.AddWithColourMask(bmps.GetImage('usergreen.png'), mask_color) - #self.images[2] = self.i_list.AddWithColourMask(bmps.GetImage('userblue.png'), mask_color) - #self.images[3] = self.i_list.AddWithColourMask(bmps.GetImage('userred.png'), mask_color) - - #self.SetImageList(self.i_list, wx.IMAGE_LIST_SMALL) self.col2sort = 1 self.ascending = False - cols = [ [True, "Title", wx.LIST_FORMAT_LEFT, 300], - [True, "URL", wx.LIST_FORMAT_LEFT, 400], + cols = [ [True, _("Title"), wx.LIST_FORMAT_LEFT, 300], + [True, _("URL"), wx.LIST_FORMAT_LEFT, 400], ] self.InsertColumns(cols) self.SetEbedCol(1) -## wx.EVT_LIST_COL_CLICK(self, -1, self.OnColClick) -## wx.EVT_COMMAND_RIGHT_CLICK(self, -1, self.OnRightClick) # wxMSW -## wx.EVT_RIGHT_UP(self, self.OnRightClick) # wxGTK - wx.EVT_LIST_ITEM_ACTIVATED(self, -1, self.OnDblClick) wx.EVT_COMMAND_LEFT_CLICK(self, -1, self.OnClick) # wxMSW wx.EVT_LEFT_UP(self, self.OnClick) # wxGTK + wx.EVT_COMMAND_RIGHT_CLICK(self, -1, self.OnListRightClick) # wxMSW + wx.EVT_RIGHT_UP(self, self.OnListRightClick) # wxGTK + def GetSelectedData(self): if self.GetFirstSelected() != -1: return self.GetItemData( self.GetFirstSelected() ) @@ -77,11 +71,48 @@ self.CmdDblClick(key) def OnClick(self, event): - if self.CmdDblClick: + if self.CmdOnClick: key = self.GetSelectedData() - if self.itemDataMap.has_key(key): + if self.itemDataMap.has_key(key) and key != self.previtem: self.CmdOnClick(key) + self.previtem = key + + def OnListRightClick(self, event): + if not hasattr(self, "_popup_id"): + self._popup_id = [] + for i in range(0, 2): + self._popup_id.append(wx.NewId()) + + wx.EVT_MENU(self, self._popup_id[0], self.MenuOnCopy) + wx.EVT_MENU(self, self._popup_id[1], self.MenuOnBrowser) + + listmenu = wx.Menu() + + listmenu.Append(self._popup_id[0], _("Copy URL to clipboard"), _("Copy URL to clipboard")) + listmenu.Append(self._popup_id[1], _("Open URL in Default Browser"), _("Open URL in Default Browser")) + + self.PopupMenu(listmenu, self.ScreenToClient(wx.GetMousePosition())) + listmenu.Destroy() + + def MenuOnCopy(self, event): + if self.CmdCopyFunc: + key = self.GetSelectedData() + if self.itemDataMap.has_key(key): + self.CmdCopyFunc(key) + + def MenuOnBrowser(self, event): + if self.CmdBrowFunc: + key = self.GetSelectedData() + if self.itemDataMap.has_key(key): + self.CmdBrowFunc(key) + + def OnURL(self, event): + if self.CmdDblClick: + key = self.GetSelectedData() + if self.itemDataMap.has_key(key): + self.CmdDblClick(key) + def GetListCtrl(self): return self @@ -98,14 +129,36 @@ html.HtmlWindow.__init__(self, parent, -1, size=(-1,80), style=wx.SUNKEN_BORDER|wx.NO_FULL_REPAINT_ON_RESIZE) self.SetBorders(4) self.CmdAddFunc = addfunc - + wx.EVT_COMMAND_RIGHT_CLICK(self, -1, self.OnRightClick) # wxMSW + wx.EVT_RIGHT_UP(self, self.OnRightClick) # wxGTK + def OnLinkClicked(self, link): if ".torrent" in link.GetHref(): if self.CmdAddFunc: self.CmdAddFunc(link.GetHref()) - + + def OnRightClick(self, event): + if not hasattr(self, "htmlpopID1"): + self.htmlpopID1 = wx.NewId() + wx.EVT_MENU(self, self.htmlpopID1, self.OnViewSource) + + htmlmenu = wx.Menu() + htmlmenu.Append(self.htmlpopID1, _("View Source"), _("View Source")) + self.PopupMenu(htmlmenu, self.ScreenToClient(wx.GetMousePosition())) + htmlmenu.Destroy() + + def OnViewSource(self, event): + import wx.lib.dialogs + + source = self.GetParser().GetSource() + + dlg = wx.lib.dialogs.ScrolledMessageDialog(self, source, "HTML Source") + dlg.ShowModal() + dlg.Destroy() + + class RSSPanel(wx.Panel): - def __init__(self, parent, btconfig, pos=wx.DefaultPosition, size=(100,100), + def __init__(self, parent, btconfig, path="", pos=wx.DefaultPosition, size=(100,100), bmps = None, addfunc=None): wx.Panel.__init__(self, parent, -1) @@ -113,33 +166,58 @@ self.AddTorrent = addfunc self.rowdata = [] + self.feeds = [] self.descriptions = {} - - self.list = RSSList(self, btconfig, onclickfunc=self.OnClick, ondblclickfunc=self.OnDblClick) - self.html = HTMLDescrption(self, btconfig, addfunc=self.AddTorrent) - - c = ["http://www.legaltorrents.com/rss.xml", "http://www.theinquirer.net/inquirer.rss"] - self.editurl = wx.ComboBox(self, -1, "", size=(200,20), choices=c) - self.editurl.SetValue(c[0]) - updatebutt = wx.Button(self, -1, "Update") + self.rendering = False + self.rss_file = join(path, "rssfeeds.ini") + self.splitter = wx.SplitterWindow(self, -1, style=wx.SP_3D|wx.SP_BORDER) + self.htmlpanel = wx.Panel(self.splitter, -1) + self.listpanel = wx.Panel(self.splitter, -1) + self.list = RSSList(self.listpanel, btconfig, onclickfunc=self.OnClick, ondblclickfunc=self.OnDblClick, onurlfunc=self.OnURL, onbrowfunc=self.OnBrowser, oncopyfunc=self.OnCopy) + self.html = HTMLDescrption(self.htmlpanel, btconfig, addfunc=self.AddTorrent) + self.LoadFeeds() # Get feeds from rss ini + self.editurl = wx.ComboBox(self, -1, "", size=(200,20), choices=self.feeds) + if self.feeds: + self.editurl.SetValue(self.feeds[0]) - topsizer = wx.FlexGridSizer() - topsizer.AddGrowableCol(0) - topsizer.Add(self.editurl, 1, wx.EXPAND) - topsizer.Add(updatebutt) + updatebutt = wx.Button(self, -1, _("Update")) + amendbutt = wx.Button(self, -1, _("Add/Del")) - colsizer = wx.FlexGridSizer(cols=1) + colsizer = wx.FlexGridSizer(2, 1, 0, 0) + htmlsizer = wx.FlexGridSizer(1, 1, 0, 0) + listsizer = wx.FlexGridSizer(1, 1, 0, 0) + topsizer = wx.FlexGridSizer(1, 3, 0, 0) + topsizer.Add(amendbutt, 0, wx.FIXED_MINSIZE, 0) + topsizer.Add(self.editurl, 0, wx.EXPAND|wx.ADJUST_MINSIZE|wx.FIXED_MINSIZE, 0) + topsizer.Add(updatebutt, 0, wx.FIXED_MINSIZE, 0) + topsizer.AddGrowableCol(1) + colsizer.Add(topsizer, 1, wx.EXPAND, 0) + listsizer.Add(self.list, 1, wx.EXPAND, 0) + self.listpanel.SetAutoLayout(True) + self.listpanel.SetSizer(listsizer) + listsizer.Fit(self.listpanel) + listsizer.SetSizeHints(self.listpanel) + listsizer.AddGrowableRow(0) + listsizer.AddGrowableCol(0) + htmlsizer.Add(self.html, 0, wx.EXPAND|wx.FIXED_MINSIZE, 0) + self.htmlpanel.SetAutoLayout(True) + self.htmlpanel.SetSizer(htmlsizer) + htmlsizer.Fit(self.htmlpanel) + htmlsizer.SetSizeHints(self.htmlpanel) + htmlsizer.AddGrowableRow(0) + htmlsizer.AddGrowableCol(0) + self.splitter.SplitHorizontally(self.listpanel, self.htmlpanel, 153) + colsizer.Add(self.splitter, 1, wx.EXPAND, 1) + self.SetAutoLayout(True) + self.SetSizer(colsizer) + colsizer.Fit(self) + colsizer.SetSizeHints(self) colsizer.AddGrowableRow(1) colsizer.AddGrowableCol(0) - - colsizer.Add(topsizer, 1, wx.EXPAND|wx.FIXED_MINSIZE) - colsizer.Add(self.list, 1, wx.EXPAND|wx.FIXED_MINSIZE) - colsizer.Add(self.html, 1, wx.EXPAND|wx.FIXED_MINSIZE) - - self.SetSizer(colsizer) - self.Layout() + wx.EVT_BUTTON(self, updatebutt.GetId(), self.Populate) + wx.EVT_BUTTON(self, amendbutt.GetId(), self.Amend) wx.EVT_SIZE(self, self.OnSize) def AddTorrent(self, url): @@ -149,18 +227,53 @@ self.Layout() def OnClick(self, key): + wx.CallAfter(self.RenderHtml, self.RenderHtml(key)) + + def OnDblClick(self, key): desc = self.descriptions.get(key) if desc: - self.html.SetPage(desc[0]) - - def OnDblClick(self, key): + self.AddTorrent(desc[5]) + + def OnBrowser(self, key): desc = self.descriptions.get(key) if desc: - self.AddTorrent(desc[1]) - + Thread(target = self._OpenUrl, args = [desc[5]]).start() + + def OnCopy(self, key): + desc = self.descriptions.get(key) + if desc: + clipdata = wx.TextDataObject() + clipdata.SetText(desc[5]) + wx.TheClipboard.Open() + wx.TheClipboard.SetData(clipdata) + wx.TheClipboard.Close() + + def OnURL(self, key, type=0): + wx.CallAfter(self.RenderHtml, self.RenderHtml(key)) + + + def Amend(self, event): + item = self.editurl.GetValue() + key = self.editurl.GetSelection() + if item: + if item in self.feeds: + self.feeds.remove(item) + else: + self.feeds.append(item) + + print self.feeds + self.SaveFeeds() ## Save Changes + self.editurl.Clear() + if self.feeds: # repopulate combobox + for f in self.feeds: + self.editurl.Append(f) + + def Populate(self, e=None): self.html.SetPage("") - + self.rowdata = [] + self.descriptions = {} + url = self.editurl.GetValue() i = 0 found = False @@ -174,28 +287,118 @@ self.editurl.Insert(url, 0) result = parse(url) - self.rowdata = [] - self.descriptions = {} - - for entry in result['entries']: -## for key, item in entry.items(): -## print key - - enclosures = entry.get('enclosures') - links = entry.get('links') - url = "..." - - if enclosures: - url = enclosures[0].get('url') - else: - url = links[0].get('href') - row = (entry.get('title',""), url) + + if result['entries']: + feed = result['feed'] + #feed title + feedtitle = feed.get('title', "") + + #base URL + feedlink = feed.get('links', "") + feedbase = feedlink[0].get('href2', "") + + for entry in result['entries']: + #print entry + enclosures = entry.get('enclosures') + links = entry.get('links') + url = "..." + + if enclosures: + url = enclosures[0].get('url') + else: + url = links[0].get('href') + + titlelink = entry.get('link', "") + entrytitle = entry.get('title', "") + entrysummary = entry.get('summary', "") + + row = (entrytitle, url) + key = hash(row) + self.rowdata.append(row) + self.descriptions[key] = feedbase, feedtitle, titlelink, entrytitle , entrysummary, url + + self.list.Populate(self.rowdata) + else: + row = (_("No data in RSS feed"),"...") key = hash(row) self.rowdata.append(row) - self.descriptions[key] = ("<font size='2'>" + str(entry.get('description', "")) + "</font>", url) + self.list.Populate(self.rowdata) + + + def RenderHtml(self, key): + desc = self.descriptions.get(key) + if desc and not self.rendering: + self.rendering = True + page = "<html> \n" \ + +"<head> \n" \ + +" <base href=" + desc[0] + "> \n" \ + +"</head> \n" \ + +"<body> \n" \ + +" <table width='100%' bgcolor='#cccccc' cellpadding='0' cellspacing='0' border='0'> \n" \ + +" <tr><td> \n" \ + +" <font face='Verdana,Sans-serif' size=10pt color='#000000'><a href='" + desc[0] + "'><b>Feed: </b>" + desc[1] + "</a><br> \n" \ + +" <a href='" + desc[2] + "'><b>Title: </b>" + desc[3] + "</a><br></font> \n" \ + +" </td><td align='right'> \n" \ + +" </td></tr> \n" \ + +" <tr bgcolor='#666666' height='1'><td colspan='2'></td></tr> \n" \ + +" </table> \n" \ + +" <table width='100%' cellpadding='2' cellspacing='2' border='0'><tr><td> \n" \ + +" " + desc[4] +" \n" \ + +" </td></tr> \n" \ + +" </table> \n" \ + +" </body> \n" \ + +"</html> \n" + self.html.SetPage(page) + self.rendering = False + + + def _OpenUrl(self, url): + try: + + webbrowser.open_new(url) + except: + pass + - self.list.Populate(self.rowdata) + def OnUrlClick(self, event): + url = self.tlabels[1].GetLabel() + url = "http://%s/" % (urlparse.urlparse(url)[1]) + Thread(target = self._OpenUrl, args = [url]).start() + + + def SaveFeeds(self): + print 'Saving RSS Feeds' + try: + cp = ConfigParser.ConfigParser() + cp.add_section('RSS feeds') + i = 0 + for f in self.feeds: + cp.set('RSS feeds', str(i), f) + i += 1 + + file = open(self.rss_file, 'w') + cp.write(file) + file.close() + except: + print "ERROR: writing to RSS ini file" + + + def LoadFeeds(self): + print 'Loading RSS Feeds' + try: + cp = ConfigParser.ConfigParser() + file = open(self.rss_file, 'r') + cp.readfp(file) + items = cp.items('RSS feeds') + + for key, param in items: + self.feeds.append(param) + + file.close() + except: + + print "ERROR: reading from RSS ini file" if __name__ == "__main__": |
From: d0c 5. <d0c...@us...> - 2005-01-03 21:58:33
|
Update of /cvsroot/bitmagnet/BitMagnet/BitTorrent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4073/BitTorrent Modified Files: download.py getencdata.py zurllib.py Log Message: Updated source to run with Python 2.4 and wxpython 2.5.3.1 unicode. Index: zurllib.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/BitTorrent/zurllib.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- zurllib.py 1 Dec 2004 08:32:47 -0000 1.2 +++ zurllib.py 3 Jan 2005 21:58:19 -0000 1.3 @@ -1,112 +1,70 @@ +# The contents of this file are subject to the BitTorrent Open Source License +# Version 1.0 (the License). You may not copy or use this file, in either +# source code or executable form, except in compliance with the License. You +# may obtain a copy of the License at http://www.bittorrent.com/license/. # -# zurllib.py -# -# This is (hopefully) a drop-in for urllib which will request gzip/deflate -# compression and then decompress the output if a compressed response is -# received while maintaining the API. -# -# by Robert Stone 2/22/2003 -# +# Software distributed under the License is distributed on an AS IS basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. -from urllib import * -from urllib2 import * +# Written by John Hoffman + +from httplib import HTTPConnection +from urlparse import urlparse +import socket from gzip import GzipFile from StringIO import StringIO -from __init__ import version -import pprint - - -DEBUG=0 - - -class HTTPContentEncodingHandler(HTTPHandler): - """Inherit and add gzip/deflate/etc support to HTTP gets.""" - def http_open(self, req): - # add the Accept-Encoding header to the request - # support gzip encoding (identity is assumed) - req.add_header("Accept-Encoding","gzip") - req.add_header('User-Agent', 'BitMagnet/' + version) - if DEBUG: - print "Sending:" - print req.headers - print "\n" - fp = HTTPHandler.http_open(self,req) - headers = fp.headers - if DEBUG: - pprint.pprint(headers.dict) - url = fp.url - return addinfourldecompress(fp, headers, url) - - -class addinfourldecompress(addinfourl): - """Do gzip decompression if necessary. Do addinfourl stuff too.""" - def __init__(self, fp, headers, url): - # we need to do something more sophisticated here to deal with - # multiple values? What about other weird crap like q-values? - # basically this only works for the most simplistic case and will - # break in some other cases, but for now we only care about making - # this work with the BT tracker so.... - if headers.has_key('content-encoding') and headers['content-encoding'] == 'gzip': - if DEBUG: - print "Contents of Content-encoding: " + headers['Content-encoding'] + "\n" - self.gzip = 1 - self.rawfp = fp - fp = GzipStream(fp) - else: - self.gzip = 0 - return addinfourl.__init__(self, fp, headers, url) - - def close(self): - self.fp.close() - if self.gzip: - self.rawfp.close() - - def iscompressed(self): - return self.gzip - -class GzipStream(StringIO): - """Magically decompress a file object. - - This is not the most efficient way to do this but GzipFile() wants - to seek, etc, which won't work for a stream such as that from a socket. - So we copy the whole shebang info a StringIO object, decompress that - then let people access the decompressed output as a StringIO object. +from urllib import quote, unquote +from BitTorrent import version - The disadvantage is memory use and the advantage is random access. +MAX_REDIRECTS = 10 - Will mess with fixing this later. - """ +class urlopen: + def __init__(self, url): + self.tries = 0 + self._open(url) - def __init__(self,fp): - self.fp = fp + def _open(self, url): + self.tries += 1 + if self.tries > MAX_REDIRECTS: + raise IOError, ('http error', 500, + "Internal Server Error: Redirect Recursion") + (scheme, netloc, path, pars, query, fragment) = urlparse(url) + if scheme != 'http': + raise IOError, ('url error', 'unknown url type', scheme, url) + url = path + if pars: + url += ';'+pars + if query: + url += '?'+query +# if fragment: + self.connection = HTTPConnection(netloc) + self.connection.request('GET', url, None, + { 'User-Agent': 'BitMagnet/' + version, + 'Accept-Encoding': 'gzip' } ) + self.response = self.connection.getresponse() + status = self.response.status + if status in (301,302): + try: + self.connection.close() + except: + pass + self._open(self.response.getheader('Location')) + return + if status != 200: + raise IOError, ('http error', status, self.response.reason) - # this is nasty and needs to be fixed at some point - # copy everything into a StringIO (compressed) - compressed = StringIO() - r = fp.read() - while r: - compressed.write(r) - r = fp.read() - # now, unzip (gz) the StringIO to a string - compressed.seek(0,0) - gz = GzipFile(fileobj = compressed) - str = '' - r = gz.read() - while r: - str += r - r = gz.read() - # close our utility files - compressed.close() - gz.close() - # init our stringio selves with the string - StringIO.__init__(self, str) - del str + def read(self): + data = self.response.read() + if self.response.getheader('Content-Encoding','').find('gzip') >= 0: + try: + compressed = StringIO(data) + f = GzipFile(fileobj = compressed) + data = f.read() + except: + raise IOError, ('http error', 'got corrupt response') + return data def close(self): - self.fp.close() - return StringIO.close(self) - -# -# Install the HTTPContentEncodingHandler that we've defined above. -# -install_opener(build_opener(HTTPContentEncodingHandler)) + self.connection.close() Index: download.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/BitTorrent/download.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- download.py 17 Dec 2004 16:36:32 -0000 1.2 +++ download.py 3 Jan 2005 21:58:19 -0000 1.3 @@ -29,8 +29,6 @@ from time import time from os.path import exists import encodings -import cjkcodecs.aliases -import iconv_codec try: from os import getpid Index: getencdata.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/BitTorrent/getencdata.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- getencdata.py 24 Nov 2004 09:49:31 -0000 1.1 +++ getencdata.py 3 Jan 2005 21:58:19 -0000 1.2 @@ -1,6 +1,4 @@ import encodings -import cjkcodecs.aliases -import iconv_codec import locale def getencdata(x): |
From: d0c 5. <d0c...@us...> - 2005-01-03 21:58:33
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4073 Modified Files: bitmagnet.nsi bitmagnet.py btsession.py build.bat g3widgets.py package.bat winsetup.py Log Message: Updated source to run with Python 2.4 and wxpython 2.5.3.1 unicode. Index: build.bat =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/build.bat,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- build.bat 20 Dec 2004 01:22:23 -0000 1.2 +++ build.bat 3 Jan 2005 21:58:19 -0000 1.3 @@ -1,5 +1,5 @@ del /F /S /Q build dist -c:\python23\python.exe winsetup.py py2exe -p encodings -O2 +c:\python24\python.exe winsetup.py py2exe -p encodings -O2 mkdir dist\images mkdir dist\images\flags copy images dist\images\ Index: bitmagnet.nsi =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/bitmagnet.nsi,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- bitmagnet.nsi 18 Dec 2004 11:28:30 -0000 1.2 +++ bitmagnet.nsi 3 Jan 2005 21:58:19 -0000 1.3 @@ -9,7 +9,7 @@ Name "${APPNAMEANDVERSION}" InstallDir "$PROGRAMFILES\BitMagnet" InstallDirRegKey HKLM "Software\${APPNAME}" "" -OutFile "bitmagnetv${VERSION}.exe" +OutFile "BitMagnet_${VERSION}_win32_setup.exe" BrandingText "${APPNAMEANDVERSION}" ; Use compression SetCompressor LZMA Index: bitmagnet.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/bitmagnet.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- bitmagnet.py 20 Dec 2004 03:27:27 -0000 1.6 +++ bitmagnet.py 3 Jan 2005 21:58:19 -0000 1.7 @@ -39,9 +39,6 @@ from btsession import BTSession from g3rss import RSSPanel import encodings -import cjkcodecs.aliases -import iconv_codec -from time import sleep #import gettext debug_flag = False Index: winsetup.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/winsetup.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- winsetup.py 24 Nov 2004 09:49:30 -0000 1.1 +++ winsetup.py 3 Jan 2005 21:58:19 -0000 1.2 @@ -45,7 +45,7 @@ ## }}, options = {"py2exe" : { - "packages" : ["encodings","cjkcodecs"] + "packages" : ["encodings"] }}, windows = [ Index: btsession.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/btsession.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- btsession.py 17 Dec 2004 16:38:45 -0000 1.2 +++ btsession.py 3 Jan 2005 21:58:19 -0000 1.3 @@ -28,8 +28,6 @@ from types import UnicodeType, StringType import locale import encodings -import cjkcodecs.aliases -import iconv_codec class BTSession: def __init__(self, parent, session_id, peer_id, invokefunc, updatefunc, @@ -396,24 +394,12 @@ orig_dirname = saveas else: orig_dirname, filename = split(saveas) - - - ## this needs to be done as startfile does not accept unicode. - if type(orig_dirname) is UnicodeType: - try: - orig_dirname = orig_dirname.encode(locale.getpreferredencoding()) - except: - try: - orig_dirname = orig_dirname.encode('latin-1') - except: - self.AddMsg("Error", "ERROR Datafolder name encoding not supported by current version of os.startfile... this is a python issue", -1) - else: - try: - startfile(orig_dirname) - except UnicodeEncodeError: - self.AddMsg("Error", "ERROR Datafolder name encoding not supported by current version of os.startfile... this is a python issue", -1) - + try: + startfile(orig_dirname) + except UnicodeEncodeError: + self.AddMsg("Error", "ERROR Data folder name encoding not supported", -1) return True + return False def Resume(self): Index: g3widgets.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/g3widgets.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- g3widgets.py 17 Dec 2004 16:41:58 -0000 1.5 +++ g3widgets.py 3 Jan 2005 21:58:19 -0000 1.6 @@ -13,8 +13,6 @@ import sys import time import os.path -import cjkcodecs.aliases -import iconv_codec import locale from types import StringType from btconfig import BTConfig Index: package.bat =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/package.bat,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- package.bat 20 Dec 2004 01:22:23 -0000 1.2 +++ package.bat 3 Jan 2005 21:58:19 -0000 1.3 @@ -1,5 +1,5 @@ del /F /S /Q build dist -c:\python23\python.exe winsetup.py py2exe -p encodings -O2 +c:\python24\python.exe winsetup.py py2exe -p encodings -O2 mkdir dist\images mkdir dist\images\flags copy images dist\images\ |
From: d0c 5. <d0c...@us...> - 2004-12-20 03:27:38
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31972 Modified Files: bitmagnet.py btdownloadgui.py Log Message: Fixed this bug: http://sourceforge.net/tracker/index.php?func=detail&aid=1076657&group_id=123995&atid=698180 Index: bitmagnet.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/bitmagnet.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- bitmagnet.py 17 Dec 2004 16:40:48 -0000 1.5 +++ bitmagnet.py 20 Dec 2004 03:27:27 -0000 1.6 @@ -75,6 +75,7 @@ style = wx.DEFAULT_FRAME_STYLE) G3TaskBar.__init__(self) self.btsessions = [] + self.prgdlgs = {} self.btsessions_lock = Lock() self.uiflag = Event() self.doneflag = Event() @@ -766,9 +767,9 @@ if not s.spew and s != None and s.GetStatusData() != None: from btdownloadgui import DownloadInfoFrame s.spew = True - f = DownloadInfoFrame(self, s, self.images, + self.prgdlgs[len(self.prgdlgs)] = DownloadInfoFrame(self, s, self.images, self.pl_dnsloop.GetAddress, self.FriendCatcher) - + def UpdateGUI(self): if not self.btsessions_lock.acquire(False): @@ -1636,6 +1637,13 @@ print 'ERROR: Did not shut down correctly' print_exc() + print 'Destroying all open/minimised torrent progress dialogs' + for f in self.prgdlgs: + try: + self.prgdlgs[f].KillDlg() + except: + pass + print 'Destroying taskbar icon' self.tbicon.Destroy() print 'Destroying window' Index: btdownloadgui.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/btdownloadgui.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- btdownloadgui.py 17 Dec 2004 16:40:12 -0000 1.3 +++ btdownloadgui.py 20 Dec 2004 03:27:27 -0000 1.4 @@ -391,6 +391,10 @@ else: return '%d min %02d sec' % (m, sec) + def KillDlg(self): + self.tbicon.Destroy() + self.Destroy() + if __name__ == "__main__": |
From: d0c 5. <d0c...@us...> - 2004-12-20 01:23:17
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9763 Modified Files: build.bat package.bat Log Message: Small changes to build.bat etc. due to merging of license files and removed redundant webui.bmp Index: package.bat =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/package.bat,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- package.bat 24 Nov 2004 09:49:30 -0000 1.1 +++ package.bat 20 Dec 2004 01:22:23 -0000 1.2 @@ -5,8 +5,7 @@ copy images dist\images\ copy images\flags dist\images\flags copy CHANGELOG.TXT dist\ -copy BT.LICENSE.txt dist\ -copy G3.LICENSE.txt dist\ +copy LICENSES.TXT dist\ copy credits.txt dist\ copy unicows.dll dist\ "C:\Program Files\NSIS\makensis.exe" bitmagnet.nsi \ No newline at end of file Index: build.bat =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/build.bat,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- build.bat 24 Nov 2004 09:49:30 -0000 1.1 +++ build.bat 20 Dec 2004 01:22:23 -0000 1.2 @@ -5,8 +5,7 @@ copy images dist\images\ copy images\flags dist\images\flags copy CHANGELOG.TXT dist\ -copy BT.LICENSE.txt dist\ -copy G3.LICENSE.txt dist\ +copy LICENSES.TXT dist\ copy credits.txt dist\ copy unicows.dll dist\ rem "d:\Program Files\NSIS\makensis.exe" bitmagnet.nsi \ No newline at end of file |
From: d0c 5. <d0c...@us...> - 2004-12-20 01:22:48
|
Update of /cvsroot/bitmagnet/BitMagnet/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9763/images Removed Files: webui.bmp Log Message: Small changes to build.bat etc. due to merging of license files and removed redundant webui.bmp --- webui.bmp DELETED --- |
From: d0c 5. <d0c...@us...> - 2004-12-19 17:41:01
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8700 Added Files: LICENSES.TXT Removed Files: BT.LICENSE.TXT G3.LICENSE.TXT Log Message: Merged Licenses into one file... less clutter --- BT.LICENSE.TXT DELETED --- --- G3.LICENSE.TXT DELETED --- --- NEW FILE: LICENSES.TXT --- ===================================================================== BitMagnet Licence ===================================================================== Unless otherwise noted, all files are released under the MIT license, exceptions contain licensing information in them. Copyright (C) The BitMagnet Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software is provided "AS IS", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software. ===================================================================== g3Torrent License - taken from G3.LICENSE.TXT ===================================================================== Unless otherwise noted, all files are released under the MIT license, exceptions contain licensing information in them. Copyright (C) 2001-2002 Jeremy Arendt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software is provided "AS IS", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software. ===================================================================== BitTorrent License - taken from BT.LICENSE.TXT ===================================================================== Unless otherwise noted, all files are released under the MIT license, exceptions contain licensing information in them. Copyright (C) 2001-2002 Bram Cohen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software is provided "AS IS", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software. |
From: d0c 5. <d0c...@us...> - 2004-12-18 18:20:59
|
Update of /cvsroot/bitmagnet/BitMagnet/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23586/images Modified Files: tab24.png toggle24.png Log Message: Better looking toolbar buttons for toggling splitter and notebook Index: toggle24.png =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/images/toggle24.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsXgutnj and /tmp/cvsJyvlG5 differ Index: tab24.png =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/images/tab24.png,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsxKYzcB and /tmp/cvs79pCIn differ |
From: d0c 5. <d0c...@us...> - 2004-12-18 11:28:39
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5941 Modified Files: bitmagnet.nsi Log Message: Made some small changes for easier version updating. Index: bitmagnet.nsi =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/bitmagnet.nsi,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- bitmagnet.nsi 24 Nov 2004 09:49:30 -0000 1.1 +++ bitmagnet.nsi 18 Dec 2004 11:28:30 -0000 1.2 @@ -2,14 +2,15 @@ ; Define your application name !define APPNAME "BitMagnet" -!define APPNAMEANDVERSION "BitMagnet v0.3" +!define VERSION "0.3.2" +!define APPNAMEANDVERSION "${APPNAME} ${VERSION}" ; Main Install settings Name "${APPNAMEANDVERSION}" InstallDir "$PROGRAMFILES\BitMagnet" InstallDirRegKey HKLM "Software\${APPNAME}" "" -OutFile "bitmagnetv0.3.exe" - +OutFile "bitmagnetv${VERSION}.exe" +BrandingText "${APPNAMEANDVERSION}" ; Use compression SetCompressor LZMA |
From: d0c 5. <d0c...@us...> - 2004-12-18 11:27:41
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5685 Modified Files: optiondlg.py Log Message: Missed one Client spoofing entry... thanks LeoXV Index: optiondlg.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/optiondlg.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- optiondlg.py 17 Dec 2004 16:38:01 -0000 1.4 +++ optiondlg.py 18 Dec 2004 11:27:32 -0000 1.5 @@ -1744,8 +1744,6 @@ self.rightpane_panel = Options_GRAPH_Panel(self.panel, self.rightpanel_size, self.btconfig) elif self.tree.GetItemText(item) == "Web Interface": self.rightpane_panel = Options_WebI_Panel(self.panel, self.rightpanel_size, self.btconfig) - elif self.tree.GetItemText(item) == "Client Spoofing": - self.rightpane_panel = Options_Spoof_Panel(self.panel, self.rightpanel_size, self.btconfig) else: self.rightpane_panel = Options_Gen_Panel(self.panel, self.rightpanel_size, self.btconfig) |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:51:45
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19140 Modified Files: CHANGELOG.TXT Log Message: version 0.3.2 Index: CHANGELOG.TXT =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/CHANGELOG.TXT,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CHANGELOG.TXT 6 Dec 2004 12:00:27 -0000 1.3 +++ CHANGELOG.TXT 17 Dec 2004 16:51:25 -0000 1.4 @@ -1,7 +1,15 @@ BitMagnet - Change Log http://bitmagnet.sourceforge.net -0.3.1 - Current Version +0.3.2 - Current Version +----------------------- +* d0c - Added code to reset colours to default in prefs +* d0c - Updated the Unicode support to support the utf-8 extension and different types of encoding via 'encoding' entry +* d0c - Added a 'Stopped' message to the p2pgauge when a torrent is stopped +* d0c - Added the &no_peerid=1 flag to the announce string for tracker comptability +* d0c - Fixed the error where there are two alternating torrent states for the same torrent + +0.3.1 - December 17, 04 ----------------------- * d0c - Fixed the double-click on torrent error where the progress dialog would only be displayed once (req by aretecte) * d0c - Fixed an issue with the time not being displayed in the torrent progress dialog (req by sid32) @@ -10,9 +18,9 @@ * apraxhren - Fixed a bug in progress dialog where colours were displayed incorrectly * d0c - Removed leech choker and spoof abilities - sharing good... leeching bad. Spoofing unecessary. * d0c - Added right-click remove/add pages from the tab window (Details, Graph, Messages... etc) -* d0c - Added peerid recognition for all versions of: eXeem, Shareaza, XBT, XanTorrent, BitSpirit, BitComet, Burst!, Experimental and re-wrote detection for Mainline +* d0c - Added peerid recognition for all versions of: eXeem, Shareaza, XBT, XanTorrent, BitSpirit, BitComet, Burst!, Experimental, TurboBT, TorrentTopia, BitBuddy, TorrenTres and re-wrote detection for Mainline * d0c - Created a new peerid for BitMagnet which includes the version number -* d0c - Added code to reset colours to default in prefs + 0.3.0 - October 31, 04 ---------------------- |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:50:43
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18912 Modified Files: g3peerid.py Log Message: Added detection for BitSpirit HTTPBT and UDP0 peerids, TorrentTopia, TorrenTres and Deadman clients. Index: g3peerid.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/g3peerid.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- g3peerid.py 11 Dec 2004 12:28:46 -0000 1.4 +++ g3peerid.py 17 Dec 2004 16:50:29 -0000 1.5 @@ -26,7 +26,8 @@ else: break - elif peerid and len(peerid) == 20 and peerid[2:4] == "BM": + elif peerid and len(peerid) == 20 and peerid[2:4] == "BM" and \ + peerid[14:20] != "HTTPBT" and peerid[16:20] != "UDP0": for c in peerid[4:13]: if c != chr(0) and c.isalnum(): name_str += c @@ -50,6 +51,10 @@ if peerid[1:3] == "G3": return "G3 Torrent" + #BitSpirit - d0c TODO: workout version from peerid + if peerid[14:20] == "HTTPBT" or peerid[16:20] == "UDP0": + return "BitSpirit " + #BitMagnet - d0c if peerid[2:4] == "BM": version_str = "" @@ -66,7 +71,7 @@ if (peerid[:12] == (chr(0)*12)): return "Mainline" - #Burst! - d0c + #Burst! - d0c if peerid[:5] == "Mbrst": version_str = "" for c in peerid[5:11]: @@ -199,6 +204,18 @@ if peerid[:10] == "DansClient": return "XanTorrent" + #TorrentTopia - d0c TODO: workout version from peerid + if peerid[:9] == "346------": + return "TorrentTopia v1.70" + + #TorrenTres - d0c TODO: workout version from peerid + if peerid[:8] == "XTORR302": + return "TorrenTres 0.0.2" + + #TurboBT - d0c + if peerid[:7] == "turbobt": + return "TurboBT " + peerid[7:10] + #XBT - d0c if peerid[:3] == "XBT": version_str = peerid[3] + '.' + peerid[4] + '.' + peerid[5] @@ -218,7 +235,7 @@ #Shareaza - d0c shareaza = True - for c in peerid[0:15]: + for c in peerid[:15]: if c == chr(0): shareaza = False break @@ -230,6 +247,10 @@ if shareaza: return "Shareaza" + #Deadman client - d0c + if peerid[:16] == "Deadman Walking-": + return "Deadman" + ## version_str = "" ## for c in peerid[0:10]: ## if c.isalnum(): @@ -238,6 +259,7 @@ ## version_str += '-' ## ## return version_str + return "Unknown client" def CreatePeerId(nick = ""): @@ -301,5 +323,19 @@ print GetClientName('\x2D\x65\x58\x30\x44\x30\x30\x2D\x67\x70\x21\x2E\x59\x52\x39\x50\x29\x45\x67\x45') #eXeem beta 0.14 print GetClientName('\x2D\x65\x58\x30\x45\x30\x30\x2D\x6A\x49\x56\x45\x43\x6E\x76\x42\x68\x59\x51\x56') - #bitbuddy 0.961 + #BitBuddy 0.961 print GetClientName('\x2D\x42\x42\x30\x39\x36\x31\x2D\x54\x42\x37\x6A\x4A\x5F\x67\x2D\x6F\x55\x47\x66') + #TorrenTres 0.0.2 + print GetClientName('\x58\x54\x4F\x52\x52\x33\x30\x32\x2D\xC8\xB2\x84\xCC\x6C\x0F\xD0\xFE\xCD\x46\x5B') + #TorrentTopia 1.70 + print GetClientName('\x33\x34\x36\x2D\x2D\x2D\x2D\x2D\x2D\x6E\x2E\x4B\x7A\x65\x46\x50\x30\x6E\x56\x68') + #TurboBT 5.0 + print GetClientName('\x74\x75\x72\x62\x6F\x62\x74\x35\x2E\x30\x2E\x30\xD1\xA5\x27\xD4\x52\x0D\x7E\x3E') + #BitSpirit v 2.6.3 + print GetClientName('\x00\x00\x00\x00\x00\x00\x00\x00\x70\x98\x28\xCC\x22\xB7\x48\x54\x54\x50\x42\x54') + #BitSpirit v 2.7.3 + print GetClientName('\x00\x00\x00\x00\x00\x00\x00\x00\x70\x98\x28\xCC\x22\xB7\x48\x54\x54\x50\x42\x54') + #UDP0 (Need to confirm that this is Bitspirit) + print GetClientName('\x00\x1F\x42\x4D\x41\x6E\x6F\x6E\x2E\x27\xC2\x67\x9C\xC3\xA9\xF8\x55\x44\x50\x30') + #Deadman + print GetClientName('\x44\x65\x61\x64\x6D\x61\x6E\x20\x57\x61\x6C\x6B\x69\x6E\x67\x2D\x36\x35\x5A\x56') \ No newline at end of file |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:47:19
|
Update of /cvsroot/bitmagnet/BitMagnet/BitTorrent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17860/BitTorrent Modified Files: __init__.py Log Message: New version string Index: __init__.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/BitTorrent/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- __init__.py 1 Dec 2004 08:32:47 -0000 1.2 +++ __init__.py 17 Dec 2004 16:47:05 -0000 1.3 @@ -1 +1 @@ -version = '0.3.1' +version = '0.3.2' |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:42:12
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16710 Modified Files: g3widgets.py Log Message: Added a custom spinctrl which allows the skipping of certain number ranges Index: g3widgets.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/g3widgets.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- g3widgets.py 6 Dec 2004 12:05:02 -0000 1.4 +++ g3widgets.py 17 Dec 2004 16:41:58 -0000 1.5 @@ -473,6 +473,35 @@ r = wx.RegionFromBitmapColour(bmp, wx.Color(0,0,0)) self.hasShape = self.SetShape(r) + +class BMSpinCtrl(wx.SpinCtrl): #d0c + def __init__(self, parent, id=-1, value="", pos=wx.DefaultPosition, size=wx.DefaultSize, + style=wx.SP_ARROW_KEYS , min=0, max=100, initial=0, name="", lower=0, upper=3): + wx.SpinCtrl.__init__(self, parent, id, value, pos, size, style, min, max, initial, name) + self.lower = lower + self.upper = upper + + wx.EVT_SPIN_UP(self, -1, self.OnSpinUp) + wx.EVT_SPIN_DOWN(self, -1, self.OnSpinDown) + wx.EVT_KILL_FOCUS(self, self.OnKillFocus) + + def OnSpinUp(self, event): + sval = event.GetSelection() + if sval > self.lower and sval < self.upper: + self.SetValue(self.upper-1) + event.Skip() + + def OnSpinDown(self, event): + sval = event.GetSelection() + if sval > self.lower and sval < self.upper: + self.SetValue(self.lower) + event.Skip() + + def OnKillFocus(self, event): + sval = self.GetValue() + if sval > self.lower and sval < self.upper: + self.SetValue(self.lower) + event.Skip() if __name__ == "__main__": app = wx.PySimpleApp() |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:41:47
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16561 Modified Files: masterlist.py Log Message: Minor change to allow testing from the command line Index: masterlist.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/masterlist.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- masterlist.py 24 Nov 2004 09:49:30 -0000 1.1 +++ masterlist.py 17 Dec 2004 16:41:23 -0000 1.2 @@ -551,7 +551,7 @@ def __init__(self): wx.Frame.__init__(self, None, -1, 'Test', size = wx.Size(430, 350), style = wx.DEFAULT_FRAME_STYLE) panel = wx.Panel(self, -1) - self.ppp = MasterList(panel, None, None,None,None,None,None,None,None,None,None,None,None, None, BTConfig()) + self.ppp = MasterList(panel, None, None,None,None,None,None,None,None,None,None,None,None,None, None, BTConfig()) testbutton1 = wx.Button(panel, 100, "test1") testbutton2 = wx.Button(panel, 101, "test2") |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:40:59
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16375 Modified Files: bitmagnet.py Log Message: Added more encoding support, removed some of the remaining leeching abilities, fixed alternating torrent status bug Index: bitmagnet.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/bitmagnet.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- bitmagnet.py 6 Dec 2004 16:57:10 -0000 1.4 +++ bitmagnet.py 17 Dec 2004 16:40:48 -0000 1.5 @@ -38,7 +38,10 @@ from BitTorrent.bencode import bencode, bdecode from btsession import BTSession from g3rss import RSSPanel -from BitTorrent.getencdata import getenclistdata +import encodings +import cjkcodecs.aliases +import iconv_codec +from time import sleep #import gettext debug_flag = False @@ -274,7 +277,7 @@ toolbar.AddSeparator() toolbar.AddTool(103, self.images.GetImage('remove24.png'), wx.NullBitmap, False, "", _("Remove"), _("Remove selected torrent")) toolbar.AddTool(104, self.images.GetImage('resume24.png'), wx.NullBitmap, False, "", _("Resume/Start"), _("Resume/Start torrent")) - toolbar.AddTool(105, self.images.GetImage('pause24.png'), wx.NullBitmap, False, "", _("Pause/Requeue)"), _("Pause/Requeue torrent")) + toolbar.AddTool(105, self.images.GetImage('pause24.png'), wx.NullBitmap, False, "", _("Pause/Requeue"), _("Pause/Requeue torrent")) toolbar.AddTool(110, self.images.GetImage('stop24.png'), wx.NullBitmap, False, "", _("Stop"), _("Stop this torrent")) toolbar.AddSeparator() toolbar.AddTool(106, self.images.GetImage('upqueue24.png'), wx.NullBitmap, False, "", _("Move up in queue"), _("Move up in queue")) @@ -846,7 +849,7 @@ s.Stop() elif cfg.Get('on_complete') == 2: - pass # do nothing + pass # do nothing (keep sharing) else: pass # catch if greater than 2 @@ -861,8 +864,9 @@ print_exc() print 'ERROR: error appending master list' - # try to start or unpause next session in queue, unless was paused manually - if nCheckingSessions < 1 and nActiveSessions < self.btconfig.Get('max_sessions') and not s.IsStopped(): + # try to start or unpause next session in queue, unless was paused manually + if nCheckingSessions < 1 and nActiveSessions < self.btconfig.Get('max_sessions') \ + and not s.IsStopped() and not s.thread.isAlive(): print 'trying to resume ' + str(s.GetId()) s.Resume() nActiveSessions += 1 @@ -929,6 +933,9 @@ return max_urate = self.btconfig['total_max_uprate'] + if max_urate == 1 or max_urate == 2: + max_urate = 0 + self.btconfig.Set('total_max_uprate', 0) if max_urate == 0: rate = 0 else: @@ -986,6 +993,9 @@ if self.notebook.GetSelection() == 0: if selected.IsComplete(): self.status.pppgauge.SetValueFinished() + elif selected.IsStopped(): + self.status.pppgauge.SetValueStopped() + self.status.peerlist.Reset() elif selected.IsPaused(): self.status.pppgauge.SetValuePaused() self.status.peerlist.Reset() @@ -1240,7 +1250,19 @@ return False info = response['info'] - filename = getenclistdata(info, 'name') + + if response.has_key('encoding'): + enc_type = response['encoding'] + else: + enc_type = 'latin-1' + + if info.has_key('name.utf-8'): + ent_type = '.utf-8' + enc_type = 'UTF-8' + else: + ent_type = '' + + filename = info['name'+ent_type].decode(enc_type) # attept to see if this torrent is already added for s in self.btsessions: |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:40:24
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16273 Modified Files: btdownloadgui.py Log Message: Taskbar icon destroyed on close Index: btdownloadgui.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/btdownloadgui.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- btdownloadgui.py 1 Dec 2004 08:32:48 -0000 1.2 +++ btdownloadgui.py 17 Dec 2004 16:40:12 -0000 1.3 @@ -140,6 +140,7 @@ self.btsession.spew = False except: print_exc() + self.tbicon.Destroy() self.Destroy() |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:38:58
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15811 Modified Files: btsession.py Log Message: Encoding support, disabled poll tracker when in checking state, added self.id to output for debugging Index: btsession.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/btsession.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- btsession.py 24 Nov 2004 09:49:30 -0000 1.1 +++ btsession.py 17 Dec 2004 16:38:45 -0000 1.2 @@ -26,7 +26,10 @@ from time import time from random import shuffle from types import UnicodeType, StringType -from BitTorrent.getencdata import getenclistdata, getencdata +import locale +import encodings +import cjkcodecs.aliases +import iconv_codec class BTSession: def __init__(self, parent, session_id, peer_id, invokefunc, updatefunc, @@ -448,7 +451,7 @@ self.download.StartConnection(ip, port, peer_id) def ReAnnounce(self, url=None): - if self.IsRunning(): + if self.IsRunning() and not self.checking: self.download.ReAnnounce(url) def ReChoke(self): @@ -806,8 +809,10 @@ self.setupflag.set() else: - self.filename = getenclistdata(self.download.info, 'name') + ent_type = self.download.ent_type + enc_type = self.download.enc_type + self.filename = self.download.info['name'+ent_type].decode(enc_type) self.filesize = self.download.file_length self.setupflag.set() @@ -824,7 +829,7 @@ print 'download thread ending before starting' return False - print 'Starting download thread' + print 'Starting download thread', self.id try: self.download.download(self.params, self.OnUpdateStatus, self.OnFinished, self.OnError, self.FriendFunc, @@ -848,5 +853,5 @@ print_exc() self.OnEnd(True) - print 'download thread finished' + print 'download thread finished', self.id return True |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:38:11
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15574 Modified Files: optiondlg.py Log Message: Removed the last of the leeching ability settings Index: optiondlg.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/optiondlg.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- optiondlg.py 6 Dec 2004 11:54:11 -0000 1.3 +++ optiondlg.py 17 Dec 2004 16:38:01 -0000 1.4 @@ -21,6 +21,7 @@ from BitTorrent import version from webbrowser import open_new from threading import Thread +from g3widgets import BMSpinCtrl import sys import socket import random @@ -782,6 +783,11 @@ after_dl = ["Keep sharing, unless downloads are in queue", "Keep sharing, until custom condition is met", "Keep sharing"] + + #ratio choices for combo + cb_ratios = range(0,20) + for i in cb_ratios: + cb_ratios[i] = "1:" + str(i+1) RBOX1 = wx.NewId() self.radio1 = wx.RadioBox(self, RBOX1, "When a download completes:", @@ -794,15 +800,18 @@ self.check2 = wx.CheckBox(self, -1, "Upload till bytes down:up ratio") self.check3 = wx.CheckBox(self, -1, "Only upload for another Hours:Mins") - self.edit1 = TextCtrl(self, -1, '100', mask='###%', formatcodes='r>', size=(50,Widget_H)) - self.edit2 = TextCtrl(self, -1, '1:2', mask='1:##', formatcodes='r>', size=(50,Widget_H)) - self.edit3 = TextCtrl(self, -1, '00:00', mask='##:##', formatcodes='r>', size=(50,Widget_H)) + self.spin1 = BMSpinCtrl(self, -1, size = wx.Size(70, Widget_H), lower=-1, upper=100) + self.spin1.SetRange(100, 1000) + self.spin1.SetValue(100) + + self.combo1 = wx.ComboBox(self, -1, choices=cb_ratios, style=wx.CB_DROPDOWN|wx.CB_READONLY, size = wx.Size(70, Widget_H)) + self.edit1 = TextCtrl(self, -1, '00:00', mask='##:##', formatcodes='r>', size=(53,Widget_H)) self.check4 = wx.CheckBox(self, -1, "Upload at this new rate (KB/s)") - self.spin1 = wx.SpinCtrl(self, -1, size = wx.Size(70, Widget_H)) - self.spin1.SetRange(0, 10000) + self.spin2 = BMSpinCtrl(self, -1, size = wx.Size(70, Widget_H), lower=0, upper=3) + self.spin2.SetRange(0, 10000) - self.spin1.SetValue(btconfig.Get('end_newrate')/1024) + self.spin2.SetValue(btconfig.Get('end_newrate')/1024) self.check1.SetValue(btconfig.Get('end_on_percent')) self.check2.SetValue(btconfig.Get('end_on_ratio')) self.check3.SetValue(btconfig.Get('end_on_timelimit')) @@ -813,9 +822,9 @@ end_timelimit = btconfig.Get('end_timelimit') try: - self.edit1.SetValue("%d" % int(100*end_percent)) - self.edit2.SetValue("1:%d" % end_ratio) - self.edit3.SetValue("%s" % strftime("%H:%M", gmtime(end_timelimit))) + self.spin1.SetValue(int(100*end_percent)) + self.combo1.SetSelection(end_ratio-1) + self.edit1.SetValue("%s" % strftime("%H:%M", gmtime(end_timelimit))) except: print_exc() print "ERROR: could not set values" @@ -830,20 +839,21 @@ double.Add((-1,5)) double.Add((-1,5)) double.Add(self.check1, 1, wx.EXPAND) - double.Add(self.edit1, 1) + double.Add(self.spin1, 1) double.Add(self.check2, 1, wx.EXPAND) - double.Add(self.edit2, 1) + double.Add(self.combo1, 1) double.Add(self.check3, 1, wx.EXPAND) - double.Add(self.edit3, 1) + double.Add(self.edit1, 1) double.Add(self.check4, 1, wx.EXPAND) - double.Add(self.spin1, 1) + double.Add(self.spin2, 1) double.AddGrowableCol(0) notebox = wx.StaticBox(self, -1, "Note") noteboxer = wx.StaticBoxSizer(notebox, wx.VERTICAL) label5 = wx.StaticText(self, -1, "Try to keep files seeded as long as possible. " - + "This is what Brian Boitano would do") + + "This is what Brian Boitano would do\n\n" + + "Upload Rate of 0 = unlimited\n") noteboxer.Add(label5, 1, wx.EXPAND) tall.Add((0,5)) # spacer @@ -864,11 +874,11 @@ self.check1.Enable(value) self.check2.Enable(value) self.check3.Enable(value) + self.spin1.Enable(value) + self.combo1.Enable(value) self.edit1.Enable(value) - self.edit2.Enable(value) - self.edit3.Enable(value) self.check4.Enable(value) - self.spin1.Enable(value) + self.spin2.Enable(value) def OnSelected(self, selection): if selection == 1: @@ -878,7 +888,7 @@ def OnRadio(self, event): self.OnSelected(event.GetSelection()) - + def SaveSettings(self): self.btconfig.Set('on_complete', self.radio1.GetSelection()) @@ -888,19 +898,19 @@ self.btconfig.Set('end_on_newrate', self.check4.GetValue()) #this is moronic... but some users perfer ratio others percent - ratio1 = self.edit1.GetValue() - ratio1 = float( ratio1[:len(ratio1)-1] ) / 100 - ratio2 = int( self.edit2.GetValue()[2:] ) + ratio1 = self.spin1.GetValue() + ratio1 = float(ratio1) / 100 + ratio2 = int( self.combo1.GetValue()[2:] ) try: - timelimit = int(self.edit3.GetValue()[:2])*3600 + int(self.edit3.GetValue()[3:])*60 + timelimit = int(self.edit1.GetValue()[:2])*3600 + int(self.edit1.GetValue()[3:])*60 self.btconfig.Set('end_timelimit', timelimit) except ValueError: pass self.btconfig.Set('end_percent', ratio1) self.btconfig.Set('end_ratio', ratio2) - self.btconfig.Set('end_newrate', self.spin1.GetValue()*1024) + self.btconfig.Set('end_newrate', self.spin2.GetValue()*1024) self.btconfig.UpdateOptions() @@ -1221,7 +1231,7 @@ label4 = wx.StaticText(self, -1, "Global Max Upload Rate (KB/s):") label5 = wx.StaticText(self, -1, "Avg Upload Rate per peer (KB/s):") - self.spin4 = wx.SpinCtrl(self, -1, size = wx.Size(70, Widget_H)) + self.spin4 = BMSpinCtrl(self, -1, size = wx.Size(70, Widget_H), lower=0, upper=3) self.spin4.SetRange(0, 100000) self.spin4.SetValue(self.btconfig.Get('total_max_uprate')/1024) self.spin5 = wx.SpinCtrl(self, -1, size = wx.Size(70, Widget_H)) @@ -1231,7 +1241,7 @@ label1 = wx.StaticText(self, -1, "Max Upload Rate (KB/s):") label2 = wx.StaticText(self, -1, "Max Uploads:") - self.spin1 = wx.SpinCtrl(self, -1, size = wx.Size(70, Widget_H)) + self.spin1 = BMSpinCtrl(self, -1, size = wx.Size(70, Widget_H), lower=0, upper=3) self.spin1.SetRange(0, 100000) self.spin1.SetValue(self.btconfig.Get('maxupspeed')) |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:37:36
|
Update of /cvsroot/bitmagnet/BitMagnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15461 Modified Files: p2pgauge.py Log Message: Added 'Stopped' status message when torrent is stopped Index: p2pgauge.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/p2pgauge.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- p2pgauge.py 24 Nov 2004 09:49:30 -0000 1.1 +++ p2pgauge.py 17 Dec 2004 16:37:24 -0000 1.2 @@ -253,6 +253,8 @@ stat_str = "" elif self.doneflag == -3: stat_str = "Paused" + elif self.doneflag == -4: + stat_str = "Stopped" else: stat_str = "" @@ -266,6 +268,9 @@ dc.DrawRectangle(0, 0, int(size.width*self.fractionDone), 2+int(size.height*0.10)) dc.EndDrawing() + def SetValueStopped(self): + self._SetValue(-4) + def SetValuePaused(self): self._SetValue(-3) |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:36:43
|
Update of /cvsroot/bitmagnet/BitMagnet/BitTorrent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15229/BitTorrent Modified Files: download.py Log Message: Added multi-language encoding support for torrent files (encoding/.utf-8) Index: download.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/BitTorrent/download.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- download.py 24 Nov 2004 09:49:31 -0000 1.1 +++ download.py 17 Dec 2004 16:36:32 -0000 1.2 @@ -28,7 +28,9 @@ from threading import Thread, Event from time import time from os.path import exists -from getencdata import getenclistdata, getencdata +import encodings +import cjkcodecs.aliases +import iconv_codec try: from os import getpid @@ -173,7 +175,19 @@ info = response['info'] - file_name = getenclistdata(info, 'name') + if response.has_key('encoding'): + enc_type = response['encoding'] + else: + enc_type = 'latin-1' + + if info.has_key('name.utf-8'): + ent_type = '.utf-8' + enc_type = 'UTF-8' + else: + ent_type = '' + + + file_name = info['name'+ent_type].decode(enc_type) if info.has_key('length'): file_length = info['length'] @@ -199,14 +213,7 @@ if path.exists(file): for x in info['files']: - - try: - path_name = x['path.utf-8'][0].decode('utf-8') - except: - try: - path_name = x['path'][0].decode(locale.getpreferredencoding()) - except: - path_name = x['path'][0].decode('mbcs') + path_name = x['path'+ent_type][0].decode(enc_type) tfile = path.join(file, path_name) @@ -214,7 +221,7 @@ existing = 1 if not existing: - file_name = getenclistdata(info, 'name') + file_name = info['name'+ent_type].decode(enc_type) file = path.join(file, file_name) @@ -229,14 +236,10 @@ for x in info['files']: n = file - - try: - path_tmp = x['path.utf-8'] - except: - path_tmp = x['path'] + path_tmp = x['path'+ent_type] for i in path_tmp: - n = path.join(n, getencdata(i)) + n = path.join(n, i.decode(enc_type)) files.append((n, x['length'])) @@ -248,6 +251,8 @@ self.config = config self.info = info + self.enc_type = enc_type + self.ent_type = ent_type self.files = files self.response = response self.file_length = file_length @@ -262,6 +267,8 @@ onstartfunc=None): info = self.info + enc_type = self.enc_type + ent_type = self.ent_type config = self.config files = self.files response = self.response @@ -399,7 +406,7 @@ 'comment' : response.get('comment'), 'creation_date' : response.get('creation date'), 'saveas' : config.get('saveas'), - 'filename' : getenclistdata(info, 'name'), + 'filename' : info['name'+ent_type].decode(enc_type), 'filesize': file_length, 'responsefile': config.get('responsefile'), 'nhashes': self.storagewrapper.get_nhashes() |
From: d0c 5. <d0c...@us...> - 2004-12-17 16:35:28
|
Update of /cvsroot/bitmagnet/BitMagnet/BitTorrent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14910/BitTorrent Modified Files: Rerequester.py Log Message: Added &no_peerid for tracker compatibility Index: Rerequester.py =================================================================== RCS file: /cvsroot/bitmagnet/BitMagnet/BitTorrent/Rerequester.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Rerequester.py 24 Nov 2004 09:49:31 -0000 1.1 +++ Rerequester.py 17 Dec 2004 16:35:18 -0000 1.2 @@ -91,12 +91,12 @@ if self.howmany() >= self.maxpeers: s += '&numwant=0' else: - s += '&compact=1' + s += '&no_peer_id=1&compact=1' if event != None: s += '&event=' + ['started', 'completed', 'stopped'][event] - - print s s += '&key=' + self.key + print s + set = SetOnce().set def checkfail(self = self, set = set): if set(): |