20 lines
604 B
Python
20 lines
604 B
Python
from pathlib import Path
|
|
|
|
|
|
def main():
|
|
directory = Path(__file__).resolve().parent
|
|
for file in directory.glob("*.flv"):
|
|
with file.open() as fp:
|
|
line = fp.readline().strip()
|
|
if line != "[InternetShortcut]":
|
|
raise Exception(f"File {file} is not an internet shortcut!")
|
|
url_line = fp.readline().strip()
|
|
prefix = "URL="
|
|
if not url_line.startswith(prefix):
|
|
raise Exception(f"URL not found!")
|
|
url = url_line[len(prefix):]
|
|
print(file, url)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|