From f185fbc153ec257e6b43517e9c3cb2c71742518f Mon Sep 17 00:00:00 2001 From: Pierre-Yves Bertholon Date: Fri, 10 Apr 2020 16:17:13 +0200 Subject: [PATCH 1/2] Bump version number --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9e4d362..535e2f2 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ ch.srgssr playfff - 21 + 22 jar pfff From 3120717c3b86846df0adbc86a4cfe7e099367dae Mon Sep 17 00:00:00 2001 From: Pierre-Yves Bertholon Date: Sun, 17 May 2020 01:10:01 +0200 Subject: [PATCH 2/2] Update ParsePlayUrl JS to version 25 with deeplink on new host --- .../resources/deeplink/v1/parsePlayUrl.js | 49 ++++++++++++++----- .../resources/deeplink/v2/parsePlayUrl.js | 49 ++++++++++++++----- 2 files changed, 72 insertions(+), 26 deletions(-) diff --git a/src/main/resources/deeplink/v1/parsePlayUrl.js b/src/main/resources/deeplink/v1/parsePlayUrl.js index 38a3897..b25d624 100644 --- a/src/main/resources/deeplink/v1/parsePlayUrl.js +++ b/src/main/resources/deeplink/v1/parsePlayUrl.js @@ -1,6 +1,6 @@ // parsePlayUrl -var parsePlayUrlVersion = 24; +var parsePlayUrlVersion = 25; var parsePlayUrlBuild = "mmf"; if(! console) { @@ -17,22 +17,22 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { // Get BU var bu = null; switch (true) { - case hostname.endsWith("tp.srgssr.ch") || hostname.endsWith("player.rts.ch") || hostname.endsWith("player.rsi.ch") || hostname.endsWith("player.rtr.ch") || hostname.endsWith("player.swissinfo.ch") || hostname.endsWith("player.srf.ch"): - bu = "tp"; + case hostname.endsWith("tp.srgssr.ch") || hostname.endsWith("player.rts.ch") || hostname.endsWith("player.rsi.ch") || hostname.endsWith("player.rtr.ch") || hostname.endsWith("player.swissinfo.ch") || hostname.endsWith("player.srf.ch") || (hostname.includes("srgssr") && pathname.startsWith("/srgletterbox-web")): + bu = "lb"; break; - case hostname.includes("rts.ch") || hostname.includes("srgplayer-rts") || (hostname.includes("play-mmf") && pathname.startsWith("/rts/")) || (hostname.includes("play-web") && pathname.startsWith("/rts/")): + case (hostname.includes("rts.ch") && !hostname.includes("play-staging")) || hostname.includes("srgplayer-rts") || (hostname.includes("play-mmf") && pathname.startsWith("/rts/")) || ((hostname.includes("play-web") || hostname.includes("play-staging")) && pathname.startsWith("/rts/")): bu = "rts"; break; - case hostname.includes("rsi.ch") || hostname.includes("srgplayer-rsi") || (hostname.includes("play-mmf") && pathname.startsWith("/rsi/")) || (hostname.includes("play-web") && pathname.startsWith("/rsi/")): + case hostname.includes("rsi.ch") || hostname.includes("srgplayer-rsi") || (hostname.includes("play-mmf") && pathname.startsWith("/rsi/")) || ((hostname.includes("play-web") || hostname.includes("play-staging")) && pathname.startsWith("/rsi/")): bu = "rsi"; break; - case hostname.includes("rtr.ch") || hostname.includes("srgplayer-rtr") || (hostname.includes("play-mmf") && pathname.startsWith("/rtr/")) || (hostname.includes("play-web") && pathname.startsWith("/rtr/")): + case hostname.includes("rtr.ch") || hostname.includes("srgplayer-rtr") || (hostname.includes("play-mmf") && pathname.startsWith("/rtr/")) || ((hostname.includes("play-web") || hostname.includes("play-staging")) && pathname.startsWith("/rtr/")): bu = "rtr"; break; - case hostname.includes("swissinfo.ch") || hostname.includes("srgplayer-swi") || (hostname.includes("play-mmf") && pathname.startsWith("/swi/")) || (hostname.includes("play-web") && pathname.startsWith("/swi/")): + case hostname.includes("swissinfo.ch") || hostname.includes("srgplayer-swi") || (hostname.includes("play-mmf") && pathname.startsWith("/swi/")) || ((hostname.includes("play-web") || hostname.includes("play-staging")) && pathname.startsWith("/swi/")): bu = "swi"; break; - case hostname.includes("srf.ch") || hostname.includes("srgplayer-srf") || (hostname.includes("play-mmf") && pathname.startsWith("/srf/")) || (hostname.includes("play-web") && pathname.startsWith("/srf/")): + case hostname.includes("srf.ch") || hostname.includes("srgplayer-srf") || (hostname.includes("play-mmf") && pathname.startsWith("/srf/")) || ((hostname.includes("play-web") || hostname.includes("play-staging")) && pathname.startsWith("/srf/")): bu = "srf"; break; case hostname.includes("play-mmf") && pathname.startsWith("/mmf/"): @@ -57,11 +57,11 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { * Ex: https://tp.srgssr.ch/p/rts/default?urn=urn:rts:video:6735513 * Ex: https://player.rts.ch/p/rts/default?urn=urn:rts:video:6735513&start=60 */ - if (bu == "tp") { + if (bu == "lb") { if (pathname.startsWith("/p/")) { var mediaURN = queryParams["urn"]; if (mediaURN) { - var redirectBu = "tp"; + var redirectBu = "lb"; switch (true) { case pathname.startsWith("/p/srf/"): redirectBu = "srf"; @@ -83,6 +83,13 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { return openMediaURN(server, redirectBu, mediaURN, startTime); } } + else if (pathname.startsWith("/srgletterbox-web")) { + var mediaURN = queryParams["urn"]; + if (mediaURN) { + var startTime = queryParams["pendingSeek"]; + return openMediaURN(server, "lb", mediaURN, startTime); + } + } } /** @@ -130,7 +137,7 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { pathname = pathname.substring(4); } - if (hostname.includes("play-web")) { + if (hostname.includes("play-web") || hostname.includes("play-staging")) { pathname = pathname.substring(4); pathname = pathname.replace("/stage/play", "/play"); pathname = pathname.replace("/test/play", "/play"); @@ -760,7 +767,7 @@ function schemeForBu(bu) { return "playswi"; break; case "mmf": - case "tp": + case "lb": return "letterbox"; break; default: @@ -792,7 +799,7 @@ function serverForUrl(hostname, pathname, queryParams) { } } } - else if (hostname.includes("play-web")) { + else if (hostname.includes("play-web") || hostname.includes("play-staging")) { if (pathname.includes("/stage/play")) { server = "stage"; } @@ -800,5 +807,21 @@ function serverForUrl(hostname, pathname, queryParams) { server = "test"; } } + else if (pathname.startsWith("/srgletterbox-web")) { + var serverParam = queryParams["env"]; + switch (serverParam) { + case "stage": + server = "stage"; + break; + case "test": + server = "test"; + break; + case "play mmf": + case "play+mmf": + case "mmf": + server = "play mmf"; + break; + } + } return server; } diff --git a/src/main/resources/deeplink/v2/parsePlayUrl.js b/src/main/resources/deeplink/v2/parsePlayUrl.js index 8eceb55..f2c3285 100644 --- a/src/main/resources/deeplink/v2/parsePlayUrl.js +++ b/src/main/resources/deeplink/v2/parsePlayUrl.js @@ -1,6 +1,6 @@ // parsePlayUrl -var parsePlayUrlVersion = 24; +var parsePlayUrlVersion = 25; var parsePlayUrlBuild = "mmf"; if(! console) { @@ -29,11 +29,11 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { * Ex: https://tp.srgssr.ch/p/rts/default?urn=urn:rts:video:6735513 * Ex: https://player.rts.ch/p/rts/default?urn=urn:rts:video:6735513&start=60 */ - if (bu == "tp") { + if (bu == "lb") { if (pathname.startsWith("/p/")) { var mediaURN = queryParams["urn"]; if (mediaURN) { - var redirectBu = "tp"; + var redirectBu = "lb"; switch (true) { case pathname.startsWith("/p/srf/"): redirectBu = "srf"; @@ -55,6 +55,13 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { return openMediaURN(server, redirectBu, mediaURN, startTime); } } + else if (pathname.startsWith("/srgletterbox-web")) { + var mediaURN = queryParams["urn"]; + if (mediaURN) { + var startTime = queryParams["pendingSeek"]; + return openMediaURN(server, "lb", mediaURN, startTime); + } + } } /** @@ -102,7 +109,7 @@ function parseForPlayApp(scheme, hostname, pathname, queryParams, anchor) { pathname = pathname.substring(4); } - if (hostname.includes("play-web")) { + if (hostname.includes("play-web") || hostname.includes("play-staging")) { pathname = pathname.substring(4); pathname = pathname.replace("/stage/play", "/play"); pathname = pathname.replace("/test/play", "/play"); @@ -778,7 +785,7 @@ function schemeForBu(bu) { return "playswi"; break; case "mmf": - case "tp": + case "lb": return "letterbox"; break; default: @@ -810,7 +817,7 @@ function serverForUrl(hostname, pathname, queryParams) { } } } - else if (hostname.includes("play-web")) { + else if (hostname.includes("play-web") || hostname.includes("play-staging")) { if (pathname.includes("/stage/play")) { server = "stage"; } @@ -818,22 +825,38 @@ function serverForUrl(hostname, pathname, queryParams) { server = "test"; } } + else if (pathname.startsWith("/srgletterbox-web")) { + var serverParam = queryParams["env"]; + switch (serverParam) { + case "stage": + server = "stage"; + break; + case "test": + server = "test"; + break; + case "play mmf": + case "play+mmf": + case "mmf": + server = "play mmf"; + break; + } + } return server; } function getBuFromHostname(hostname, pathname) { switch (true) { - case hostname.endsWith("tp.srgssr.ch") || hostname.endsWith("player.rts.ch") || hostname.endsWith("player.rsi.ch") || hostname.endsWith("player.rtr.ch") || hostname.endsWith("player.swissinfo.ch") || hostname.endsWith("player.srf.ch"): - return "tp"; - case hostname.includes("rts.ch") || hostname.includes("srgplayer-rts") || (hostname.includes("play-mmf") && pathname.startsWith("/rts/")) || (hostname.includes("play-web") && pathname.startsWith("/rts/")): + case hostname.endsWith("tp.srgssr.ch") || hostname.endsWith("player.rts.ch") || hostname.endsWith("player.rsi.ch") || hostname.endsWith("player.rtr.ch") || hostname.endsWith("player.swissinfo.ch") || hostname.endsWith("player.srf.ch") || (hostname.includes("srgssr") && pathname.startsWith("/srgletterbox-web")): + return "lb"; + case (hostname.includes("rts.ch") && !hostname.includes("play-staging")) || hostname.includes("srgplayer-rts") || (hostname.includes("play-mmf") && pathname.startsWith("/rts/")) || ((hostname.includes("play-web") || hostname.includes("play-staging")) && pathname.startsWith("/rts/")): return "rts"; - case hostname.includes("rsi.ch") || hostname.includes("srgplayer-rsi") || (hostname.includes("play-mmf") && pathname.startsWith("/rsi/")) || (hostname.includes("play-web") && pathname.startsWith("/rsi/")): + case hostname.includes("rsi.ch") || hostname.includes("srgplayer-rsi") || (hostname.includes("play-mmf") && pathname.startsWith("/rsi/")) || ((hostname.includes("play-web") || hostname.includes("play-staging")) && pathname.startsWith("/rsi/")): return "rsi"; - case hostname.includes("rtr.ch") || hostname.includes("srgplayer-rtr") || (hostname.includes("play-mmf") && pathname.startsWith("/rtr/")) || (hostname.includes("play-web") && pathname.startsWith("/rtr/")): + case hostname.includes("rtr.ch") || hostname.includes("srgplayer-rtr") || (hostname.includes("play-mmf") && pathname.startsWith("/rtr/")) || ((hostname.includes("play-web") || hostname.includes("play-staging")) && pathname.startsWith("/rtr/")): return "rtr"; - case hostname.includes("swissinfo.ch") || hostname.includes("srgplayer-swi") || (hostname.includes("play-mmf") && pathname.startsWith("/swi/")) || (hostname.includes("play-web") && pathname.startsWith("/swi/")): + case hostname.includes("swissinfo.ch") || hostname.includes("srgplayer-swi") || (hostname.includes("play-mmf") && pathname.startsWith("/swi/")) || ((hostname.includes("play-web") || hostname.includes("play-staging")) && pathname.startsWith("/swi/")): return "swi"; - case hostname.includes("srf.ch") || hostname.includes("srgplayer-srf") || (hostname.includes("play-mmf") && pathname.startsWith("/srf/")) || (hostname.includes("play-web") && pathname.startsWith("/srf/")): + case hostname.includes("srf.ch") || hostname.includes("srgplayer-srf") || (hostname.includes("play-mmf") && pathname.startsWith("/srf/")) || ((hostname.includes("play-web") || hostname.includes("play-staging")) && pathname.startsWith("/srf/")): return "srf"; case hostname.includes("play-mmf") && pathname.startsWith("/mmf/"): return "mmf";