Exemplo n.º 1
0
 def remove_source(self, source_name):
     match = self.find_source(self.prefs.get_sources(), source_name)
     if match != -1 and match != -2:
         confirm_statement = "Remove " + match['name'] + " from followed sources?"
         if(Menu.confirm_change(confirm_statement) and
                                self.prefs.remove_source(match) and
                                self.save_changes()):
             print("No longer following " + match['name'] + ".")
         else:
             print("Cancelled. Preferences not changed.")
Exemplo n.º 2
0
 def addSource(self, source_name):
     params = {'apiKey': self.prefs.get_api_key()}
     source_list = Raab_Requests.make_request("top_sources", params)
     if source_list is None: return
     match = self.find_source(source_list['sources'], source_name)
     if match != -1 and match != -2:
         confirm_statement = "Add " + match['name'] + " to followed sources?"
         if Menu.confirm_change(confirm_statement):
             self.prefs.add_source({'name': match['name'], 'id': match['id'], 'description': match['description']})
             if(self.save_changes()):
                 print("Now following " + match['name'] + ".")
         else:
             print("Cancelled. Preferences not changed.")