[19. June 2013] Soundcloud® available now | [7. June 2013] Youporn available now | [11 Jan. 2013] Customize your A-400 Home Screen

Firmware: A-400 [13 May 2013] | C-300 [30 Nov. 2012] | A-300 [30 Nov. 2012] | C-200 RC1 [13 June 2013] | A-200/A-210 RC1 [13 June 2013]

Just got your NMT | WIKI has the answers | Search the forum | Forum Rules/Policy | Firmware & Official NMT News | Popcornhour manuals



User(s) browsing this thread: 1 Guest(s)
Thread Closed 
Par'n'Rar?
11-30-2010, 07:46 AM (This post was last modified: 11-30-2010 08:20 AM by dc11ab.)
Post: #1
Par'n'Rar?
So, I'm new here after just recently finding out about CSI and installed some apps on my A110. I loved it before and now it's wonderful! I let it manage all my torrent downloads using Transmission. However, some stuff is rar'd (few is par'd). I've searched the forums, found some scripts, tried making my own, etc, but I'm wondering if there is a par'n'rar app yet?

If not, that's too bad. So, then maybe someone can help with my current script. Right now it extracts all the rar files (no par'ing yet), and then deletes all the rar files if everything extracted ok. So far so good, but I already have a couple problems:

1) How do I get the base directory given a file. 'basename' gives me just the file name, what gives just the path?

2) Apart from telnet'ing in a launcing a shell script, how can I launch the script from a browser as a cgi script? What all is needed?

For those interested, here is my unrar script (below). It's uber simple because, frankly, my scripting skills suck. It finds all .rar file (even multi-part files should have at least a .rar file but not guaranteed). it unrars outputing to a tmp file, then later if checks the tmpfile if the unrar was ok, and then uses the tmpfile to get the list of all rar files to delete.

Code:
#!/bin/sh

UNRAR=/mnt/syb8634/bin/unrar

# get a list of all rar files
for f in `find | grep "\.rar" | grep -v unrartmp`
do
    echo "Attempting to unrar file $f"
    RARLOG="${f}.unrartmp"
    `echo $UNRAR x -o- -v $f to $RARLOG`
    `$UNRAR x -o- -v $f > $RARLOG`
done

# ok, now find all the unrartmp files and detect which files were OK and delete them if ALL OK
for f in `find | grep unrartmp`
do
    echo "Checking $f"
    # is ALL OK
    AOK=0
    AOK=`grep "All OK" $f`
    if ( test "All OK" != "$AOK" ) then
        echo "$f did not unrar properly"
    else
        echo "$f unrared correctly, deleting files"
        FILELIST=`grep "Extracting from" $f | awk '{print $3}'`
        for i in $FILELIST
        do
            echo "Removing $i"
            `rm $i`
        done
        # remove the unrartmp file, too
        echo "Removing $f"
        `rm $f`
    fi
done
Find all posts by this user
11-30-2010, 08:26 AM
Post: #2
RE: Par'n'Rar?
(Moderation: edited out a surplus [ / code ] tag.)

I think user Lordy has made some PAR/RAR scripts, apart from the functionality found in Oversight?

dirname : http://ss64.com/bash/dirname.html

Audio, video, disco - I hear, I see, I learn.
Wiki. Wiki? Wiki!
Find all posts by this user
12-01-2010, 04:55 AM
Post: #3
RE: Par'n'Rar?
(11-30-2010 08:26 AM)dc11ab Wrote:  (Moderation: edited out a surplus [ / code ] tag.)

I think user Lordy has made some PAR/RAR scripts, apart from the functionality found in Oversight?

dirname : http://ss64.com/bash/dirname.html

Thanks. There were a few bugs getting Oversight's fabulous unpak.sh script to work because of some permission issue which I was able to fix. I can probably reuse it somehow for anything in a download directory.
Find all posts by this user
Thread Closed 


Forum Jump: