This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def path_cost(graph, path, weights=None): | |
pathcost = 0 | |
for i in range(len(path)): | |
if i > 0: | |
edge=graph.es.find(_source=path[i-1], _target=path[i]) | |
if weights != None: | |
pathcost += edge[weights] | |
else: | |
#just count the number of edges | |
pathcost += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def heuristic_cost_estimate(graph, source, target): | |
#Possible implementation here https://gist.github.com/delijati/1629405 | |
return 0 #Heuristic = 0 : same as Dijkstra | |
def reconstruct_path(came_from, current_node): | |
if current_node in came_from: | |
p = reconstruct_path(came_from, came_from[current_node]) | |
return p + [current_node] | |
else: | |
return [current_node] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import m3u8 | |
from multiprocessing.pool import ThreadPool | |
import os | |
import requests | |
import subprocess | |
url = "http://ENTER_URL_HERE.m3u8" | |
def file_name_from_url(url): | |
# assumes that the last segment after the / represents the file name |