예제 #1
0
 def OnTrackerChangeUrl(self):
     trackerIdx = self.trackerUrlList.GetFirstSelected()
     if trackerIdx == -1:
         #no tracker selected
         showErrorMessage(self, 'You need to select a tracker, before you can change its url!')
     else:
         #a tracker was selected
         tracker = self.trackerInfo[self.selectedGroup]['groupTracker'][trackerIdx]
         diag = wx.TextEntryDialog(self, message='Please enter the new url for this tracker:', caption='Enter url', defaultValue=tracker['trackerUrl'])
     
         if diag.ShowModal() == wx.ID_OK:
             #user did hit ok
             trackerUrl = diag.GetValue()
             if i2pHttpUrlRegexObj.match(trackerUrl) is None:
                 #invalid url
                 showErrorMessage(self, 'The url "%s" is not a valid i2p http url!', trackerUrl)
             else:
                 #valid
                 tracker['trackerUrl'] = trackerUrl
                 self.trackerUrlList.dataUpdate()
예제 #2
0
 def OnTrackerAdd(self, event):
     if self.selectedGroup is None:
         #no group selected
         showErrorMessage(self, 'You need to select a tracker group, before you can add a tracker!')
     else:
         #group selected, go on
         tier = self.trackerInfo[self.selectedGroup]['groupTracker']
         trackerUrl = self.trackerAnnounceUrl.GetValue()
         if i2pHttpUrlRegexObj.match(trackerUrl) is None:
             #invalid url
             showErrorMessage(self, 'The url "%s" is not a valid i2p http url!', trackerUrl)
         else:
             #valid
             trackerPos = self.trackerUrlList.GetFirstSelected()
             if trackerPos == -1:
                 trackerPos = 0
             else:
                 trackerPos += 1
                 
             tier.insert(trackerPos, {'tier':self.selectedGroup + 1,
                                      'tierPos':trackerPos + 1,
                                      'trackerUrl':trackerUrl,
                                      'trackerId':self.nextTrackerId,
                                      'active':False,
                                      'announceTryCount':None,
                                      'announceTryTime':None,
                                      'announceSuccessCount':None,
                                      'announceSuccessTime':None,
                                      'lastAnnounceResult':'None',
                                      'scrapeTryCount':None,
                                      'scrapeTryTime':None,
                                      'scrapeSuccessCount':None,
                                      'scrapeSuccessTime':None,
                                      'seeds':None,
                                      'leeches':None,
                                      'downloads':None})
             self.nextTrackerId += 1
             
             self.trackerUrlList.dataUpdate()