dotfiles

A steaming hot pile of sh...ell scripts and configuration files.
git clone https://kaka.farm/~git/dotfiles
Log | Files | Refs

url2pandoc2calibre (688B)


      1 #!/usr/bin/python3
      2 
      3 from pprint import pprint as print
      4 import pathlib
      5 import subprocess
      6 import sys
      7 import uuid
      8 
      9 
     10 def main():
     11     calibre_inbox_dirpath = pathlib.Path.home() / "calibre-inbox"
     12     a_uuid = uuid.uuid4()
     13     output_path = calibre_inbox_dirpath / f"{a_uuid}.epub"
     14     user_agent = "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0"
     15 
     16     command_list = [
     17         "pandoc",
     18         "--output", f"{output_path}",
     19         "--request-header", f"{user_agent}",
     20         "--self-contained",
     21         "--verbose",
     22     ] + sys.argv[1:]
     23 
     24     print(command_list)
     25 
     26     subprocess.run(command_list, check=True)
     27 
     28 
     29 if __name__ == "__main__":
     30     main()