7zip unpack script fails

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
ambreswe
Posts: 6
Joined: Tue Sep 30, 2014 4:08 pm

7zip unpack script fails

Post by ambreswe »

Hi there!

I have this nifty script, which I've used with uT for a while, thought I'd try Transmission QT.
However, the script fails, can't find any files...
If I run the same commands manually, it's fine.
If I echo the variables, it's fine.

Any ideas?
Running it under Win8.1 with the latest Transmission QT.

Thanks

Code: Select all

@echo off
set dir=%TR_TORRENT_DIR%\%TR_TORRENT_NAME%
rem Wait 10s for program to finish up with files
C:\Windows\SysWOW64\timeout /T 10 /NOBREAK
D:\7z.exe e -y %dir%\*.rar -o%dir%\
Error message:

Code: Select all

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18


Error:
cannot find archive
ambreswe
Posts: 6
Joined: Tue Sep 30, 2014 4:08 pm

Re: 7zip unpack script fails

Post by ambreswe »

Just tested with a script I run manually which also passes the directory to a variable and it works fine.
It seems to only fail when run from Transmission.
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: 7zip unpack script fails

Post by rb07 »

Code: Select all

Error:
cannot find archive
That comes from 7z, and has nothing to do with Transmission-Qt.

My guess is that your path ("dir" in the script) has spaces.

You should have use it like this (debug lines added so you can see what happens, remove it to just use it):

Code: Select all

rem @echo off
set dir="%TR_TORRENT_DIR%\%TR_TORRENT_NAME%"
rem Wait 10s for program to finish up with files
C:\Windows\SysWOW64\timeout /T 10 /NOBREAK
D:\7z.exe e -y -o"%dir%"\ "%dir%"\*.rar
pause
Also note that your script will fail if there's more than one .rar file (I haven't actually tested this, but 7z doesn't seem to handle more than one archive at a time -- no I'm not talking about archives in fragments, .r00, .r01, ..., .rar those will work fine).
ambreswe
Posts: 6
Joined: Tue Sep 30, 2014 4:08 pm

Re: 7zip unpack script fails

Post by ambreswe »

Tried all that except actually putting "" in the variable, will try that, cheers.
I tried with D:\7z.exe e -y -o"%dir%"\ "%dir%"\*.rar before and that did nothing.

The dir does not have spaces tho.

This script works fine "standalone" and from uT, that's why I figured Transmission did something weird with it.
ambreswe
Posts: 6
Joined: Tue Sep 30, 2014 4:08 pm

Re: 7zip unpack script fails

Post by ambreswe »

No, same problem.
If I echo all variables, they turn out fine, but when I run that 7z.exe, it just goes to shit.
Thanks for trying, but I think this IS a Transmission issue. Maybe it executes some super basic shell that can't actually do much. I dunno.
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: 7zip unpack script fails

Post by rb07 »

It's not a Transmission issue. You are using Transmission-Qt for Windows, which is a port (and fork) made and released by me (there is no Transmission official release so far) and there is no official support from Transmission (this forum, or the issue tracker), the SF project has its own support.

Now if spaces or foreign characters is not the problem, then its a 7z problem maybe caused by not being able to handle wide character arguments (Windows has 2 APIs, one is ASCII, the other is wide characters). But it is strange, since the one receiving the wide char arguments and environment variables is actually the cmd shell, which then invokes whatever is in the script. Try the script as I wrote it, with the pause at the end, add:

Code: Select all

dir "%dir%"\*.rar
anywhere before the pause, let's see if that works.
ambreswe
Posts: 6
Joined: Tue Sep 30, 2014 4:08 pm

Re: 7zip unpack script fails

Post by ambreswe »

Also tried that, that's another issue, you can't invoke dir like that anymore sadly, it's an internal command in cmd.exe and you need to invoke it some other way, haven't figured that out.
Tried with and without "", in both "set" and on that 7z command.
Also this this now:

Code: Select all

D:\7z.exe e -y "%TR_TORRENT_DIR%\%TR_TORRENT_NAME%"\*.rar -o"%TR_TORRENT_DIR%\%TR_TORRENT_NAME%"\
Doesn't work.
I give up, I'll stick with uT.
Thanks for trying.
ambreswe
Posts: 6
Joined: Tue Sep 30, 2014 4:08 pm

Re: 7zip unpack script fails

Post by ambreswe »

I've "moved" this over to Sourceforge and the Transmission QT forum, thanks.
Post Reply