forked from TnS-hun/PtpUploader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL
225 lines (174 loc) · 11.3 KB
/
INSTALL
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
=====================================================================================================================================================
Quick installation
=====================================================================================================================================================
Run these commands from Linux's shell. (Most likely you have to use PuTTY.)
mkdir PTP
cd PTP
git clone https://github.com/TnS-hun/PtpUploader.git Program
wget https://pypi.python.org/packages/source/v/virtualenv/virtualenv-12.1.1.tar.gz
tar xvfz virtualenv-12.1.1.tar.gz
python virtualenv-12.1.1/virtualenv.py -v --distribute MyEnv
MyEnv/bin/pip install simplejson
MyEnv/bin/pip install poster
MyEnv/bin/pip install pyrobase
MyEnv/bin/pip install pyrocore
MyEnv/bin/pip install --upgrade sqlalchemy
MyEnv/bin/pip install flask
MyEnv/bin/pip install requests[security] || MyEnv/bin/pip install requests
MyEnv/bin/pip install watchdog
MyEnv/bin/pyroadmin --create-config
mkdir WorkingDirectory
cp Program/src/PtpUploader/Settings.example.ini Program/src/PtpUploader/Settings.ini
If you want to bypass CloudFlare's browser verification also run this:
MyEnv/bin/pip install cfscrape
MyEnv/bin/pip install PyExecJS
wget https://github.com/emmetio/pyv8-binaries/raw/master/pyv8-linux64.zip
unzip pyv8-linux64.zip
mv _PyV8.so Program/src/PtpUploader/
mv PyV8.py Program/src/PtpUploader/
rm pyv8-linux64.zip
If you're using Transmission also run this: MyEnv/bin/pip install transmissionrpc
Edit and fill out the details in Program/src/PtpUploader/Settings.ini.
See the "Starting PtpUploader in the background" section for how to start it.
=====================================================================================================================================================
Installation details
=====================================================================================================================================================
PtpUploader needs Python. Only version 2.5, 2.6 and 2.7 are supported.
Depends on the following Python packages:
- Flask: http://flask.pocoo.org/
- poster: http://atlee.ca/software/poster/
- PyroScope: http://code.google.com/p/pyroscope/
- PyV8: https://code.google.com/p/pyv8/
- Optional dependency, used by cfscrape to bypass CloudFlare.
- Requests: http://docs.python-requests.org/en/latest/
- simplejson: http://undefined.org/python/#simplejson
- Because Python 2.5 doesn't have the json module.
- SQLAlchemy: http://www.sqlalchemy.org/
- transmissionrpc
- This is only needed for Transmission.
- watchdog: https://github.com/gorakhargosh/watchdog
If you don't have root acces, use virtualenv ( http://pypi.python.org/pypi/virtualenv ) to install the required Python packages.
Required programs:
- MediaInfo: http://mediainfo.sourceforge.net/
- mktorrent: http://mktorrent.sourceforge.net/
- unrar: http://www.rarlab.com/rar_add.htm
One of them is required:
- mpv: https://mpv.io/ -- this is the recommended program for taking screenshots
- ffmpeg: http://www.ffmpeg.org/
- MPlayer: http://www.mplayerhq.hu/
Optional programs:
- ImageMagick: http://www.imagemagick.org/
- Highly recommended for losslessly compressing the PNGs
- FlexGet: http://flexget.com/
- autodl-irssi: http://sourceforge.net/projects/autodl-irssi/
One of the following torrent clients is required:
- rTorrent: http://libtorrent.rakshasa.no/
- This is the recommended client. It supports fast resume.
- Transmission: https://www.transmissionbt.com/
=====================================================================================================================================================
Extracting PtpUploader
=====================================================================================================================================================
Recommended directory structure:
- PTP
- Program
- WorkingDirectory
The easiest way is to get the source straight from GitHub:
cd ~/PTP
git clone https://github.com/TnS-hun/PtpUploader.git Program
=====================================================================================================================================================
Configuring PyroScope
=====================================================================================================================================================
Simply run the following:
pyroadmin --create-config
=====================================================================================================================================================
Configuring PtpUploader
=====================================================================================================================================================
Copy Program/src/PtpUploader/Settings.example.ini to Settings.ini and edit the latter.
=====================================================================================================================================================
Installing FFmpeg (optional)
=====================================================================================================================================================
1. Create a temporary folder
2. Download the static build of FFmpeg to the temporary folder from here: https://sites.google.com/site/linuxencoding/builds
3. Extract it: tar xvjf name_of_the_file.tar.bz2
4. Move the file "ffmpeg" to a more convenient location
5. Delete the temporary folder
6. Set the FfmpegPath in Settings.ini and make sure that MplayerPath and MpvPath are commented out.
=====================================================================================================================================================
Compiling the latest version of MediaInfo (optional)
=====================================================================================================================================================
1. Create a temporary folder
2. Download CLI from All in one package from this page into the temporary directory: http://mediaarea.net/en/MediaInfo/Download/Source
3. Extract it: tar xvjf name_of_the_file.tar.bz2
4. Compile it:
cd MediaInfo_CLI_GNU_FromSource/
./CLI_Compile.sh
4. Move the file "MediaInfo/Project/GNU/CLI/mediainfo" to a more convenient location
5. Delete the temporary folder
6. Set the MediaInfoPath in Settings.ini.
=====================================================================================================================================================
Configuring autodl-irssi (optional)
=====================================================================================================================================================
Install irssi ( http://www.irssi.org/ ).
Install auodl-irssi:
mkdir -p ~/.irssi/scripts/autorun
cd ~/.irssi/scripts
wget -O autodl-irssi.zip https://github.com/autodl-irssi-community/autodl-irssi/archive/master.zip
unzip autodl-irssi.zip
rm autodl-irssi.zip
mv autodl-irssi-master/* .
rm -r autodl-irssi-master
cp autodl-irssi.pl autorun/
mkdir -p ~/.autodl
Copy autodl-irssi-master/autodl.example.cfg to ~/.autodl/autodl.cfg
Edit ~/.autodl/autodl.cfg and fill out the details (everything that starts with YOUR_).
=====================================================================================================================================================
Configuring FlexGet (optional)
=====================================================================================================================================================
Copy Program/src/FlexGet/config.example.yml to config.yml.
Make sure you change the path of the working directory in the config file.
FlexGet needs to run periodically to update the RSS feeds.
See FlexGet's documentation for details: http://flexget.com/wiki/InstallWizard/Linux/NoRoot/Virtualenv/Scheduling
=====================================================================================================================================================
Making sure UTF-8 character encoding is set (optional)
=====================================================================================================================================================
If you want to upload releases with accented characters you have to configure your
environment because in some Linux distributions character encoding is not set by default.
In ~/.profile or ~/.bash_profile set the following:
export LANG=en_US.UTF-8
export LOCALE=UTF-8
Entering this command in your terminal should print out an Euro sign (€):
echo -e '\xe2\x82\xac'
=====================================================================================================================================================
Using https (optional)
=====================================================================================================================================================
This is useful if you want to use the Torrent Sender Greasemonkey script from https sites.
Install pyOpenSSL:
MyEnv/bin/pip install pyopenssl
To create a self-signed SSL certificate run the following commands (when asked for input just press Enter):
openssl genrsa -des3 -passout pass:1234 -out server.pass.key 2048
openssl rsa -passin pass:1234 -in server.pass.key -out server.key
rm server.pass.key
openssl req -new -batch -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
rm server.csr
Set WebServerSslCertificatePath to the path of server.crt and WebServerSslPrivateKeyPath to the path of server.key in Settings.ini.
When first accessing PtpUploader with the https address your browser will show a warning. Just add the exception.
=====================================================================================================================================================
Starting PtpUploader in the background
=====================================================================================================================================================
Enter into your PTP directory (e.g.: cd ~/PTP) then use the following command:
screen -S PtpUploader MyEnv/bin/python Program/src/PtpUploader/Main.py
Use Ctrl+A, D to disconnect from screen. You can use "screen -r PtpUploader" to reconnect.
=====================================================================================================================================================
Updating PtpUploader
=====================================================================================================================================================
1. Stop PtpUploader
2. Enter into your PTP directory (e.g.: cd ~/PTP) then use the following command
2. cd Program && git pull --ff-only
3. Restart PtpUploader
=====================================================================================================================================================
Updating the Python modules installed earlier (optional but recommended monthly)
=====================================================================================================================================================
cd PTP
MyEnv/bin/pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs MyEnv/bin/pip install -U
You can also add this to crontab so it does it automatically.