Exemplo n.º 1
0
def watchnext(showname, cache):
    logger.info("watchnext")
    episode = cache.getnextepisode(showname)
    if episode is None:
        print("Couldn't find any new episodes!")
        if yesno("Would you like to update the cache?"):
            update(showname, cache)
            watchnext(showname, cache)  # this could be an endless loop.
        return
    if watchepisode(episode):
        cache.markwatched(episode)
    askwatchnext(showname, cache)
Exemplo n.º 2
0
def watchepisode(episode):
    """ Watch episode.
    Will return True if the show was seen, False otherwise.
    """
    assert(episode is not None)
    if not episode.aired:
        print("{} hasn't aired yet! It will air {}.".format(episode.getprettyname(),
                                                            episode.getairdatestr()))
        return False
    episodepath = getepisodepath(episode.showname, episode)
    if episodepath is None:
        _doesntexist_shoulddownload(episode)
        return False  # do something here, based on response from doesntexist_shoulddownload

    print("Now watching {} ({})".format(episode.getprettyname(), episodepath))
    subprocess.call([VIDEO_COMMAND, episodepath], stdin=subprocess.PIPE,
                    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    # After episode has been watched, tell user of airdate/episode name of next episode
    if not askuser.yesno("Should '{}' be marked as watched?".format(episode.getprettyname())):
        return False
    return True
Exemplo n.º 3
0
def askwatchnext(showname, cache):
    if yesno("Would you like to watch the next episode?"):
        watchnext(showname, cache)
Exemplo n.º 4
0
def _doesntexist_shoulddownload(episode):
    question = "{name} ({airdate}) wasn't found. Would you try to download it?".format(name=episode.getprettyname(),
                                                                                       airdate=episode.getairdatestr())
    if askuser.yesno(question):
        downloadepisode(episode)