This repository has been archived by the owner on May 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
episodegrab.py
79 lines (54 loc) · 1.85 KB
/
episodegrab.py
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Import libraries
import FilterData
import Scraper
import os
import PTN
def grabepisode(show):
data= PTN.parse(show)
# Making sure a show name was entered
if not data.has_key('title'):
print 'No show entered'
# If a name was entered output results and give options to download.
else:
season=''
episode=''
resolution=''
quality=''
name=data['title']
if data.has_key('season'):
season=data['season']
if data.has_key('episode'):
episode=data['episode']
if data.has_key('resolution'):
resolution=data['resolution']
if data.has_key('quality'):
quality=data['quality']
a=''
b=''
# Filter resuluts to remove non matching results (some results from torrent sites are suitable).
results=Scraper.search_eztv(show)
filtered=FilterData.analyze(results,name,season,episode,resolution,quality)
# Output filtered data found and allow for selection of magnet or torrent, if non found alert user.
i=1
for torrent in filtered:
print '['+ str(i) +']'
for key in torrent:
if key!='Magnet' and key!='Torrent':
print key+': ' + torrent[key]
if key=='Magnet':
a=' Magnet available! '
if key == 'Torrent':
b = ' Torrent available! '
print a+b
print''
i+=1
a=''
b=''
if filtered!=[]:
print 'Choose wanted torrent:'
torrnum=raw_input()
print 'Choose enter Magnet for magnet or Torrent for torrent'
selected=raw_input()
os.startfile(filtered[int(torrnum)-1][selected])
else:
print 'No media found!'