mirror of
https://github.com/jellyfin/jellyfin-mpv-shim.git
synced 2025-02-19 22:20:30 +00:00
Improve translation and build scripts.
This commit is contained in:
parent
74eb4df4e5
commit
2884e10313
3
.gitignore
vendored
3
.gitignore
vendored
@ -10,3 +10,6 @@ cefpython3
|
||||
mpv32
|
||||
.eggs
|
||||
jellyfin_mpv_shim/default_shader_pack/*
|
||||
*.mo
|
||||
.last_sp_version
|
||||
.last_wc_version
|
||||
|
@ -476,13 +476,17 @@ The shaders included in the shader pack are also available under verious open so
|
||||
|
||||
If you are on Windows there are additional dependencies. Please see the Windows Build Instructions.
|
||||
|
||||
1. Install the dependencies: `sudo pip3 install --upgrade python-mpv jellyfin-apiclient-python pystray Jinja2 pywebview python-mpv-jsonipc Flask Werkzeug`.
|
||||
1. Install the dependencies: `sudo pip3 install --upgrade python-mpv jellyfin-apiclient-python pystray Jinja2 pywebview python-mpv-jsonipc Flask Werkzeug pypresence`.
|
||||
- If you run `./gen_pkg.sh --install`, it will also fetch these for you.
|
||||
2. Clone this repository: `git clone https://github.com/iwalton3/jellyfin-mpv-shim`
|
||||
- You can also download a zip build.
|
||||
3. `cd` to the repository: `cd jellyfin-mpv-shim`
|
||||
4. Download the [web client](https://github.com/iwalton3/jellyfin-web/releases) and place the contents of the dist folder inside a folder named `webclient` in the `webclient_view` folder.
|
||||
4. Run prepare script: `./gen_pkg.sh`
|
||||
- To do this manually, download the web client, shader pack, and build the language files.
|
||||
5. Ensure you have a copy of `libmpv1` or `mpv` available.
|
||||
6. Install any platform-specific dependencies from the respective install tutorials.
|
||||
7. You should now be able to run the program with `./run.py` or `./run-desktop.py`. Installation is possible with `sudo pip3 install .`.
|
||||
- You can also install the package with `./gen_pkg.sh --install`.
|
||||
|
||||
### Translation
|
||||
|
||||
|
114
gen_pkg.sh
Executable file
114
gen_pkg.sh
Executable file
@ -0,0 +1,114 @@
|
||||
#!/bin/bash
|
||||
# This script:
|
||||
# - Checks the current version
|
||||
# - Verifies all versions match and are newer
|
||||
# - Downloads/updates web client
|
||||
# - Download/updates default-shader-pack
|
||||
# - Generates locales
|
||||
# - Builds the python package
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
function get_resource_version {
|
||||
curl -s --head https://github.com/iwalton3/"$1"/releases/latest | \
|
||||
grep -i '^location: ' | sed 's/.*tag\///g' | tr -d '\r'
|
||||
}
|
||||
|
||||
# Verify versioning
|
||||
current_version=$(get_resource_version jellyfin-mpv-shim)
|
||||
current_version=${current_version:1}
|
||||
constants_version=$(cat jellyfin_mpv_shim/constants.py | grep '^CLIENT_VERSION' | cut -d '"' -f 2)
|
||||
setup_version=$(grep 'version=' setup.py | cut -d "'" -f 2)
|
||||
iss_version=$(grep '^#define MyAppVersion' "Jellyfin MPV Desktop.iss" | cut -d '"' -f 2)
|
||||
appdata_version=$(grep 'release version="' jellyfin_mpv_shim/integration/com.github.iwalton3.jellyfin-mpv-shim.appdata.xml | \
|
||||
head -n 1 | cut -d '"' -f 2)
|
||||
|
||||
if [[ "$current_version" == "$constants_version" ]]
|
||||
then
|
||||
echo "Warning: This version matches the current published version."
|
||||
echo "If you are building a release, the publish will not succeed."
|
||||
fi
|
||||
|
||||
if [[ "$constants_version" != "$setup_version" || "$setup_version" != "$iss_version" || "$iss_version" != "$appdata_version" ]]
|
||||
then
|
||||
echo "Error: The release does not have the same version numbers in all files!"
|
||||
echo "Please correct this before releasing!"
|
||||
echo "Constants: $constants_version, Setup: $setup_version, ISS: $iss_version, Flatpak: $appdata_version"
|
||||
fi
|
||||
|
||||
# Generate translations
|
||||
find -iname '*.po' | while read -r file
|
||||
do
|
||||
msgfmt "$file" -o "${file%.*}.mo"
|
||||
done
|
||||
|
||||
# Download web client
|
||||
update_web_client="no"
|
||||
if [[ ! -e "jellyfin_mpv_shim/webclient_view/webclient" ]]
|
||||
then
|
||||
update_web_client="yes"
|
||||
elif [[ -e ".last_wc_version" ]]
|
||||
then
|
||||
if [[ "$(get_resource_version jellyfin-web)" != "$(cat .last_wc_version)" ]]
|
||||
then
|
||||
update_web_client="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$update_web_client" == "yes" ]]
|
||||
then
|
||||
echo "Downloading web client..."
|
||||
wc_version=$(get_resource_version jellyfin-web)
|
||||
wget -q "https://github.com/iwalton3/jellyfin-web/releases/download/$wc_version/dist.zip"
|
||||
rm -r jellyfin_mpv_shim/webclient_view/webclient 2> /dev/null
|
||||
unzip dist.zip > /dev/null && rm dist.zip
|
||||
mv dist jellyfin_mpv_shim/webclient_view/webclient
|
||||
echo "$wc_version" > .last_wc_version
|
||||
fi
|
||||
|
||||
# Download default-shader-pack
|
||||
update_shader_pack="no"
|
||||
if [[ ! -e "jellyfin_mpv_shim/default_shader_pack" ]]
|
||||
then
|
||||
update_shader_pack="yes"
|
||||
elif [[ -e ".last_sp_version" ]]
|
||||
then
|
||||
if [[ "$(get_resource_version default-shader-pack)" != "$(cat .last_sp_version)" ]]
|
||||
then
|
||||
update_shader_pack="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$update_shader_pack" == "yes" ]]
|
||||
then
|
||||
echo "Downloading shaders..."
|
||||
sp_version=$(get_resource_version default-shader-pack)
|
||||
wget -qO release.zip "https://github.com/iwalton3/default-shader-pack/archive/$sp_version.zip"
|
||||
rm -r jellyfin_mpv_shim/default_shader_pack 2> /dev/null
|
||||
(
|
||||
mkdir default_shader_pack
|
||||
cd default_shader_pack
|
||||
unzip ../release.zip > /dev/null && rm ../release.zip
|
||||
mv default-shader-pack-*/* ./
|
||||
rm -r default-shader-pack-*
|
||||
)
|
||||
mv default_shader_pack jellyfin_mpv_shim/
|
||||
echo "$sp_version" > .last_sp_version
|
||||
fi
|
||||
|
||||
# Generate package
|
||||
if [[ "$1" != "--install" ]]
|
||||
then
|
||||
rm -r build/ dist/ .eggs 2> /dev/null
|
||||
mkdir build/ dist/
|
||||
echo "Building release package."
|
||||
python3 setup.py sdist bdist_wheel > /dev/null
|
||||
else
|
||||
if [[ "$(which sudo 2> /dev/null)" != "" && ! "$*" =~ "--local" ]]
|
||||
then
|
||||
sudo pip3 install .[all]
|
||||
else
|
||||
pip3 install .[all]
|
||||
fi
|
||||
fi
|
||||
|
1
jellyfin_mpv_shim/__init__.py
Normal file
1
jellyfin_mpv_shim/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# There is nothing here.
|
7
regen_pot.sh
Executable file
7
regen_pot.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
pygettext --default-domain=base -o jellyfin_mpv_shim/messages/base.pot jellyfin_mpv_shim/*.py jellyfin_mpv_shim/**/*.py
|
||||
find -iname '*.po' | while read -r file
|
||||
do
|
||||
msgmerge --update "$file" --backup=none --previous jellyfin_mpv_shim/messages/base.pot
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user