str(result[0][0])) printResults(result[0][1], int(size)) print("Tiempo [ms]: ", f"{result[2]:.3f}", " || ", "Memoria [kB]: ", f"{result[1]:.3f}") elif int(inputs[0]) == 3: pais = input("Escriba un país: ") print("Cargando información del video ....") resultado = controller.topdiastrendingporpais(catalog, pais) printResultPais(resultado[0][0], resultado[0][1]) print("Tiempo [ms]: ", f"{resultado[2]:.3f}", " || ", "Memoria [kB]: ", f"{resultado[1]:.3f}") elif int(inputs[0]) == 4: categ = input("Escriba una categoría: ") print("Cargando información del video ....") resultado = controller.topdiastrendingporcateg(catalog, categ) printResultCateg(resultado[0][0], resultado[0][1]) print("Tiempo [ms]: ", f"{resultado[2]:.3f}", " || ", "Memoria [kB]: ", f"{resultado[1]:.3f}") elif int(inputs[0]) == 5: size = input("Indique el numero de videos que quiere consultar: ") tag = input("Escriba un tag: ") pais = input("Escriba un pais: ") print("Cargando información de los videos ....") result = controller.sortVideosLikes(catalog, int(size), tag, pais) printResultsLikes(result[0][1], int(size)) print("Tiempo [ms]: ", f"{result[2]:.3f}", " || ", "Memoria [kB]: ", f"{result[1]:.3f}") else: sys.exit(0) sys.exit(0)
printCategoryCountry(sortedVideos[1], number, category, country) elif int(inputs[0]) == 4: country = input('País: ') input_sort_type = 'merge' countryVideos = controller.getVideosByCountry(catalog, country) sortedVideosTime = controller.sortVideosTime(countryVideos, int(1), str(input_sort_type)) printTopTrendingCountry(sortedVideosTime[1], int(number)) elif int(inputs[0]) == 5: category = input('Categoria: ') input_sort_type = 'merge' categoryVideos = controller.getVideosByCategory(catalog, category) sortedVideosTime = controller.sortVideosTime(categoryVideos, int(1), str(input_sort_type)) printTopTrendingCategory(sortedVideosTime[1], int(number)) elif int(inputs[0]) == 6: country = input('País: ') tag = input('Tag: ') input_sort_type = 'merge' tagsVideos = controller.getVideosByTags(catalog, tag) sortedVideosLikes = controller.sortVideosLikes(categoryVideos, int(3), str(input_sort_type)) printTopTags(sortedVideosLikes[1], int(number)) else: sys.exit(0) sys.exit(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)
f"{delta_memory:.3f}") elif opcion == 5: #Requerimiento 4. country = input('Ingrese el pais del cual desea saber información: ') n_videos = input('Ingrese el numero de videos a listar: ') tag = input('Ingrese el tag del video: ') delta_time = -1.0 delta_memory = -1.0 tracemalloc.start() start_time = controller.getTime() start_memory = controller.getMemory() sorted_likes = controller.sortVideosLikes(catalog, country) controller.likes_tags(sorted_likes, tag, n_videos) stop_memory = controller.getMemory() stop_time = controller.getTime() tracemalloc.stop() delta_time = stop_time - start_time delta_memory = controller.deltaMemory(start_memory, stop_memory) print('Tiempo[ms]: ', f"{delta_time:.3f}", "-", "Memoria [kB]: ", f"{delta_memory:.3f}") else: sys.exit(0) sys.exit(0)