Expand remote media folder, playlist check for locale
This commit is contained in:
parent
82a67286ea
commit
48183de587
16
app.py
16
app.py
|
@ -78,7 +78,9 @@ cmd_server = [
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
debug = app.config['DEFAULT']['debug']
|
debug = app.config['DEFAULT']['debug']
|
||||||
media_folder_remote = os.path.expanduser(app.config['DEFAULT']['media_folder_remote'])
|
pi_user = app.config['DEFAULT']['pi_user']
|
||||||
|
media_folder_remote = app.config['DEFAULT']['media_folder_remote']
|
||||||
|
media_folder_remote_expanded = media_folder_remote.replace("~/", "/home/{}/".format(pi_user))
|
||||||
media_folder_local = os.path.expanduser(app.config['DEFAULT']['media_folder_local'])
|
media_folder_local = os.path.expanduser(app.config['DEFAULT']['media_folder_local'])
|
||||||
media_exts = app.config['DEFAULT']['media_exts']
|
media_exts = app.config['DEFAULT']['media_exts']
|
||||||
auth = str(base64.b64encode(str(":" + app.config['DEFAULT']['vlc_auth']).encode('utf-8')), 'utf-8')
|
auth = str(base64.b64encode(str(":" + app.config['DEFAULT']['vlc_auth']).encode('utf-8')), 'utf-8')
|
||||||
|
@ -307,8 +309,8 @@ def get_playlist(host, xml_data, m3u=0):
|
||||||
playlist = []
|
playlist = []
|
||||||
item_list = []
|
item_list = []
|
||||||
playlist_duration = 0
|
playlist_duration = 0
|
||||||
|
# VLC's playlist node name can change according to the locale on the client, so check for this too.
|
||||||
if xml_data.find("./node") and xml_data.find("./node").get('name') == _("Playlist"):
|
if xml_data.find("./node") and (xml_data.find("./node").get('name') == "Playlist" or xml_data.find("./node").get('name') == _("Playlist")):
|
||||||
print("HAHAHAH")
|
print("HAHAHAH")
|
||||||
playlist = xml_data.findall("./node/leaf")
|
playlist = xml_data.findall("./node/leaf")
|
||||||
|
|
||||||
|
@ -363,7 +365,7 @@ def send_pilpil_command(host, arg0, arg1, arg2):
|
||||||
if debug:
|
if debug:
|
||||||
print("Brosing {}".format(media_folder_remote))
|
print("Brosing {}".format(media_folder_remote))
|
||||||
# Browse remote media folder
|
# Browse remote media folder
|
||||||
media_folder_remote_URL = quote(media_folder_remote)
|
media_folder_remote_URL = quote(media_folder_remote_expanded)
|
||||||
HTTP_request = "/requests/browse.xml?uri=file://{}".format(media_folder_remote_URL)
|
HTTP_request = "/requests/browse.xml?uri=file://{}".format(media_folder_remote_URL)
|
||||||
if debug:
|
if debug:
|
||||||
print("requesting url {} to {}:{}".format(HTTP_request, host, port_))
|
print("requesting url {} to {}:{}".format(HTTP_request, host, port_))
|
||||||
|
@ -387,7 +389,7 @@ def send_pilpil_command(host, arg0, arg1, arg2):
|
||||||
HTTP_request = HTTP_request + "&val=" + arg1
|
HTTP_request = HTTP_request + "&val=" + arg1
|
||||||
elif (arg0 == "enqueue") or (arg0 == "add") :
|
elif (arg0 == "enqueue") or (arg0 == "add") :
|
||||||
# Add 'input' url parameter
|
# Add 'input' url parameter
|
||||||
HTTP_request = HTTP_request + "&input=file://" + quote(media_folder_remote) + "/" + arg1
|
HTTP_request = HTTP_request + "&input=file://" + quote(media_folder_remote_expanded) + "/" + arg1
|
||||||
|
|
||||||
# Send request and get data response
|
# Send request and get data response
|
||||||
data = send_HTTP_request(host, port_, time_out=3, request_=HTTP_request)
|
data = send_HTTP_request(host, port_, time_out=3, request_=HTTP_request)
|
||||||
|
@ -473,11 +475,11 @@ def sync(host):
|
||||||
return str(current_upload)
|
return str(current_upload)
|
||||||
elif host == "all":
|
elif host == "all":
|
||||||
for hostl in hosts_available:
|
for hostl in hosts_available:
|
||||||
size += sync_media_folder(media_folder_local, media_folder_remote, hostl, cmd_port)
|
size += sync_media_folder(media_folder_local, media_folder_remote_expanded, hostl, cmd_port)
|
||||||
# ~ th = threading.Thread(target=blink_pi, args=(16,))
|
# ~ th = threading.Thread(target=blink_pi, args=(16,))
|
||||||
# ~ th.start()
|
# ~ th.start()
|
||||||
else:
|
else:
|
||||||
size = sync_media_folder(media_folder_local, media_folder_remote, host, cmd_port)
|
size = sync_media_folder(media_folder_local, media_folder_remote_expanded, host, cmd_port)
|
||||||
return str(size)
|
return str(size)
|
||||||
|
|
||||||
@app.route("/<host>/<arg0>/", defaults = { "arg1": "null", "arg2": "null" })
|
@app.route("/<host>/<arg0>/", defaults = { "arg1": "null", "arg2": "null" })
|
||||||
|
|
|
@ -62,6 +62,7 @@ sha256 :
|
||||||
# DONE :
|
# DONE :
|
||||||
* webgui : Increase live host scan when host first found
|
* webgui : Increase live host scan when host first found
|
||||||
* webgui : Btn hover/press fixed
|
* webgui : Btn hover/press fixed
|
||||||
|
* webgui : file selection/enqueuing
|
||||||
* server : Disable ssl verif for isup()
|
* server : Disable ssl verif for isup()
|
||||||
* server : Add blink command
|
* server : Add blink command
|
||||||
* client : rt8821cu driver back
|
* client : rt8821cu driver back
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
debug = 0
|
debug = 0
|
||||||
|
pi_user = "pil"
|
||||||
useSSL = false
|
useSSL = false
|
||||||
CAfile = "selfCA.crt"
|
CAfile = "selfCA.crt"
|
||||||
# scp, rsync, http
|
# scp, rsync, http
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
debug = 1
|
debug = 1
|
||||||
useSSL = false
|
pi_user = "pil"
|
||||||
|
useSSL = true
|
||||||
CAfile = "selfCA.crt"
|
CAfile = "selfCA.crt"
|
||||||
# scp, rsync, http
|
# scp, rsync, http
|
||||||
sync_facility = "http"
|
sync_facility = "http"
|
||||||
media_folder_local = "../medias"
|
media_folder_local = "../medias"
|
||||||
media_folder_remote = "~/Vidéos"
|
media_folder_remote = "~/Videos"
|
||||||
media_exts = ["mp4", "avi", "mkv"]
|
media_exts = ["mp4", "avi", "mkv"]
|
||||||
vlc_auth = "secret"
|
vlc_auth = "secret"
|
||||||
# OnNlY3JldA==
|
# OnNlY3JldA==
|
||||||
cmd_auth = "secret"
|
cmd_auth = "secret"
|
||||||
#hosts = ["10.42.0.10", "10.42.0.11"]
|
hosts = ["10.42.0.10", "10.42.0.11"]
|
||||||
hosts = ["127.0.0.1"]
|
|
||||||
# VLC http LUA port
|
# VLC http LUA port
|
||||||
vlc_port = 8887
|
vlc_port = 8887
|
||||||
# Clients cmd port
|
# Clients cmd port
|
||||||
|
|
Loading…
Reference in New Issue