Avnsx / fansly-downloader

Easy to use fansly.com content downloading tool. Written in python, but ships as a standalone Executable App for Windows too. Enjoy your Fansly content offline anytime, anywhere in the highest possible content resolution! Fully customizable to download in bulk or single: photos, videos & audio from timeline, messages, collection & specific posts 👍
https://fansly.com/
GNU General Public License v3.0
1.27k stars 63 forks source link

compability with os.startfile #3

Closed Avnsx closed 2 years ago

Avnsx commented 3 years ago

I've recently noticed that https://github.com/Avnsx/fansly/blob/3f7aabaf8000cbf5636600159f64f6e4cb0d55c3/fansly_scraper.py#L189 is incompatible with any other OS then Windows, which means that the code will exit out on other operating systems erroring; once it has come to the end of the file instead of waiting 120 seconds before closing. This is a minor issue, since it is located at the end of the entire work process, but still something to pay attention to for v0.3.

Would be happy if anyone could come up with better solutions then os.startfile I personally think there's no way around doing an OS check, and then using open (macOS), xdg-open (Linux), or os.startfile() for Windows

simmons2714 commented 2 years ago

Would this work? https://stackoverflow.com/questions/29823028/attributeerror-module-object-has-no-attribute-startfile

or

https://stackoverflow.com/questions/2878712/make-os-open-directory-in-python

simmons2714 commented 2 years ago
def startfile(filename):
  try:
    os.startfile(filename)
  except:
    subprocess.Popen(['xdg-open', filename])

if openwhenfinished: #could be a boolean doesn't matter really just sharing info
   startfile(full_path)

works on arch linux

Avnsx commented 2 years ago

fixed in db5f987