Skip to content

Commit

Permalink
get_remote_video() has been updated to use the session's sessions for…
Browse files Browse the repository at this point in the history
… hostname connection retrieval #633
  • Loading branch information
Matthew Letter committed Aug 24, 2016
1 parent 85785eb commit fa36eba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/slycat/web/server/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def abspath(path):
#TODO: scrub sid
dispatcher.connect("get-remote-file", "/remotes/:hostname/file{path:.*}", slycat.web.server.handlers.get_remote_file, conditions={"method" : ["GET"]})
dispatcher.connect("get-remote-image", "/remotes/:hostname/image{path:.*}", slycat.web.server.handlers.get_remote_image, conditions={"method" : ["GET"]})
dispatcher.connect("get-remote-video", "/remotes/:sid/videos/:vsid", slycat.web.server.handlers.get_remote_video, conditions={"method" : ["GET"]})
dispatcher.connect("get-remote-video", "/remotes/:hostname/videos/:vsid", slycat.web.server.handlers.get_remote_video, conditions={"method" : ["GET"]})
dispatcher.connect("get-remote-video-status", "/remotes/:sid/videos/:vsid/status", slycat.web.server.handlers.get_remote_video_status, conditions={"method" : ["GET"]})

dispatcher.connect("get-user", "/users/:uid", slycat.web.server.handlers.get_user, conditions={"method" : ["GET"]})
Expand Down
14 changes: 11 additions & 3 deletions packages/slycat/web/server/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ def get_remote_file(hostname, path, **kwargs):
:param hostname: connection host name
:param path: path to file
:param kwargs:
:return:
:return: file
"""
sid = get_sid(hostname)
with slycat.web.server.remote.get_session(sid) as session:
Expand All @@ -1865,7 +1865,7 @@ def get_remote_image(hostname, path, **kwargs):
:param hostname: connection host name
:param path: path to image
:param kwargs:
:return:
:return: image
"""
sid = get_sid(hostname)
with slycat.web.server.remote.get_session(sid) as session:
Expand All @@ -1889,7 +1889,15 @@ def get_remote_video_status(sid, vsid):
with slycat.web.server.remote.get_session(sid) as session:
return session.get_video_status(vsid)

def get_remote_video(sid, vsid):
def get_remote_video(hostname, vsid):
"""
Given a hostname and vsid returns the video given
by the vsid
:param hostname: connection host name
:param vsid: video uuid
:return: video
"""
sid = get_sid(hostname)
with slycat.web.server.remote.get_session(sid) as session:
return session.get_video(vsid)

Expand Down

0 comments on commit fa36eba

Please sign in to comment.