def getMostViewedVideos(catalog, country, categoryId, top): country = model.getCountry(catalog, countryName) lst = model.sortVideosByViews(videos) videos = country["videos"] emptyLst = model.emptyList() counter = 0 for video in lt.iterator(lst): if (counter < int(top)): if (video['country'] == country and video['category_id'] == categoryId): lt.addLast(emptyLst, video) counter = 1 + counter return emptyLst
def sortVideosByViews(catalog): """ Ordena los videos por 'views' """ deltatime = -1.0 deltamemory = -1.0 tracemalloc.start() starttime = getTime() startmemory = getMemory() sortedvideos = model.sortVideosByViews(catalog) stopmemory = getMemory() stoptime = getTime() tracemalloc.stop() deltatime = stoptime - starttime deltamemory = deltaMemory(startmemory, stopmemory) return sortedvideos, deltatime, deltamemory
def getVideosByCategoryAndCountry(catalog, category, country): delta_time = -1.0 delta_memory = -1.0 tracemalloc.start() start_time = getTime() start_memory = getMemory() category_id = model.cmpVideosCategoryID(catalog, category) videos = model.getVideosByCountry(catalog, country) size = lt.size(videos) videos = model.getVideosByCategoryR1(videos, int(size), category_id) size2 = lt.size(videos) videos_sorted = model.sortVideosByViews(videos, int(size2)) stop_memory = getMemory() stop_time = getTime() tracemalloc.stop() delta_time = stop_time - start_time delta_memory = deltaMemory(start_memory, stop_memory) delta = delta_time, delta_memory return videos_sorted, delta
def sortVideosByViews(catalog, category, country): return model.sortVideosByViews(catalog, category, country)
def sortVideosByViews(categoryAndCountry, rank): return model.sortVideosByViews(categoryAndCountry, rank)
def sortVideosByViews(lista_filtros, cantidad): """ Ordena los videos por views. """ return model.sortVideosByViews(lista_filtros, cantidad)
def sortVideosByViews(catalog, pais): return model.sortVideosByViews(catalog, pais)
def sortVideosByViews(videos): return model.sortVideosByViews(videos)