Beispiel #1
0
import os
import sys
from torrentparse import TorrentParser

if len(sys.argv) > 1:
    torrent_files = sys.argv[1:]
    for torrent_file in torrent_files:
        if os.path.exists(torrent_file):
            print 'Parsing file {}'.format(torrent_file)
        else:
            sys.exit('Unable to find file {}'.format(torrent_file))

for torrent_file in torrent_files:
    tp = TorrentParser(torrent_file)
    print "Torrent File Name: %s" % torrent_file
    print "Track URL: %s" % tp.get_tracker_url()
    print "Tracker Creation Date: %s" % tp.get_creation_date()
    print "Tracker Client Name: %s" % tp.get_client_name()
    print "Tracker File Details: %s" % tp.get_files_details()
    print "===="
Beispiel #2
0
 def test_get_tracker_url(self):
     ''' Test getting Tracker URL from a valid torrent file. '''
     for torrent_file in TORRENTS_INFO:
         tp = TorrentParser(os.path.join(test_data_dir, torrent_file))
         self.assertEqual(tp.get_tracker_url(), TORRENTS_INFO[torrent_file]['tracker_url'])
 def test_get_tracker_url(self):
     ''' Test getting Tracker URL from a valid torrent file. '''
     for torrent_file in TORRENTS_INFO:
         tp = TorrentParser(os.path.join(self.test_data_dir, torrent_file))
         self.assertEqual(tp.get_tracker_url(), TORRENTS_INFO[torrent_file]['tracker_url'])