options.py 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-"
  3. """
  4. Propagare - 2018 - by psy (epsylon@riseup.net)
  5. -------
  6. You should have received a copy of the GNU General Public License along
  7. with Propagare; if not, write to the Free Software Foundation, Inc., 51
  8. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  9. -------
  10. "A diferencia del odio, el amor se expande sin necesidad de propaganda..."
  11. """
  12. import optparse
  13. class PropagareOptions(optparse.OptionParser):
  14. def __init__(self, *args):
  15. optparse.OptionParser.__init__(self,
  16. description=' Propagar(es): extracción, organización y análisis semántico de noticias.',
  17. prog='propagare.py',
  18. version='\nPropagare v0.1 - 2018 - GPLv3.0 -> por psy\n',
  19. usage= 'propagare [OPTIONS]')
  20. self.add_option("--update", action="store_true", dest="update", help="actualiza la herramienta a su última versión")
  21. self.add_option("--list", action="store_true", dest="view_media", help="lista las fuentes de noticias soportadas")
  22. self.add_option("-e", action="store_true", dest="news", help="extrae noticias de todas las fuentes")
  23. self.add_option("--es", action="store", dest="esource", help="especifíca una fuente de donde extraer noticias")
  24. self.add_option("--force-no", action="store_true", dest="forceno", help="utilízalo para almacenar datos (Big Data)")
  25. self.add_option("-s", action="store_true", dest="stats", help="muestra algunas estadísticas interesantes")
  26. self.add_option("--ss", action="store", dest="ssource", help="especifíca una fuente de donde extraer estadísticas")
  27. self.add_option("--check-verbs", action="store_true", dest="checkverbs", help="chequea si una palabra es un verbo (Experimental)")
  28. self.add_option("-t", action="store_true", dest="term", help="busca el término en el almacén")
  29. self.add_option("--ts", action="store", dest="tsource", help="busca el término en una fuente determinada")
  30. #self.add_option("--timer", action="store", dest="timer", help="establece un tiempo para buscar nuevas noticias (en min.)")
  31. def get_options(self, user_args=None):
  32. (options, args) = self.parse_args(user_args)
  33. options.args = args
  34. if (not options.news and not options.stats and not options.term and not options.update and not options.view_media):
  35. print '='*75
  36. print " ____ _ "
  37. print " | _ \ Si no 'contesta'...(es)__ _ __ _ _ __ __| | __ _ "
  38. print " | |_) | '__/ _ \| '_ \ / _` |/ _` |/ _` | '_ \ / _` |/ _` |"
  39. print " | __/| | | (_) | |_) | (_| | (_| | (_| | | | | (_| | (_| |"
  40. print " |_| |_| \___/| .__/ \__,_|\__, |\__,_|_| |_|\__,_|\__,_|"
  41. print " |_| |___/ (IA)v:0.1"
  42. print "\n"+'='*75
  43. print "\n"+self.description
  44. print "\n"+'='*75
  45. print "\n [+] Opciones: -h o --help"
  46. print "\n"+'='*75 + "\n"
  47. return options