2010-02-03, 07:55
am4c130d Wrote:i appear to have had the same problem as watson540, but from this thread tracked down where the script was failing for me.
I previously had an earlier version of mythicallibrarian that simply queried thetvdb and if the show didn't have any episode information it failed - but where the info was present and on thetvdb it worked great. I updated today to a version dated 1/29/10, and immediately ran in to this problem.
I was trying to run the script against two shows which did not have episode names, or plot descriptions from schedulesdirect, and the move had failed last night with the older script. With the new script, like the examples outleradam gave back on #121 i had adequate disk space, but the directory showed as not writable.
Code:file size:485964kb
movedir free space: 203782276kb- writable:0
altmovedir free space: 203782276kb- writable:0
moviedir free space: 203782276kb- writable:0
altmoviedir free space: 203782276kb- writable:0
i played with the config parameters to no avail, and then started looking at the script itself (and i am no script writer - certainly i could not dream of writing anything as complex as this).
Looking at the checkpermissions subroutine i inverted the values of tmovedirwritable in the second "if" test - which should force a write, where previously it indicated the space was not writable. However, when i ran the script i received the same writable: 0. This indicated that the subroutine was not been executed - though it appeared that it was being called. Next i forced the initialization of tmovedirwritable to 1, and this gave this result
Code:file size:485964kb
movedir free space: 203782276kb- writable:1
altmovedir free space: 203782276kb- writable:1
moviedir free space: 203782276kb- writable:1
altmoviedir free space: 203782276kb- writable:1
which again indicated the second "if" test was not actually being run - as the test conditions made no difference to the initialization value.
The first "if" statement, whilst being understandable, made no sense to me - if i read it correctly it says the following
if "episode name" is null and "program name" is not null and "program name" is less than "episode name" then run the tests.
Suffice it to say, i commented out that line, and the associated elif and fi etc. As below
Code:#####check permissions#####
#checkpermissions by writing a small file then deleting it, checking along the way.
#checkpermissions takes file size, free space on dir, and the dir, then it performs
#tests. The result will be $tmovedirwritable as a 1 or a 0 for writable or not.
Checkpermissions () {
tmovedirwritable=0
# if [ "$2" = "" ] && [ "$1" != "" ] && [ $1 -lt $2 ]; then
echo "testing write permission on $3">$3/arbitraryfile.ext
if [ -f "$3/arbitraryfile.ext" -a -s "$3/arbitraryfile.ext" ]; then
rm -f "$3/arbitraryfile.ext"
test ! -f "$3/arbitraryfile.ext" && tmovedirwritable=1 || tmovedirwritable=0
else
tmovedirwritable=0
echo "check permissions on $movedir"
fi
# elif [ -z "$2" ] || [ $1 -ge $2 ]; then
# tmovedirwritable=0
# echo "unusable space-check:$3"
# fi
}
and everything now works like a champ. I suspect the correct fix is to replace -lt with -gt, but it still seems meaningless as a non-null program name will always be greater than a null episode name - no?
Out of interest, why would this test be included here - it seems irrelevant, as the program name and episode name seem to have no bearing on whether the disk space is adequate and writable?
However, i hope that this helps - it caused me some head scratching, and the efforts you two have exerted indirectly pointed me in the right direction.
Outleradam - thanks for this script, i have a few more old programs to check, but you may just have weened me off myth frontend after 7 years of happiness and tears.
Thanks
alan
thank you for posting that...now i can fix this bug in the newer script. Thank you for your great insight and wisdom please keep in touch on this thread
aND outleradam thanks for saying youll integrate this change.. i know those of us who use a real linux os (gentoo) really appreciate it. and sorry for the troubles i give you, just want a working setup thats all
ps..wtf is fidora?? you mean fedora? i havent seen anyone in this thread mention it