Beispiel #1
0
    def __init__(self, config):
        # Save the parsed config
        self.config = config

        # Parse today's date and see if we should use today or yesterday
        self.set_current_date()

        # Flag to determine when to refresh data
        self.needs_refresh = True

        # Fetch the games for today
        self.refresh_games()

        # Fetch all standings data for today
        # (Good to have in case we add a standings screen while rotating scores)
        self.refresh_standings()

        # What game do we want to start on?
        self.current_game_index = self.game_index_for_preferred_team()
        self.current_division_index = 0

        # Network status state
        self.network_issues = False

        # Weather info
        self.weather = Weather(self.config.weather_apikey,
                               self.config.weather_location,
                               self.config.weather_metric_units)

        # News headlines
        self.headlines = Headlines(self.config)
Beispiel #2
0
def main():
    # start the app
    app = QtGui.QApplication(sys.argv)

    # initialize and check for gpg and a secret key
    gpg = GnuPG()

    # initialize the module which handles the daily headlines feature.
    headlines = Headlines()

    system = platform.system()
    if system == 'Darwin':
        if not gpg.is_gpg_available():
            common.alert(
                'GPG doesn\'t seem to be installed. Install <a href="https://gpgtools.org/">GPGTools</a>, generate a key, and run AutoCanary again.'
            )
            sys.exit(0)

        seckeys = gpg.seckeys_list()
        if len(seckeys) == 0:
            common.alert(
                'You need an encryption key to use AutoCanary. Run the GPG Keychain program, generate a key, and run AutoCanary again.'
            )
            sys.exit(0)

    elif system == 'Linux':
        seckeys = gpg.seckeys_list()
        if len(seckeys) == 0:
            common.alert(
                'You need an encryption key to use AutoCanary. Generate a key, and run AutoCanary again.'
            )
            sys.exit(0)

    elif system == 'Windows':
        if not gpg.is_gpg_available():
            common.alert(
                'GPG doesn\'t seem to be installed. Install <a href="http://gpg4win.org/">Gpg4win</a>, generate a key, and run AutoCanary again.'
            )
            sys.exit(0)

        seckeys = gpg.seckeys_list()
        if len(seckeys) == 0:
            common.alert(
                'You need an encryption key to use AutoCanary. Run the Kleopatra program, generate a new personal OpenPGP key pair, and run AutoCanary again.'
            )
            sys.exit(0)

    # start the gui
    gui = AutoCanaryGui(app, gpg, headlines)
    sys.exit(app.exec_())
Beispiel #3
0
def open_app(app_name, cells, audio, arduino):
    current_app = None

    app_name = app_name.replace(" ", "")
    if app_name == 'riddles':
        current_app = Riddles("Riddles", cells, audio, arduino)
    elif app_name == 'learn':
        current_app = Learn("Learn", cells, audio, arduino)
    elif app_name == 'tutor':
        current_app = Tutor("Tutor", cells, audio, arduino)
    elif app_name == 'headlines':
        current_app = Headlines("Headlines", cells, audio, arduino)
    elif app_name == 'memory':
        current_app = Memory("Memory", cells, audio, arduino)

    if current_app is not None:
        audio.speak("Opening the application " + app_name)
        current_app.on_start()
    else:
        audio.speak(
            "I did not recognize the app. Could you try to open the app again?"
        )
Beispiel #4
0
    def open_app(self, app_name):
        current_app = None

        app_name = app_name.replace(" ", "")
        if app_name == 'riddles':
            current_app = Riddles("Riddles")
        elif app_name == 'learn':
            current_app = Learn("Learn")
        elif app_name == 'tutor':
            current_app = Tutor("Tutor")
        elif app_name == 'headlines':
            current_app = Headlines("Headlines")
        elif app_name == 'memory':
            current_app = Memory("Memory")

        if current_app is not None:
            glob.mainApp.audio.speak("Opening the application")
            glob.mainApp.audio.speak(current_app.name)
            current_app.on_start()
        else:  # shouldn't occur
            glob.mainApp.audio.speak(
                "I did not recognize the app. Could you try to open the app again?"
            )
Beispiel #5
0
from headlines import Headlines
from synth import read_news

if __name__ == '__main__':

    h = Headlines(method='ASR')
    news = h.news

    num_news = len(news)
    read_news(
        'Okay, I have {} {} stories about {}. How many would you like to hear?'
        .format(num_news, h.mood, h.topic))
    num_to_read = input("Input number of stories: ")
    print(news)

    # read out stories
    count = 1
    for story in range(int(num_to_read)):
        read_news('story ' + str(count) + ': ' + news[story])
        count += 1
Beispiel #6
0
from headlines import Headlines
from synth import read_news

if __name__ == '__main__':
    read_news('What scoop would you like to hear today?')
    h = Headlines(method='TTS')
    news = h.news

    num_news = len(news)
    if num_news == 0:
        read_news("Sorry, no stories about " + h.topic + " . Pick another.")


    #read_news('give me the positive scoop on kittens from the new york post')
    read_news('Okay, I have {} {} stories about {}. How many would you like to hear?'.format(num_news, h.mood, h.topic))
    num_to_read = input("Input number of stories: ")
    print(news)
    count = 1
    for story in range(int(num_to_read)):
        read_news('story ' + str(count) + ': ' + news[story])
        count += 1