Skip to content

Commit 7c35e99

Browse files
Fix comments relative to PR #34
1 parent 6712c8f commit 7c35e99

7 files changed

Lines changed: 34 additions & 49 deletions

File tree

backend/StreamServerApp/database_utils.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,6 @@ def prepare_video(video_full_path, video_path, video_dir, remote_url):
324324
'ov_subtitles_remote_path': ov_subtitles_remote_path}
325325

326326

327-
def populate_db_from_remote_server(remotePath, ListOfVideos):
328-
""" # tobeDone
329-
ListOfVideos could be provided through an API Call
330-
"""
331-
332327

333328
def get_video_type_and_info(video_path):
334329
""" # Uses subliminal to parse information from filename.

backend/StreamServerApp/media_processing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def convert_subtitles_to_webvtt(input_file, output_file):
2626
2727
"""
2828
cmd = ["ffmpeg", "-n", "-sub_charenc", "UTF-8", "-i", input_file, output_file]
29-
if(os.path.isfile(output_file) is False):
29+
if not os.path.isfile(output_file):
3030
run_ffmpeg_process(cmd)
3131

3232

@@ -43,7 +43,7 @@ def extract_subtitle(input_file, output_file):
4343
4444
"""
4545
cmd = ["ffmpeg", "-n", "-sub_charenc", "UTF-8", "-i", input_file, "-map", "0:s:0", output_file]
46-
if(os.path.isfile(output_file) is False):
46+
if not os.path.isfile(output_file):
4747
run_ffmpeg_process(cmd)
4848

4949

@@ -68,7 +68,7 @@ def transmux_to_mp4(input_file, output_file, with_audio_reencode=False):
6868
cmd = ["ffmpeg", "-i", input_file,
6969
"-codec", "copy", "-movflags", "+faststart", output_file]
7070

71-
if(os.path.isfile(output_file) is False):
71+
if not os.path.isfile(output_file):
7272
run_ffmpeg_process(cmd)
7373

7474

@@ -88,5 +88,5 @@ def generate_thumbnail(input_file, duration, output_file):
8888
"""
8989
cmd = ["ffmpeg", "-ss", str(duration/2.0), "-i", input_file, "-an", "-vf", "scale=320:-1",
9090
"-vframes", "1", output_file]
91-
if(os.path.isfile(output_file) is False):
91+
if not os.path.isfile(output_file):
9292
run_ffmpeg_process(cmd)

backend/StreamServerApp/subtitles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
def init_cache():
1111
""" # init cache for subtitles database query and stuff.
1212
"""
13-
if(os.path.isfile('cachefile.dbm.db') is False):
13+
if not os.path.isfile('cachefile.dbm.db'):
1414
print("Create subtitles cache data")
1515
region.configure('dogpile.cache.dbm', arguments={
1616
'filename': 'cachefile.dbm'}, replace_existing_backend=True)

backend/StreamServerApp/urls.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
router.register(r'videos', videos.VideoViewSet, basename='videos')
1212
router.register(r'series', videos.SeriesViewSet, basename='series')
1313
router.register(r'movies', videos.MoviesViewSet, basename='movies')
14-
# router.register(r'history', accounts.HistoryViewSet, basename='history')
1514

1615

1716
urlpatterns = [

backend/StreamingServer/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
VIDEO_ROOT = os.path.join(BASE_DIR, 'Videos/')
6565

6666

67-
if (VERBOSE_OUTPUT is True):
67+
if VERBOSE_OUTPUT:
6868
customstdout = subprocess.PIPE
6969
customstderr = subprocess.PIPE
7070
else:

frontend/src/components/login/login.js

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,30 @@ import { Link, Redirect } from "react-router-dom";
33
import axios from 'axios';
44
import { Card, Form, Input, Button, Error } from "./AuthForm";
55
import { useAuth } from "../context/auth";
6+
import { client } from '../../api/djangoAPI';
67
import '../Modal.css'
78

89
function Login({toggleModalBox, setDisplayModal}) {
910
const [isLoggedIn, setLoggedIn] = useState(false);
1011
const [isError, setIsError] = useState(false);
1112
const [username, setUserName] = useState("");
1213
const [password, setPassword] = useState("");
13-
const email=""
1414
const { setAuthTokens } = useAuth();
1515

16-
function postLogin() {
17-
const http = axios.create({
18-
baseURL: process.env.REACT_APP_DJANGO_API,
19-
responseType: 'json',
20-
});
21-
http.post("/rest-auth/login/", {
22-
username,
23-
password,
24-
email,
25-
}).then(result => {
26-
if (result.status === 200) {
27-
setAuthTokens(result.data);
28-
setLoggedIn(true);
29-
} else {
30-
setIsError(true);
31-
}
32-
}).catch(e => {
16+
async function postLogin() {
17+
const param = {
18+
'username': username,
19+
'password': password,
20+
'email': "",
21+
22+
};
23+
const response = await client.postRequest("/rest-auth/login", null, param);
24+
if (response.status === 200) {
25+
setAuthTokens(response.data);
26+
setLoggedIn(true);
27+
} else {
3328
setIsError(true);
34-
});
29+
}
3530
}
3631

3732
function search(event) {

frontend/src/components/login/signup.js

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Link, Redirect } from "react-router-dom";
33
import axios from 'axios';
44
import { Card, Form, Input, Button, Error } from "./AuthForm";
55
import { useAuth } from "../context/auth";
6+
import { client } from '../../api/djangoAPI';
67

78
function Signup({toggleModalBox, setDisplayModal}) {
89
const [isLoggedIn, setLoggedIn] = useState(false);
@@ -13,25 +14,20 @@ function Signup({toggleModalBox, setDisplayModal}) {
1314
const email = ""
1415
const { setAuthTokens } = useAuth();
1516

16-
function postSignup() {
17-
const http = axios.create({
18-
baseURL: process.env.REACT_APP_DJANGO_API,
19-
responseType: 'json',
20-
});
21-
http.post("/rest-auth/registration/", {
22-
username,
23-
password1,
24-
password2,
25-
}).then(result => {
26-
if (result.status === 201) {
27-
setAuthTokens(result.data);
28-
setLoggedIn(true);
29-
} else {
30-
setIsError(true);
31-
}
32-
}).catch(e => {
17+
async function postSignup() {
18+
const param = {
19+
'username': username,
20+
'password1': password1,
21+
'password2': password2,
22+
23+
};
24+
const response = await client.postRequest("/rest-auth/registration", null, param);
25+
if (response.status === 201) {
26+
setAuthTokens(response.data);
27+
setLoggedIn(true);
28+
} else {
3329
setIsError(true);
34-
});
30+
}
3531
}
3632

3733
function search(event) {

0 commit comments

Comments
 (0)