mastodonrss.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env python
  2. #####################################################################
  3. # #
  4. # DESCRIPTION: #
  5. # This is a file for changing mastodon links to have .rss at the end#
  6. # #
  7. # LISCENSE INFO (A dedicated liscense file is in the repo.): #
  8. # ALL THE CODE IN THIS REPOSITORY INCLUDING THIS FILE IS #
  9. # (C) TrueAuraCoral and Other Contributors 2021. #
  10. # YOU CAN USE THIS FILE AND ANY OTHER FILE IN THIS REPOSITORY UNDER #
  11. # THE TERMS OF GNU GENERAL PUBLIC LICENSE VERSION 3 OR ANY LATER #
  12. # VERSION. TO FIND THE FULL TEXT OF THE LICENSE GO TO THE GNU.ORG #
  13. # WEBSITE AT ( https://www.gnu.org/licenses/gpl-3.0.html ). #
  14. #####################################################################
  15. # For command line args
  16. import sys
  17. # For running commands in shell with subprocess.Popen or subprocess.run
  18. import subprocess
  19. # Initialize the link variable so the loop works
  20. link = ""
  21. # Get link as the first argument if we can
  22. try:
  23. link = sys.argv[1]
  24. except:
  25. # Or prompt for the link
  26. # If the users just presses enter it will prompt again
  27. while not link:
  28. link = input("Mastodon link: ")
  29. # VARIABLES
  30. browser = 'c:\\users\\stanl\\appData\\local\\bravesoftware\\brave-browser\\application\\brave.exe'
  31. clipboard = 'clip'
  32. # Add .rss to given link
  33. new = link + ".rss"
  34. # Copy to clipboard
  35. subprocess.run(clipboard, universal_newlines=True, input=new)
  36. # Run the browser variable with the new url arg.
  37. subprocess.Popen([browser, new])