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
#!/bin/python3 | |
from concurrent.futures import ThreadPoolExecutor | |
from pathlib import Path | |
import requests | |
from bs4 import BeautifulSoup | |
from slugify import slugify as restring | |
from termcolor import colored | |
# script to download books from wolnelektury.pl site |
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 argparse | |
from concurrent.futures import ProcessPoolExecutor | |
from io import BytesIO | |
from pathlib import Path | |
from imageio import imread, imwrite | |
from skimage.transform import resize | |
from mutagen.flac import FLAC, Picture |
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 to_opus(folder='.', ext='flac', bitrate=48): | |
from os import cpu_count | |
from pathlib import Path | |
from concurrent.futures import ThreadPoolExecutor | |
from subprocess import call | |
file_list = [file.name for file in Path(folder).iterdir() if file.is_file() and ext in file.name] | |
commands = [f'opusenc --bitrate {bitrate} --framesize 60 --discard-pictures --quiet "{file}" "{file.replace(ext, "opus")}"' for file in file_list] | |
with ThreadPoolExecutor(max_workers=cpu_count()) as executor: | |
for command in executor.map(call, commands): | |
pass |
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 argparse | |
import hashlib | |
import http.cookiejar | |
import re | |
import time | |
from concurrent.futures import ThreadPoolExecutor | |
from math import floor, log2 | |
from pathlib import Path | |
import requests |
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 argparse | |
import json | |
import re | |
import time | |
from concurrent.futures import ThreadPoolExecutor | |
from itertools import repeat | |
from pathlib import Path | |
import requests |
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 json | |
import os | |
from concurrent.futures import ThreadPoolExecutor | |
from datetime import date, timedelta | |
from time import sleep | |
import requests | |
API_KEY = '' # fill your API key | |
STATION_ID = '' # pws of intertest |