elmoiv / redvid

Smart downloader for Reddit hosted videos
GNU General Public License v3.0
110 stars 15 forks source link

feature request: allow user to choose where the file gets saved to. #4

Closed bcornw2 closed 4 years ago

bcornw2 commented 4 years ago

Hello,

I've been playing with this all day and I gotta say, its pretty great. I know its new, and I was hoping you might add functionality to choose a location where you save the video, instead of the current directory. I know that in a python script, I could "os.chdir(path)", but that seems to have trouble, and I get "[Errno 18] Invalid cross device link", even though it actually works correctly - (sometimes when it merges audio and video, it doesn't delete the .m4a and the video.mp4 file, even though the finish product works well).

Also, I noted that your TODO says you want to add gif functionality - just wanted to let you know that I tested this with gifs and it already works (but saves it as .mp4 format - that works fine for my purposes, but I understand if people want .gif natively).

Thanks,

Ben

elmoiv commented 4 years ago

I think it is better to fork the repo and add a pull request after you add your desired features. You deserve to be a contributor :)

And don't worry about anything after I patch your pull request. Everything will be fixed.

bcornw2 commented 4 years ago

I'll take a swing at it, but I am not a great coder. Stay tuned tho!

elmoiv commented 4 years ago

Added this feature:

...
    def __init__(self, url='', path='', max_quality=False, min_quality=False, proxies={}):
        self.proxies = proxies
        self.max, self.min = m...
...

So now you can now choose where the file gets saved to by doing this:

from redvid import *
Reddit = Downloader()
Reddit.path = 'YOUR PATH'
Reddit.url = 'VIDEO URL'
Reddit.download()

Now working on the other features. When Everything is ready I will update the repo.

Stay tuned!

elmoiv commented 4 years ago

Feature added.

cmicek1 commented 4 years ago

Yeeeaaahh this is kinda broken, at least for me on windows. You change the working directory a few places (e.g. line 30 in redvid.py, and line 56 in tools.py), and then leave references to the full path lying around (in the name of the saved video, for example), so saving files doesn't work, since the path you're trying to save to is relative to your original location.

cmicek1 commented 4 years ago

Good news though is it's a one-line fix: change self.path, self.url, self.proxies = path, url, proxies to self.path, self.url, self.proxies = os.path.abspath(path), url, proxies on line 18 of redvid.py. I think you were enforcing absolute paths without stating that you were.

Edit: Maybe not one line; you want to return to the previous working directory when the download is done.

elmoiv commented 4 years ago

@cmicek1 Please follow issue template included in the repository to make it easier to deal with your issue.