Skip to content

Commit 51c83b3

Browse files
committed
Added simple configuration file
1 parent 5a0f360 commit 51c83b3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Diff for: mt_scrapper.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
from bs4 import BeautifulSoup
66

77

8-
DOWNLOAD_DIR = 'Downloads'
9-
108
def downloadFile(url, directory):
119
fileName = url[url.rfind('/')+1:len(url)]
1210
# To avoid errors due special characters in the filename,
@@ -21,6 +19,7 @@ def downloadFile(url, directory):
2119

2220

2321
app = Flask(__name__)
22+
app.config.from_pyfile("myconf.py")
2423

2524
@app.route("/")
2625
def hello():
@@ -37,7 +36,7 @@ def show_list_by_letter(letter):
3736
for link in soup.findAll('a'):
3837
if str(link.get('href'))[1:8] == 'serie-d':
3938
series[link.contents[0]] = link.get('href')
40-
39+
4140
return render_template('letter.html',
4241
series=series,
4342
letter=letter,
@@ -73,12 +72,12 @@ def show_chapters():
7372
torrents.append(link.get('href'))
7473

7574
for torrent in torrents:
76-
downloadFile(torrent, DOWNLOAD_DIR)
75+
downloadFile(torrent, app.config['DOWNLOAD_DIR'])
7776

7877
return render_template('serie.html', section=request.args.get('name', ''),
7978
torrents=torrents,
8079
cover=cover)
81-
80+
8281

8382
if __name__ == "__main__":
8483
app.run(debug=True)

Diff for: myconf.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import os
2+
3+
URL_SERVICE='http://mejortorrent.com'
4+
DOWNLOAD_DIR = os.path.join(os.path.dirname(__file__), 'Downloads')

0 commit comments

Comments
 (0)