Skip to content

Commit 981b8d0

Browse files
committed
import fix
1 parent 6b8ecb2 commit 981b8d0

File tree

2 files changed

+36
-15
lines changed

2 files changed

+36
-15
lines changed

dlna.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,29 @@
1212
import struct
1313
import subprocess
1414
import uuid
15-
from helpers import (
16-
is_safe_path,
17-
send_device_description,
18-
send_scpd_xml,
19-
handle_get_protocol_info,
20-
parse_avi_duration,
21-
parse_mp4_duration,
22-
create_directory_mapping,
23-
)
15+
16+
try:
17+
from .helpers import (
18+
is_safe_path,
19+
send_device_description,
20+
send_scpd_xml,
21+
handle_get_protocol_info,
22+
parse_avi_duration,
23+
parse_mp4_duration,
24+
create_directory_mapping,
25+
)
26+
from http.server import BaseHTTPRequestHandler
27+
from urllib.parse import unquote, urlparse, quote
28+
except ImportError:
29+
from helpers import (
30+
is_safe_path,
31+
send_device_description,
32+
send_scpd_xml,
33+
handle_get_protocol_info,
34+
parse_avi_duration,
35+
parse_mp4_duration,
36+
create_directory_mapping,
37+
)
2438
from http.server import BaseHTTPRequestHandler
2539
from urllib.parse import unquote, urlparse, quote
2640

helpers.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import os
22
import struct
33
import traceback
4-
from constants import (
5-
SERVER_MANUFACTURER,
6-
SERVER_VERSION,
7-
SERVER_AGENT,
8-
is_supported_media_file,
9-
)
4+
5+
try:
6+
from .constants import (
7+
SERVER_MANUFACTURER,
8+
SERVER_VERSION,
9+
SERVER_AGENT,
10+
)
11+
except ImportError:
12+
from constants import (
13+
SERVER_MANUFACTURER,
14+
SERVER_VERSION,
15+
SERVER_AGENT,
16+
)
1017

1118

1219
def is_safe_path(base_dir, requested_path):

0 commit comments

Comments
 (0)