aboutsummaryrefslogtreecommitdiff
path: root/player
diff options
context:
space:
mode:
Diffstat (limited to 'player')
-rw-r--r--player/levitating-player.prj4
-rw-r--r--player/tasks.f9040
2 files changed, 33 insertions, 11 deletions
diff --git a/player/levitating-player.prj b/player/levitating-player.prj
index 3817ee4..fef15ef 100644
--- a/player/levitating-player.prj
+++ b/player/levitating-player.prj
@@ -32,9 +32,7 @@
"enabled":"1"
},{
"filename":"instructions.f90",
- "enabled":"1",
- "panel":1,
- "open":"1"
+ "enabled":"1"
},{
"filename":"player.F90",
"enabled":"1"
diff --git a/player/tasks.f90 b/player/tasks.f90
index c64cb40..87b7d66 100644
--- a/player/tasks.f90
+++ b/player/tasks.f90
@@ -70,7 +70,7 @@ contains
end function shell
function upload(url, source_filename)
- use config, only: token
+ use config, only: token, captain
use gemini_protocol, only: titan_post_url, STATUS_SUCCESS
implicit none
@@ -81,15 +81,26 @@ contains
character(len=:), allocatable::mod_url
integer(kind=8)::file_size
- integer::unit_number, istatus
+ integer::unit_number, istatus, url_length
inquire(file=source_filename, size=file_size)
open(newunit=unit_number, file=trim(source_filename), status='UNKNOWN', &
access='STREAM', form='UNFORMATTED', iostat=istatus)
-
- allocate(character(len=len_trim(url)) :: mod_url)
- mod_url = url
+
+ if(index(url, "://") > 0) then
+ allocate(character(len=len_trim(url)) :: mod_url)
+ mod_url = url
+ else
+ url_length = len_trim(url) + len_trim(captain) + 16
+ allocate(character(len=url_length) :: mod_url)
+ mod_url = "titan://"//trim(captain)
+ if(url(1:1) == "/") then
+ mod_url = trim(mod_url)//trim(url)
+ else
+ mod_url = trim(mod_url)//"/"//trim(url)
+ end if
+ end if
if(istatus == 0) then
istatus = titan_post_url(mod_url, unit_number, file_size, token)
@@ -105,6 +116,7 @@ contains
function download(url, destination_filename)
use gemini_protocol, only: request_url, STATUS_SUCCESS
+ use config, only: captain
implicit none
logical::download
@@ -114,14 +126,26 @@ contains
character(len=256)::mimetype
character(len=:), allocatable::mod_url
+ integer::url_length
integer::unit_number, istatus
- allocate(character(len=len_trim(url)) :: mod_url)
- mod_url = url
+ if(index(url, "://") > 0) then
+ allocate(character(len=len_trim(url)) :: mod_url)
+ mod_url = url
+ else
+ url_length = len_trim(url) + len_trim(captain) + 16
+ allocate(character(len=url_length) :: mod_url)
+ mod_url = "gemini://"//trim(captain)
+ if(url(1:1) == "/") then
+ mod_url = trim(mod_url)//trim(url)
+ else
+ mod_url = trim(mod_url)//"/"//trim(url)
+ end if
+ end if
open(newunit=unit_number, file=trim(destination_filename), status='UNKNOWN', &
- access='STREAM', form='UNFORMATTED', iostat=istatus)
+ access='STREAM', form='FORMATTED', iostat=istatus)
if(istatus == 0) then
istatus = request_url(mod_url, unit_number, mimetype)