Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to recreate empty temp files? #84

Open
ghost opened this issue Sep 15, 2022 · 7 comments
Open

How to recreate empty temp files? #84

ghost opened this issue Sep 15, 2022 · 7 comments

Comments

@ghost
Copy link

ghost commented Sep 15, 2022

Is there a way to recreate empty temp files? I use BTRFS as my file system and I've set the no Copy-on-Write attribute to my MLDonkey temp directory, but it does apply that attribute only to new files, but not to already existing ones. I've tried moving them to a different directory and then back to the temp directory, but that doesn't give them the -C flag attribute, since the file is still the same (already existing when the -C flag was set. Copying the files into new ones doesn't work, either, since MLDonkey doesn't seem to recognize them as the same files and it gives only problems.

The only way I've managed to get the -C flag attribute to be applied to existing temp files is to cancel the download within MLDonkey and create it again. Since I have many temp files already, it'd be a real pain to have to manually cancel and re-create the downloads again. Therefore my question: is there a way to have MLDonkey re-create the empty files within the temp directory for me?

If that isn't possible, is there a way to extract the downloading links to many files at once? That way I could cancel all of them and add them all at once through the download window (DL button).

Thank you in advance for any help/advice.

Cheers.
Ángel

@lulol
Copy link

lulol commented Sep 19, 2022

Stopping the core before removing and then recreating the empty files (with 0 downloaded bytes) prior to starting it again they should be recognized and not cause trouble, but don't know the particularities of BTRFS.

Currently [1] don't know if there is a better way to extract all the downloading links than using the vd <n> command one by one. Unfortunately listing all downloading files with vd doesn't list the links.

You can send the commands via script using mldonkey_command or directly querying the webgui.

Assuming ed2k links:

#LIST=$(seq 1 123)
LIST="1 2 3 5 7 11 13"
for N in $LIST; do
  curl -s "http://${USER}:${PASSWORD}@${HOST}:4080/submit?q=vd+${N}" \
  | sed -ne "s#^.*\(ed2k://|file|[^<]*\)<.*#\1#p"
done >> my_elinks.txt

Alternatively all the download links are listed in the files.ini file that you can parse directly.


[1] The old Sancho GUI can get the links for all the selected files all at once.

@ghost
Copy link
Author

ghost commented Sep 21, 2022

Alternatively all the download links are listed in the files.ini file that you can parse directly.

Thank you, lulol! Where in the files.ini file can I find the download links?
I can find the file names, the md4 sums, and a few other info fields, but I fail to find the download links.

@ghost
Copy link
Author

ghost commented Sep 21, 2022

#LIST=$(seq 1 123)
LIST="1 2 3 5 7 11 13"
for N in $LIST; do
curl -s "http://${USER}:${PASSWORD}@${HOST}:4080/submit?q=vd+${N}"
| sed -ne "s#^.(ed2k://|file|[^<])<.*#\1#p"
done >> my_elinks.txt

That works beautifully, thank you! I was typing my reply to thank you, but also to complain that I was missing four links. Fortunately I've realized I have some Bittorrent downloads as well as e2dk; I checked and there are exactly four of them. So, I 'm good to go. Thank you very much!

Now just I need to find the way to cancel all 0% downloaded files (not one by one through the web interface) and restart them from my_elinks.txt file. :)

@lulol
Copy link

lulol commented Sep 21, 2022

You can cancel all the downloads sending guess what command via the webgui input box: cancel all :)

If you only want to cancel those in the list you already built to get the elinks in the LIST variable, just use the cancel <n> command instead vd <n> in a script like before.

LIST="1 2 3 5 7 11 13"
for N in $LIST; do
  curl -s "http://${USER}:${PASSWORD}@${HOST}:4080/files?cancel=+${N}" -o /dev/null
done

EDIT: I typed the wrong command. Corrected now.

@ghost
Copy link
Author

ghost commented Sep 21, 2022

You can cancel all the downloads sending guess what command via the webgui input box: cancel all :)

Thank you! Unfortunately, that won't help, because I wouldn't like the files which are already being downloaded to get cancel. Some of them have been downloading for months or even years and I wouldn't like to have to start over again with them. I rather pay the price of not having the +C (not Copy-on-Write) flag on them than starting over.

If you only want to cancel those in the list you already built to get the elinks in the LIST variable, just use the cancel <n> command instead vd <n> in a script like before.

Unfortunately, that won't help either, because I didn't build a LIST variable with only the 0% downloaded files, since they are too many, but with all my downloads. Therefore, if I used the same LIST variable, I'd get the same result I'd get with the 'cancel all' command. That's why I said I need to find a way to cancel the files which haven't started downloading yet.

I've also tried clicking on the 'Clear all' button on the web interface with the intention to select everything to be cancelled and manually deselect the ones that have already started to be downloaded and I want to keep (they are many less than the ones I don't), but alas it won't work for me. Weirdly enough, the 'Pause all' and 'Resume all' buttons work just fine, but not 'Clear all'.

@lulol
Copy link

lulol commented Sep 21, 2022

That is because 'Clear all' clears all the check marks. Unfortunately there is no 'Set all' button, although the functionality is built in the embedded javascript code.

You can set all check marks opening a webconsole (in Firefox press F12) and typing at the prompt:

clearAll(true) sets all check marks
cancelAll(true) sets all the cancel check marks

Then you can make the needed changes before pressing submit to confirm.

@ghost
Copy link
Author

ghost commented Sep 21, 2022

That is because 'Clear all' clears all the check marks. Unfortunately there is no 'Set all' button, although the functionality is built in the embedded javascript code.

Oh, I see. I always assumed that it was actually supposed to cancel all. Whenever I clicked on it I had nothing selected, so there was nothing to clear and I thought it was somehow broken. :-)

You can set all check marks opening a webconsole (in Firefox press F12) and typing at the prompt:

clearAll(true) sets all check marks cancelAll(true) sets all the cancel check marks

Then you can make the needed changes before pressing submit to confirm.

I didn't find the way to do that in Chromium and had started selecting files to cancel by hand already when I read this, so I kept going and select them all in the end. It's taken me a few minutes of tedious repetitive work, but I think it's been worth it. I know have all the files for downloads that are at 0% with the +C flag, which was the objective. Yay!

I should start seeing a performance increase soon-ish, when some files (without the +C flag) end downloading and new ones (with the +C flag) start downloading.

Thanks a lot for all your help. It'd had been much more tedious without it! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant