-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscpbt
executable file
·53 lines (39 loc) · 1.04 KB
/
scpbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
import datetime
import glob
import os
import subprocess
import sys
from torrentool.api import Torrent
def main():
DL_PATH = os.path.expanduser('~/Downloads')
torrents = glob.glob('%s/*.torrent' % DL_PATH)
for torrent in torrents:
print(datetime.datetime.today())
print(os.path.basename(torrent))
t = Torrent.from_file(torrent)
destination = get_destination(t.announce_urls[0][0])
print('Copying to %s' % destination)
scp_result = subprocess.call(['scp', torrent, destination])
if scp_result == 0:
print('Removing file')
os.remove(torrent)
print()
def get_destination(url):
if 'apollo.rip' in url:
d = 'apollo'
elif 'tehconnection.eu' in url:
d = 'teh'
else:
print(url)
sys.exit()
d = 'misc'
return 'randomfoo.net:~/bt/%s/watch/' % d
if __name__ == '__main__':
main()
'''
https://pypi.python.org/pypi/torrentool
- used to parse info for torrents
https://pypi.python.org/pypi/parse-torrent-name/
- would be potentially useful for renaming
'''