waydroid_script/stuffs/widevine.py

38 lines
1.8 KiB
Python
Raw Normal View History

import os
2023-02-04 07:30:24 -08:00
import re
import shutil
from stuffs.general import General
2023-02-04 07:30:24 -08:00
from tools.helper import host, run
from tools.logger import Logger
class Widevine(General):
partition = "vendor"
2023-02-04 07:30:24 -08:00
dl_links = {
"x86": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/94c9ee172e3d78fecc81863f50a59e3646f7a2bd.zip", "a31f325453c5d239c21ecab8cfdbd878"],
"x86_64": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/94c9ee172e3d78fecc81863f50a59e3646f7a2bd.zip", "a31f325453c5d239c21ecab8cfdbd878"],
"armeabi-v7a": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a1a19361d36311bee042da8cf4ced798d2c76d98.zip", "fed6898b5cfd2a908cb134df97802554"],
"arm64-v8a": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a1a19361d36311bee042da8cf4ced798d2c76d98.zip", "fed6898b5cfd2a908cb134df97802554"]
}
machine = host()
dl_link = dl_links[machine[0]][0]
act_md5 = dl_links[machine[0]][1]
dl_file_name = "widevine.zip"
extract_to = "/tmp/widevineunpack"
2023-01-26 07:23:50 -08:00
files = [
2023-02-04 07:30:24 -08:00
"bin/hw/*widevine",
2023-01-26 07:23:50 -08:00
"bin/move_widevine_data.sh",
2023-02-04 07:30:24 -08:00
"etc/init/*widevine.rc",
"etc/vintf/manifest/*widevine.xml",
2023-01-26 07:23:50 -08:00
"lib/libwvhidl.so",
"lib/mediadrm",
"lib64/mediadrm"
]
def copy(self):
run(["chmod", "+x", self.extract_to, "-R"])
2023-02-04 07:30:24 -08:00
name = re.findall("([a-zA-Z0-9]+)\.zip", self.dl_link)[0]
Logger.info("Copying widevine library files ...")
2023-02-04 07:30:24 -08:00
shutil.copytree(os.path.join(self.extract_to, "vendor_google_proprietary_widevine-prebuilt-"+name,
2023-01-21 10:50:03 -08:00
"prebuilts"), os.path.join(self.copy_dir, self.partition), dirs_exist_ok=True)