twitch-dl icon indicating copy to clipboard operation
twitch-dl copied to clipboard

Setting temp save path

Open goldbattle opened this issue 3 years ago • 2 comments

Thanks again for the project.

What I need as output is the .ts files from download as I will render the combined stream myself afterwards. If possible can we get a command line argument to specify the temp folder as compared to the environmental variable. I want to specify the full folder path instead of dealing with the temp folders created with the vod name / twitch_dl that are currently created.

def _crete_temp_dir(base_uri):
    """Create a temp dir to store downloads if it doesn't exist."""
    path = urlparse(base_uri).path.lstrip("/")
    temp_dir = Path(tempfile.gettempdir(), "twitch-dl", path)
    temp_dir.mkdir(parents=True, exist_ok=True)
    return str(temp_dir)

I think just changing this line into a if statement with the original logic or just manual absolute path from the user: https://github.com/ihabunek/twitch-dl/blob/6f86aea493d7eb2a338ea656d7e49b80ba339932/twitchdl/commands/download.py#L243 If a user specified a temp folder argument it would use it, otherwise just use the existing function to create a temp folder.

goldbattle avatar Aug 01 '21 22:08 goldbattle

Fyi, on linux you can mount --bind /path/to/somewhere /tmp/twitch-dl. files then end up in /path/to/somewhere

notEvil avatar Mar 27 '22 15:03 notEvil

Python reads the temp dir from environment variables so you can already configure it.

export TEMP=/path/to/somewhere
...

Another option is to use a link instead of mount --bind as mount usually requires root.

ln -s /path/to/somewhere/twitch-dl /tmp/twitch-dl

Zod- avatar Sep 16 '22 23:09 Zod-