Commit be5b3e61 authored by Vitaly Lipatov's avatar Vitaly Lipatov

play yandex-browser codecs: check browser is installed before detecting version

parent 75028e12
...@@ -10,15 +10,22 @@ URL="https://browser-resources.s3.yandex.net/linux/codecs_snap.json" ...@@ -10,15 +10,22 @@ URL="https://browser-resources.s3.yandex.net/linux/codecs_snap.json"
CODECS_JSON="https://browser-resources.s3.yandex.net/linux/codecs_snap.json" CODECS_JSON="https://browser-resources.s3.yandex.net/linux/codecs_snap.json"
JSON="$(eget -O- "$CODECS_JSON")" JSON="$(eget -O- "$CODECS_JSON")"
BROWSER_PKG="${PKGNAME%-codecs-ffmpeg-extra}"
case "$PKGNAME" in case "$PKGNAME" in
*beta*) *beta*)
VERSION=$(grep -ao "Chrome/[0-9.]*" /opt/yandex/browser-beta/yandex_browser | head -n1 | cut -d/ -f2 | cut -d. -f1) BROWSER_BIN=/opt/yandex/browser-beta/yandex_browser
;; ;;
*) *)
VERSION=$(grep -ao "Chrome/[0-9.]*" /opt/yandex/browser/yandex_browser | head -n1 | cut -d/ -f2 | cut -d. -f1) BROWSER_BIN=/opt/yandex/browser/yandex_browser
;; ;;
esac esac
[ -x "$BROWSER_BIN" ] || fatal "$BROWSER_PKG is not installed. Install it first with: epm play $BROWSER_PKG"
VERSION=$(grep -ao "Chrome/[0-9.]*" "$BROWSER_BIN" | head -n1 | cut -d/ -f2 | cut -d. -f1)
[ -n "$VERSION" ] || fatal "Can't detect browser Chrome version from $BROWSER_BIN"
FFMPEG_PATH="$(echo "$JSON" | parse_json_value "[\"$VERSION\",\"path\"]")" FFMPEG_PATH="$(echo "$JSON" | parse_json_value "[\"$VERSION\",\"path\"]")"
PKGURL="$(echo "$JSON" | parse_json_value "[\"$VERSION\",\"url\"]")" PKGURL="$(echo "$JSON" | parse_json_value "[\"$VERSION\",\"url\"]")"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment