Exemplo n.º 1
0
def get(path_name, url, best_audio):
	def __get(path_name, url, best_audio): 
		f_links, audio_flinks = fili_links.get_fili_links(url, best_audio) #fili_links czyli linki embed, sel_audio_links czyli linki z wybranego audio
		host_links, audio_hlinks = down2.get_host_links(f_links, audio_flinks)
		download_links = down2.get_dl_links(host_links, audio_hlinks)
		down2.download(download_links, path_name)
	
	while True:
		downloader.kill_printer()
		try:
			informator.info(f'Pobieram: {path_name}')
			__get(path_name, url, best_audio)
			informator.success(f"Pobrano: {path_name}!")
			break
		except: 
			if have_connection():
				print(traceback.format_exc())
				print(f"Can't get: {path_name}")
				informator.error(f"Nie udało się pobrać: {path_name}")
				break
			else: # nie mam internetu, więc czekam aż będę mieć i ponawiam
				while not have_connection(): 
					print('Trying to reconnect...')
					informator.warning('Próbuję się połączyć...')
					time.sleep(3)
		print('Connected!')
		informator.info('Połączono!')
Exemplo n.º 2
0
		def simulate():
			while True: #wykonuje dopóki skończy mi się queue
				try:
					dl_links, path_name = self.result_queue.get()
				except queue.Empty: 
					informator.success('Skończono') # to nie jest callowane z jakiegos powodu
					break
				print("DL LINKS: ", dl_links, " PATH_NAME: ", path_name)
				if not dl_links:
					informator.warning("NIE MA DLINKOW DLA ", path_name, ', KONTYNUUJE')
					continue
				informator.info(f'Pobieram {path_name.split("/").pop()}...')
				down2.download(dl_links, path_name)
				informator.success(f'Pobrano!')
Exemplo n.º 3
0
def get_proper_links(url, best_audio):
	while True:
		try:
			informator.info('GETTING PROPER LINKS')
			f_links, audio_flinks = fili_links.get_fili_links(url, best_audio) #fili_links czyli linki embed, sel_audio_links czyli linki z wybranego audio
			if not f_links:
				informator.warning("NIE MA FLINKOW DLA ", url)
			informator.info('GOT F LINKS')
			host_links, audio_hlinks = down2.get_host_links(f_links, audio_flinks)
			if not host_links:
				informator.warning("NIE MA HLINKOW DLA ", url)
			informator.info('GOT H LINKS')
			download_links = down2.get_dl_links(host_links, audio_hlinks)
			if not download_links:
				informator.warning("NIE MA DLINKOW DLA ", url)
			informator.info('GOT D LINKS')
			return download_links
		except: 
			if have_connection():
				print(traceback.format_exc())
				print(f"Can't get proper links to: {url}")
				break
			else:
				while not have_connection(): 
					print('Trying to reconnect...')
					informator.warning('Próbuję się połączyć...')
					time.sleep(3)
Exemplo n.º 4
0
def download(links, name):
    set_no_proxy()
    for link in links:
        try:
            print(f"Downloading from: {link}")
            informator.info(f"Pobieranie {name}")
            dl = downloader.start(link, name, 8)
            return  #kończe pętle, bo pobrałem
        except Exception:
            print(traceback.format_exc())
            print("Something went wrong :( I'll try again...")
            informator.warning("Coś poszło nie tak... Próbuję jeszcze raz...")
            continue
    #jeśli doszło do tego momentu to żaden z linków nie zadziałał, najprawdopodobniej z powodu braku internetu
    raise Exception('Żaden z linków nie zadziałał (down2/download)')
Exemplo n.º 5
0
def download(dl_links, path_name):
	while True:
		downloader.kill_printer()
		try:
			informator.info(f'Pobieram: {path_name}')
			down2.download(dl_links, path_name)
			informator.success(f"Pobrano: {path_name}!")
			break
		except: 
			if have_connection():
				print(traceback.format_exc())
				print(f"Can't get: {path_name}")
				informator.error(f"Nie udało się pobrać: {path_name}")
				break
			else: # nie mam internetu, więc czekam aż będę mieć i ponawiam
				while not have_connection(): 
					print('Trying to reconnect...')
					informator.warning('Próbuję się połączyć...')
					time.sleep(3)
		print('Connected!')
		informator.info('Połączono!')