Exemplo n.º 1
0
def start():
    if ANILIST_SKIP_UPDATE == 'true':
        logger.warning(
            'AniList skip list update enabled in settings, will match but NOT update your list'
        )

    # Anilist
    anilist_username = anilist_settings['username']
    anilist.custom_mappings = custom_mappings
    anilist.ANILIST_ACCESS_TOKEN = ANILIST_ACCESS_TOKEN
    anilist.ANILIST_SKIP_UPDATE = ANILIST_SKIP_UPDATE
    anilist_series = anilist.process_user_list(anilist_username)

    # Plex
    if not anilist_series:
        logger.error(
            'Unable to retrieve AniList list, check your username and access token'
        )
    else:
        plexmodule.plex_settings = plex_settings
        plex_anime_series = plexmodule.get_anime_shows()
        if (plex_anime_series is None):
            logger.error('Found no Plex shows for processing so exiting')
            return None

        plex_series_watched = plexmodule.get_watched_shows(plex_anime_series)
        if (plex_series_watched is None):
            logger.error(
                'Found no watched shows on Plex for processing so exiting')
            return None

        anilist.match_to_plex(anilist_series, plex_anime_series,
                              plex_series_watched)

        logger.info('Plex to AniList sync finished')
Exemplo n.º 2
0
def start():
    logger.info("PlexAniSync - version: %s" % (__version__))

    if ANILIST_SKIP_UPDATE == "true":
        logger.warning(
            "AniList skip list update enabled in settings, will match but NOT update your list"
        )

    if ANILIST_PLEX_EPISODE_COUNT_PRIORITY == "true":
        logger.warning(
            "Plex episode watched count will take priority over AniList, this will always update AniList watched count over Plex data"
        )

    # Cleanup any old logs
    exists = os.path.isfile("failed_matches.txt")
    if exists:
        try:
            os.remove("failed_matches.txt")
        except BaseException:
            pass

    # Anilist
    anilist_username = anilist_settings["username"]
    anilist.custom_mappings = custom_mappings
    anilist.ANILIST_ACCESS_TOKEN = ANILIST_ACCESS_TOKEN
    anilist.ANILIST_PLEX_EPISODE_COUNT_PRIORITY = ANILIST_PLEX_EPISODE_COUNT_PRIORITY
    anilist.ANILIST_SKIP_UPDATE = ANILIST_SKIP_UPDATE
    anilist_series = anilist.process_user_list(anilist_username)

    # Plex
    if anilist_series is None:
        logger.error(
            "Unable to retrieve AniList list, check your username and access token"
        )
    else:
        if not anilist_series:
            logger.error(
                "No items found on your AniList list for additional processing later on"
            )

        plexmodule.plex_settings = plex_settings
        plex_anime_series = plexmodule.get_anime_shows()

        if plex_anime_series is None:
            logger.error("Found no Plex shows for processing")
            plex_series_watched = None
        else:
            plex_series_watched = plexmodule.get_watched_shows(
                plex_anime_series)

        if plex_series_watched is None:
            logger.error("Found no watched shows on Plex for processing")
        else:
            anilist.match_to_plex(anilist_series, plex_anime_series,
                                  plex_series_watched)

    logger.info("Plex to AniList sync finished")
Exemplo n.º 3
0
def start():
    if len(sys.argv) < 2:
        logger.error(
            'No show title specified in arguments so cancelling updating')
        sys.exit()
    else:
        # If we have custom settings file parameter use different arg index to
        # keep legacy method intact
        if len(sys.argv) > 2:
            show_title = sys.argv[2]
        elif len(sys.argv) == 2:
            show_title = sys.argv[1]

        logger.info('Updating single show: %s' % (show_title))

    if ANILIST_SKIP_UPDATE == 'true':
        logger.warning(
            'AniList skip list update enabled in settings, will match but NOT update your list'
        )

    # Wait a few a seconds to make sure Plex has processed watched states
    sleep(5.0)

    # Anilist
    anilist_username = anilist_settings['username']
    anilist.custom_mappings = custom_mappings
    anilist.ANILIST_ACCESS_TOKEN = ANILIST_ACCESS_TOKEN
    anilist.ANILIST_SKIP_UPDATE = ANILIST_SKIP_UPDATE
    anilist_series = anilist.process_user_list(anilist_username)

    # Plex
    if anilist_series is None:
        logger.error(
            'Unable to retrieve AniList list, check your username and access token'
        )
    elif not anilist_series:
        logger.error('No items found on your AniList list to process')
    else:
        plexmodule.plex_settings = plex_settings
        plex_anime_series = plexmodule.get_anime_shows_filter(show_title)

        if (plex_anime_series is None):
            logger.error('Found no Plex shows for processing')
            plex_series_watched = None
        else:
            plex_series_watched = plexmodule.get_watched_shows(
                plex_anime_series)

        if (plex_series_watched is None):
            logger.error('Found no watched shows on Plex for processing')
        else:
            anilist.match_to_plex(anilist_series, plex_anime_series,
                                  plex_series_watched)

        logger.info('Plex to AniList sync finished')
Exemplo n.º 4
0
def start():
    if ANILIST_SKIP_UPDATE == 'true':
        logger.warning(
            'AniList skip list update enabled in settings, will match but NOT update your list'
        )

    # Cleanup any old logs
    exists = os.path.isfile("failed_matches.txt")
    if exists:
        try:
            os.remove("failed_matches.txt")
        except BaseException:
            pass

    # Anilist
    anilist_username = anilist_settings['username']
    anilist.custom_mappings = custom_mappings
    anilist.ANILIST_ACCESS_TOKEN = ANILIST_ACCESS_TOKEN
    anilist.ANILIST_PLEX_EPISODE_COUNT_PRIORITY = ANILIST_PLEX_EPISODE_COUNT_PRIORITY
    anilist.ANILIST_SKIP_UPDATE = ANILIST_SKIP_UPDATE
    anilist_series = anilist.process_user_list(anilist_username)

    # Plex
    if anilist_series is None:
        logger.error(
            'Unable to retrieve AniList list, check your username and access token'
        )
    else:
        if not anilist_series:
            logger.error(
                'No items found on your AniList list for additional processing later on'
            )

        plexmodule.plex_settings = plex_settings
        plex_anime_series = plexmodule.get_anime_shows()

        if (plex_anime_series is None):
            logger.error('Found no Plex shows for processing')
            plex_series_watched = None
        else:
            plex_series_watched = plexmodule.get_watched_shows(
                plex_anime_series)

        if (plex_series_watched is None):
            logger.error('Found no watched shows on Plex for processing')
        else:
            anilist.match_to_plex(anilist_series, plex_anime_series,
                                  plex_series_watched)

    logger.info('Plex to AniList sync finished')
Exemplo n.º 5
0
def start():
    logger.info(f"PlexAniSync - version: {__version__}")

    anilist.CUSTOM_MAPPINGS = read_custom_mappings()

    if graphql.ANILIST_SKIP_UPDATE:
        logger.warning(
            "AniList skip list update enabled in settings, will match but NOT update your list"
        )

    if anilist.ANILIST_PLEX_EPISODE_COUNT_PRIORITY:
        logger.warning(
            "Plex episode watched count will take priority over AniList, this will always update AniList watched count over Plex data"
        )

    anilist.clean_failed_matches_file()

    # Anilist
    anilist_username = anilist_settings["username"]
    anilist_series = anilist.process_user_list(anilist_username)

    # Plex
    if anilist_series is None:
        logger.error(
            "Unable to retrieve AniList list, check your username and access token"
        )
    else:
        if not anilist_series:
            logger.error(
                "No items found on your AniList list for additional processing later on"
            )

        plexmodule.plex_settings = plex_settings
        plex_anime_series = plexmodule.get_anime_shows()

        if plex_anime_series is None:
            logger.error("Found no Plex shows for processing")
            plex_series_watched = None
        else:
            plex_series_watched = plexmodule.get_watched_shows(
                plex_anime_series)

        if plex_series_watched is None:
            logger.error("Found no watched shows on Plex for processing")
        else:
            anilist.match_to_plex(anilist_series, plex_series_watched)

    logger.info("Plex to AniList sync finished")
Exemplo n.º 6
0
def start():
    logger.info(f"PlexAniSync - version: {__version__}")
    logger.info(f"Updating single show: {show_title}")

    anilist.CUSTOM_MAPPINGS = read_custom_mappings()

    if graphql.ANILIST_SKIP_UPDATE:
        logger.warning(
            "AniList skip list update enabled in settings, will match but NOT update your list"
        )

    anilist.clean_failed_matches_file()

    # Anilist
    anilist_username = anilist_settings["username"]
    anilist_series = anilist.process_user_list(anilist_username)

    # Plex
    if anilist_series is None:
        logger.error(
            "Unable to retrieve AniList list, check your username and access token"
        )
    elif not anilist_series:
        logger.error("No items found on your AniList list to process")
    else:
        # Wait a few a seconds to make sure Plex has processed watched states
        sleep(5.0)
        plexmodule.plex_settings = plex_settings
        plex_anime_series = plexmodule.get_anime_shows_filter(show_title)

        if plex_anime_series is None:
            logger.error("Found no Plex shows for processing")
            plex_series_watched = None
        else:
            plex_series_watched = plexmodule.get_watched_shows(
                plex_anime_series)

        if plex_series_watched is None:
            logger.error("Found no watched shows on Plex for processing")
        else:
            anilist.match_to_plex(anilist_series, plex_series_watched)

        logger.info("Plex to AniList sync finished")
Exemplo n.º 7
0
def start():
    if len(sys.argv) < 2:
        logger.error(
            'No show title specified in arguments so cancelling updating')
        sys.exit()
    else:
        show_title = sys.argv[1]
        logger.info('Updating single show: %s' % (show_title))

    if ANILIST_SKIP_UPDATE == 'true':
        logger.warning(
            'AniList skip list update enabled in settings, will match but NOT update your list')

    # Wait a few a seconds to make sure Plex has processed watched states
    sleep(5.0)

    # Anilist
    anilist_username = anilist_settings['username']
    anilist.custom_mappings = custom_mappings
    anilist.ANILIST_ACCESS_TOKEN = ANILIST_ACCESS_TOKEN
    anilist.ANILIST_SKIP_UPDATE = ANILIST_SKIP_UPDATE
    anilist_series = anilist.process_user_list(anilist_username)

    # Plex
    if not anilist_series:
        logger.error(
            'Unable to retrieve AniList list, check your username and access token')
    else:
        plexmodule.plex_settings = plex_settings
        plex_anime_series = plexmodule.get_anime_shows_filter(show_title)
        plex_series_watched = plexmodule.get_watched_shows(plex_anime_series)
        anilist.match_to_plex(
            anilist_series,
            plex_anime_series,
            plex_series_watched)

        logger.info('Plex to AniList sync finished')