Repository navigation
feat: made the frag files to be created in the tmp/ folder instead of target download folder - #1975
Conversation
port19x
left a comment
There was a problem hiding this comment.
The point of the feature is to reduce Disk writes by leveraging tmpfs mountpoints / directories where available.
$HOME/tmp lives on disk on standard linux distros.
Please change the default
|
I know this isn't what you suggested, but I added |
1f48203 to
59c4880
Compare
|
Apologies for the delay in review. |
There was a problem hiding this comment.
I just looked into how the paths behave across platforms and find this to be quite error prone, especially on Windows and in Docker Containers.
I'd like to revise my earlier call to make this default.
I'd prefer this to be off by default, with ANI_CLI_TMP_DIR retained as an option for users with fragile/slow disks.
That way we can also drastically debloat this PR by getting rid of L129-L142 and L363.
L470 would be tmp_dir="${ANI_CLI_TMP_DIR:-$ANI_CLI_DOWNLOAD_DIR}" or tmp_dir="${ANI_CLI_TMP_DIR:-.}", the choice of which I'll leave to your discretion for now.
… the target download directory when downloading episodes.
…ory from `$XDG_RUNTIME_DIR`, `/dev/shm`, then `${TMPDIR:-/tmp}`, so a tmpfs is preferred where available. `ANI_CLI_TMP_DIR` still overrides it.
…nto the loop when XDG_RUNTIME_DIR variable is empty. Also for the defaul_tmp_dir function to not work everytime now it only called in download function
…e download_dir and removed the tmp_dir variable check in download function.
1637e0d to
da98f11
Compare
|
I like the scope of it now and it's almost done. |
…the tmp folder feature. added documentation for it to.
port19x
left a comment
There was a problem hiding this comment.
Looks good otherwise, I'll try to test tonight
port19x
left a comment
There was a problem hiding this comment.
works beautifully, thanks for your contribution and patience
|
By default, files are saved in |
|
Is it a problem? Maybe bad for backwards compatibility? |
|
because by default, Windows uses |
|
That sounds pretty great, does this include downloaded files? |
just for temporary files before the download is complete |
|
|
||
| mode="${ANI_CLI_MODE:-sub}" | ||
| download_dir="${ANI_CLI_DOWNLOAD_DIR:-.}" | ||
| tmp_dir="${ANI_CLI_TMP_DIR:-.}" |
There was a problem hiding this comment.
| tmp_dir="${ANI_CLI_TMP_DIR:-.}" | |
| tmp_dir="${ANI_CLI_TMP_DIR:-${TEMP:-.}}" |
|
I didn't understand the issue. is it working or not? |
|
Me neither @emre-tiryaki @candrapersada pls make a proper issue or at the very least explain in full sentences |
|
Not even GPT-6-Astra can make sense of his suggestion/comment btw, kinda funny |
|
What I mean is adding a temp directory by default—without requiring |
|
Do you mean you want that or do you mean that this is the current behaviour? |
By default, on Windows, it uses the TEMP directory for temporary files, without requiring |
|
But every other os is manually configuring Should windows be an exception? |
|
I don't think this is worth changing the code over |

Type of change
Description
Closes #1955
When downloading with
yt-dlp, the intermediate files (.part,.ytdl, and the-FragNfiles created by concurrent fragment downloads) were written into the download directory. This is noisy for file managers, causes needless write churn on SSDs, and makes it hard to tell finished episodes from in-progress ones while a range is still downloading.This PR moves yt-dlp's temporary files into a separate directory. Only the finished file ends up in the download directory.
Changes
tmp_dir, defaulting to${TMPDIR:-/tmp}/ani-cli, overridable withANI_CLI_TMP_DIR. No new CLI flag, in line with the otherANI_CLI_*settings.download()now passes-P "home:$download_dir" -P "temp:$tmp_dir"to yt-dlp and only the file name to-o.Notes
mktemp -don purpose, so yt-dlp can still resume an interrupted download from its.partfile./tmpis a tmpfs, the in-progress file lives in RAM until the episode is finished. Users with limited RAM can pointANI_CLI_TMP_DIRto a disk-backed location.Usage
Default behaviour, fragments go to
${TMPDIR:-/tmp}/ani-cli, the result lands in the current directory:Absolute download directory, fragments still stay out of it:
ANI_CLI_DOWNLOAD_DIR="$HOME/Videos/anime" ./ani-cli -d -e 1-3 Violet EvergardenCustom temp location, e.g. when the default tmpfs is too small:
ANI_CLI_TMP_DIR="$HOME/.cache/ani-cli" ./ani-cli -d -e 1-6 Violet EvergardenChecking the result while a download is running:
Checklist
-chistory and continue work-ddownloads work-e(select episode) aka-r(range selection) works-Sselect index works-qquality works-ssyncplay works-vvlc works--duband regular (sub) mode both work--nextep-countdowncountdown to next ep works-hhelp info is up to dateAdditional Testcases
(these don't block a merge)
--skipani-skip works--no-detachno detach works--exit-after-playauto exit after playing worksCopy Pasta