Esempio n. 1
0
def scan_videos(videos, ignore_all=False, providers=None, skip_hashing=False):
    """
    receives a list of videos containing dictionaries returned by media_to_videos
    :param videos:
    :param kind: series or movies
    :return: dictionary of subliminal.video.scan_video, key=subliminal scanned video, value=plex file part
    """
    ret = {}
    for video in videos:
        intent = get_intent()
        force_refresh = intent.get("force", video["id"], video["series_id"], video["season_id"])
        Log.Debug("Determining force-refresh (video: %s, series: %s, season: %s), result: %s"
                  % (video["id"], video["series_id"], video["season_id"], force_refresh))

        hints = helpers.get_item_hints(video)
        video["plex_part"].fps = get_stream_fps(video["plex_part"].streams)
        p = providers or config.get_providers(media_type="series" if video["type"] == "episode" else "movies")
        scanned_video = prepare_video(video, ignore_all=force_refresh or ignore_all, hints=hints,
                                      rating_key=video["id"], providers=p,
                                      skip_hashing=skip_hashing)

        if not scanned_video:
            continue

        scanned_video.id = video["id"]
        part_metadata = video.copy()
        del part_metadata["plex_part"]
        scanned_video.plexapi_metadata = part_metadata
        scanned_video.ignore_all = force_refresh
        ret[scanned_video] = video["plex_part"]
    return ret
Esempio n. 2
0
def scan_videos(videos, kind="series", ignore_all=False, no_refining=False):
    """
    receives a list of videos containing dictionaries returned by media_to_videos
    :param videos:
    :param kind: series or movies
    :return: dictionary of subliminal.video.scan_video, key=subliminal scanned video, value=plex file part
    """
    ret = {}
    for video in videos:
        intent = get_intent()
        force_refresh = intent.get("force", video["id"], video["series_id"],
                                   video["season_id"])
        Log.Debug(
            "Determining force-refresh (video: %s, series: %s, season: %s), result: %s"
            % (video["id"], video["series_id"], video["season_id"],
               force_refresh))

        hints = helpers.get_item_hints(video)
        video["plex_part"].fps = get_stream_fps(video["plex_part"].streams)
        scanned_video = scan_video(video,
                                   ignore_all=force_refresh or ignore_all,
                                   hints=hints,
                                   rating_key=video["id"],
                                   no_refining=no_refining)

        if not scanned_video:
            continue

        scanned_video.id = video["id"]
        part_metadata = video.copy()
        del part_metadata["plex_part"]
        scanned_video.plexapi_metadata = part_metadata
        ret[scanned_video] = video["plex_part"]
    return ret