Author Topic: Add and browse torrents via OSD  (Read 25749 times)

June 12, 2009, 02:12:19 PM
Reply #30

ninja76

  • Newbie

  • Offline
  • *

  • 43
Since I am not sure at what stage the getrss.pl is running at boot up.  I would recommend removing the getrss.pl from the TorrentTV/etc/init.d/ start up script and moving it to a cron job.  I think having it run once or twice a day is enough.

Thanks for the input!

June 12, 2009, 03:57:29 PM
Reply #31

zaphod beeblebrox

  • Jr. Member

  • Offline
  • **

  • 62
umm.. No way.

Probably it's me, but I cannot make it work. I load the two perl script ("simple.pl" custom..made of one string [XML::Simple;], and "getrss.pl").. After that the "TorrentTV" folder start to grow and I see each directory ,one for each show.

Even the prompt from wdtv is correct, BUT the problem is 00Active Torrents is still empty and no .torrent inside.

After reboot I see no TorrentTV folder :-(

If anyone has tried this .app with ext3-boot with success, please tell :-)

Then there's the problem of rtorrent.. It seems to me that rtorrent.conf doesn't like at all 00Active Torrents name..

June 12, 2009, 08:58:19 PM
Reply #32

rezmus

  • Sr. Member

  • Offline
  • ****

  • 418
i gave it a try and works good. just add

Code: [Select]
mkdir -p "/tmp/media/usb/TorrentTV/00Active Torrents"
mkdir -p "/tmp/media/usb/TorrentTV/00Completed"

to /apps/TorrentTV/etc/init.d/S51TorrentTV before getrss.pl line to get dirs on boot

edit: there is also a mistake in file itself, should be #!/bin/sh instead of #/bin/sh (u need to change it coz script won;t start).

also u can change "00Active Torrents" to something else (00Active?), just edit /apps/TorrentTV/bin/getrss.pl and /apps/TorrentTV/bin/directory_changed.torrent.sh according to your needs.

btw: http://search.cpan.org/~zag/Net-RTorrent-0.06/lib/Net/RTorrent.pm
« Last Edit: June 12, 2009, 09:45:31 PM by rezmus »

June 13, 2009, 04:18:44 AM
Reply #33

zaphod beeblebrox

  • Jr. Member

  • Offline
  • **

  • 62
Thanks Ninja and Rezmus.. Something is still missing (at least for me)

I did all the thigs Rezmus told in his last post, but I got some errors:

1) at start i got TorrentTV folder but no show subfolders.. getrss don't start automatically, I suppose

2) if I start getrss manually I get some problems:

# perl /apps/TorrentTV/bin/getrss.pl
.
rm: cannot remove '.' or '..'
..
rm: cannot remove '.' or '..'

00Activetorrents

(mind that I removed the blank space on 00Active Torrents and changed the file accordingly, see above Rezmus post)

3) after this message nothing happens, but if I run perl command again, then torrents directories start to create..BUT! my 00Activetorrents folder is erased now  ???

4) after restart everyting is back again to 1) .. I got TorrentTvfolder + 00Completed + 00Activetorrents but no shows folders..

Hope it helps develope this amazing app..
« Last Edit: June 13, 2009, 04:40:27 AM by zaphod beeblebrox »

June 13, 2009, 05:33:55 AM
Reply #34

rezmus

  • Sr. Member

  • Offline
  • ****

  • 418
Code: [Select]
cat /apps/TorrentTV/etc/init.d/S51TorrentTV >> /boot/torrenttv.log
cat /apps/TorrentTV/bin/directory_changed.torrent.sh >> /boot/torrenttv.log
cat /apps/TorrentTV/bin/getrss.pl >> /boot/torrenttv.log

and attach here torrenttv.log from your usb stick.
« Last Edit: June 13, 2009, 06:09:30 AM by rezmus »

June 13, 2009, 06:05:23 AM
Reply #35

ninja76

  • Newbie

  • Offline
  • *

  • 43
New Version!
minor fixes:

1. Fixed syntax error in the init.d script (thanks rezmus)
2. Removed nohup from the getrss.pl in the init.d script (This might increase load time but reduce the chance of directories not being created.
3. Add commands to make the 00Active Torrents and 00Completed directories in init.d (Thanks rezmus)
http://www.mediafire.com/?m1xxyctcw9b


Working on a script to fetch images for each show on the rss feed from tvrage.  Also thinking about adding a "Whats on tonight" entry to get TV guide listings for that nights shows and the ability to add that show and try to find it later on.

If it wasn't for college football season I would ditch my satellite TV!
 

June 13, 2009, 06:06:50 AM
Reply #36

dcrutgers

  • Jr. Member

  • Offline
  • **

  • 90
ninja76 - Great work! Thanks

June 13, 2009, 12:02:58 PM
Reply #37

ninja76

  • Newbie

  • Offline
  • *

  • 43
Here is the next version.  With some major changes:
1. I removed the spaces from all the main directories to be more compatible.
2. The directory structure is now:
    TorrentTV
        - Active_Downloads
        - Completed
        - RSS_Feeds
                      - My_TV_RSS (or your custom feed)
                      - Allow for multiple feeds (Future improvement)
        - Whats_on_Tonight (Another future feature that will pull TV guide info)
3. Added a TorrentTV.conf file to /apps/TorrentTV/etc where you configure your RSS feed
4.  I would recommend removing everything from TorrentTV.  And run the init.d manually because for some reason it only runs on startup half the time...
http://www.mediafire.com/?mzbybnz9k2d


June 13, 2009, 12:27:49 PM
Reply #38

dcrutgers

  • Jr. Member

  • Offline
  • **

  • 90
Wow, keep up the good work.. I really like this future feature "Allow for multiple feeds".

June 13, 2009, 12:51:03 PM
Reply #39

dcrutgers

  • Jr. Member

  • Offline
  • **

  • 90
Hmm.... I just tried this in a real test and when I add a torrent to my Queue it never downloads the torrent to  TorrentTV\Active_Downloads.  Ninja have you seen this before?

June 13, 2009, 12:56:37 PM
Reply #40

ninja76

  • Newbie

  • Offline
  • *

  • 43
Hmm.... I just tried this in a real test and when I add a torrent to my Queue it never downloads the torrent to  TorrentTV\Active_Downloads.  Ninja have you seen this before?

Is the file size of the torrent in the Active_Downloads > 0 ?  I know with utorrent I have to start and restart when I change the directory config. 


June 13, 2009, 01:01:46 PM
Reply #41

dcrutgers

  • Jr. Member

  • Offline
  • **

  • 90
It never downloads the torrent to Active_Downloads, the folder is blank.. Bizarre.. Any ideas?

June 13, 2009, 03:25:06 PM
Reply #42

ninja76

  • Newbie

  • Offline
  • *

  • 43
It never downloads the torrent to Active_Downloads, the folder is blank.. Bizarre.. Any ideas?

Do you see any "wget" messages when you tail the messages.txt log and select a torrent??

June 13, 2009, 04:05:49 PM
Reply #43

zaphod beeblebrox

  • Jr. Member

  • Offline
  • **

  • 62
Code: [Select]
cat /apps/TorrentTV/etc/init.d/S51TorrentTV >> /boot/torrenttv.log
cat /apps/TorrentTV/bin/directory_changed.torrent.sh >> /boot/torrenttv.log
cat /apps/TorrentTV/bin/getrss.pl >> /boot/torrenttv.log

and attach here torrenttv.log from your usb stick.

Thanks for the support Rezmus!, here it is:

Code: [Select]
#!/bin/sh

MODE=$1         # either thumb or list
NEW_PATH=$2     # the directory

CHOICE=`basename "$NEW_PATH"`
PARENT=`dirname "$NEW_PATH"`
PARENT=`basename "$PARENT"`
OSD=/apps/event-osd/osd-backup
XML=inc_messagebox.xml
XML2=basic_browse.xml
TORRENTNAME=`perl -e 'print localtime();'`
MESSAGE="@@message"
TITLE="@@browse_title_icon"
CHANGE_DONE=0
 echo "$CHOICE"
    if [ "$PARENT" == "TorrentTV" ] && [ "$CHOICE" != "00Active Torrents" ] && [ "$CHOICE" != "00Completed" ]; then
     $TITLE="Torrent TV"
     MESSAGE="$CHOICE has been added to the download queue"
     wget -O"/tmp/media/usb/TorrentTV/00Active Torrents/$TORRENTNAME.torrent" -i "$NEW_PATH/torrent.link"
     logger "wget -O/tmp/media/usb/TorrentTV/00Active Torrents/$TORRENTNAME.torrent -i $NEW_PATH/torrent.link"
    fi
    if [ "$CHOICE" == "00Active Torrents" ]; then
     $TITLE="Active Torrents"
    fi
    
    if [ "$CHOICE" == "00Completed" ]; then
     $TITLE="Completed"
    fi
    
        sed "s/@@browse_title_icon/$TITLE/" -i $OSD/$XML2  
        sed "s/@@message/$MESSAGE/" -i $OSD/$XML
  nohup `dirname "$0"`/directory_restore.osd.sh &      
use XML::Simple;
use LWP::Simple;
my $torrentBasePath = "/tmp/media/usb/TorrentTV";
my $torrentFinishedDir = "00Completed";
my $torrentActiveDir = "00Active Torrents";
## Clean out old stuff
opendir(DIR, $torrentBasePath);
    while (my $file = readdir(DIR)) {
if (($file ne $torrentFinishedDir) and ($file ne $torrentActiveDir))
{
          print "$file\n";
          `rm -r \"$torrentBasePath/$file\"`;
   };
    }

my $xml = get("http://pipes.yahoo.com/pipes/pipe.run\?_id\=5c5e909cb6011fd662b494fe608de4ee\&_render\=rss");
#my $xml = get("http://rss.bt-chat.com/\?group\=3");
$xsl = XML::Simple->new();
$data = $xsl->XMLin($xml, keyattr => ['item'] );
foreach my $item (@{$data->{channel}->{item}})
{
$torrentTitle = $item->{title};
$torrentLink = $item->{link};
$makeDir = `mkdir \"$torrentBasePath/$torrentTitle\"`;
`echo \"$torrentLink\" > \"$torrentBasePath/$torrentTitle/torrent.link\"`;
};
« Last Edit: June 13, 2009, 04:16:41 PM by zaphod beeblebrox »

June 14, 2009, 12:43:15 AM
Reply #44

rezmus

  • Sr. Member

  • Offline
  • ****

  • 418
ok u said u changed dir to 00ActiveTorrents, but i still see the space in scripts, and plz paste also the content of script which is in /apps/TorrentTV/etc/init.d/ dir coz i don;t see it in your log.