aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: Option for Automatic Filename Cleanup for ed2k Links  (Read 2665 times)

kristof

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 20
Option for Automatic Filename Cleanup for ed2k Links
« on: April 06, 2011, 07:09:40 PM »

I would like an option to clean up all filenames that come to aMule by the ed2k link handler.  I regularly add many files from websites.  They all have periods in place of spaces.  Of course because you can't have spaces in a URL. :)  So I am forever spending time clicking on each file for the "show file details" dialog. Then I must click "cleanup" button and then "ok" to apply changes.  It would be so nice if I could select an option in preferences to automatically strip periods (except for one before filename extension) from all files that come by the ed2k handler program.  There are no worries about duplicate filenames since the websites do a good job of naming files.  All filenames are picked to handle cleaning without making duplicates.
Logged

skolnick

  • Global Moderator
  • Hero Member
  • *****
  • Karma: 24
  • Offline Offline
  • Posts: 1188
  • CentOS 6 User
Re: Option for Automatic Filename Cleanup for ed2k Links
« Reply #1 on: April 23, 2011, 10:34:06 PM »

I think this is better handled with a shell script that, after changing the link, it calls ed2k to queue it, like this:

Code: [Select]
#!/bin/bash
OLDLINK="$1"
NEWLINK=`echo $OLDLINK | sed 's/\./ /g'`
NEWLINK=`echo $NEWLINK | sed 's/[a-zA-Z0-9]*$/\.&/g'`
NEWLINK=`echo $NEWLINK | sed 's/ \./\./g'`
ed2k "$NEWLINK"

save the file as ed2ktest.sh (or whatever you like) and to use it, change to the folder where you saved it and run it like:

./ed2ktest.sh "<ED2K LINK YOU WANT TO GET>"

it should do what you want.

Regards.

P.S: I know there are more efficient ways of doing the same, even with sed, or awk...but my sed-fu and awk-fu are pretty weak lately :P
« Last Edit: April 23, 2011, 10:46:37 PM by skolnick »
Logged