Exemplo n.º 1
0
        result1 = controller.getVideosByCategory(
            catalog['video'], categoria)
        result = controller.sortVideos(
            result1, lt.size(result1), 'ms', 'comparetitles')[1]

        video_tendencia = controller.getMostTrendingDays(result)
        print("\n")
        printResultsv3(video_tendencia)

    elif str(inputs[0]) == "5":
        pais = input("Ingrese el país de referencia: ")
        tag = input('Ingrese el tag de referencia: ')
        n = int(input("Ingrese el número de videos que desea imprimir: "))
        print("\nCargando ....")

        result = controller.getVideosByCountryAndTag(
             catalog['country'], tag, pais)

        print(
            "Para la muestra de",
            lt.size(catalog['country']),
            "elementos, el tiempo (mseg) es:",
            str(result[0]))

        printResultsv2(result[1], n)

    elif str(inputs[0]) == "0":
        sys.exit(0)
    else:
        print("\n")
        print("Opción No Válida")
Exemplo n.º 2
0
    elif int(inputs[0]) == 4:
        categoryname = str(input("Ingrese la categoría\n"))
        categoryid = controller.getCategoryId(catalog, categoryname)
        videos = controller.getVideosByCategory(catalog, categoryid)
        sortedVideos = controller.sortVideosById(videos[0])
        firstVideoByTrendingDays = controller.getFirstVideoByTrendingDays(
            sortedVideos[0])
        time = videos[1] + sortedVideos[1] + firstVideoByTrendingDays[1]
        memory = videos[2] + sortedVideos[2] + firstVideoByTrendingDays[2]
        printFirstVideoByTrendingDaysByCategory(firstVideoByTrendingDays[0],
                                                categoryid, categoryname)
        printTimeandMemory(time, memory)

    elif int(inputs[0]) == 5:
        country = str(input("Ingrese el país\n"))
        tag = str(input("Ingrese el tag\n"))
        size = int(input("Ingrese el número de videos a listar\n"))
        videos = controller.getVideosByCountryAndTag(catalog, country, tag)
        sortedVideos = controller.sortVideosByLikes(videos[0])
        time = videos[1] + sortedVideos[1]
        memory = videos[2] + sortedVideos[2]
        if size > lt.size(videos[0]):
            print("El número de videos excede el tamaño del catálogo\n")
        else:
            printSortedVideosByLikes(sortedVideos[0], size, country, tag)
            printTimeandMemory(time, memory)

    else:
        sys.exit(0)
sys.exit(0)
Exemplo n.º 3
0
                                daysTrending)

    elif int(inputs[0]) == 4:
        category = input('Categoría: ')
        videosCategory = controller.getVideosByCategory(cont, category)
        topTrendingVideo = controller.sortVideosTime(videosCategory['videos'],
                                                     100)
        topVidTD = datetime.datetime.strptime(
            lt.getElement(topTrendingVideo, 0)['trending_date'], '%y.%d.%m')
        topVidPT = datetime.datetime.strptime(
            lt.getElement(topTrendingVideo, 0)['publish_time'][:10],
            '%Y-%m-%d')
        daysTrending = topVidTD - topVidPT
        daysTrending = int(daysTrending.days)
        printTopTrendingCategory(lt.getElement(topTrendingVideo, 0), 1,
                                 daysTrending)

    elif int(inputs[0]) == 5:
        n_videos = input('Top videos por likes: ')
        tag = input('Tag: ')
        country = input('Pais: ')
        videosCountryTag = controller.getVideosByCountryAndTag(
            cont, country, tag)
        topVideosLikes = controller.sortVideosLikes(videosCountryTag['videos'],
                                                    int(n_videos))
        printTopLikesTags(topVideosLikes, int(n_videos))

    else:
        sys.exit(0)
sys.exit(0)
Exemplo n.º 4
0
        printResultsv3(result)

    elif str(inputs[0]) == "5":
        categoria = int(
            input('Ingrese el código la categoría de referencia: '))
        print("\nCargando ....")
        videos_filtrados = controller.getVideosByCategory(x, categoria)
        result = controller.getMostTrendingDaysByID(
            videos_filtrados.get('videos'))
        printResultsv3(result)

    elif str(inputs[0]) == "6":
        pais = input("Ingrese el país de referencia: ")
        tag = input('Ingrese el tag de referencia: ')
        n = int(input("Ingrese el número de videos que desea imprimir: "))
        print("\nCargando ....")

        result = controller.getVideosByCountryAndTag(x, tag, pais)

        print("Para la muestra de", lt.size(x['country']),
              "elementos, el tiempo (mseg) es:", str(result[0]))

        printResultsv2(result[1], n)

    elif str(inputs[0]) == "0":
        sys.exit(0)

    else:
        print("\n")
        print("Opción No Válida")