OS2 World.Com Forum

Subject  :  Attack of the DOTS..... and Bittorrent!
Author  :  sXwamp
Date  :  23 Apr, 2006 on 02:32
Has anyone wrote a REXX script to replace the dots and remove the [ ] characters in a torrent link before it is passed to the Bitttorrent client? The [ ] character really mess things up.

Thanks,

sXwamp


Subject  :  Re:Attack of the DOTS..... and Bittorrent!
Author  :  Jan-Erik jan-erik@os2ug.se
Date  :  29 Apr, 2006 on 06:31
/* Rename Torrent files, remove unwanted characters like [] and + */
'@echo off'

call RxLoadLib 'SysFileTree', 'SysLoadFuncs', 'RexxUtil'
call SysFileTree DIRECTORY()||'*.torrent', 'file', 'OF'
renamed = 0
do i = 1 to file.0
fname = strip( translate( file.i, '', '[]+' ) ) /* Remove characters. Adjust to your preference if nedded */
if fname \= file.i then do
Say 'Renaming "'||filespec( 'N', file.i )||'" to "'||filespec( 'N', fname )||'"'
'@rename "'||file.i||'" "'||filespec( 'N', fname )||'"'
if rc \= 0 then
say 'failed!!!'
else renamed = renamed + 1
end /* do */
end /* do */
Say renamed 'of' file.0 'files has been renamed.'
Return 0


/* load Libraries */
RxLoadLib: Procedure
If RxFuncQuery( ARG(1) ) \= 0 Then do
call RxFuncAdd ARG(2), ARG(3), ARG(2)
interpret 'If '||ARG(2)||'() \= 0 Then Return 1'
end
Return 0

---
//Jan-Erik


Subject  :  Re:Attack of the DOTS..... and Bittorrent!
Author  :  sXwamp
Date  :  29 Apr, 2006 on 11:47
Thank you very much! It's going to be a little longer before I get a hold of REXX.


sXwamp


Subject  :  Re:Attack of the DOTS..... and Bittorrent!
Author  :  Jan-Erik jan-erik@os2ug.se
Date  :  03 May, 2006 on 08:00
sXwamp, don't worry it'll come to you...

Note 1: I may have written the code a bit more complex than I had to.

Note 2: I've found out that the PM/GUI name may still appear to be the same as before the rename operation and contain [ ,] and +, but that's not that important.

You may find my BTWrapper @ http://www.xn--lrka-loa.com if you like ... it's completely written in rexx but use python and bittorrent to download torrents.

With kind regards
//Jan-Erik


Powered by UltraBoard 2000 <www.ub2k.com>