Allow script to download beta version / only download stable versions if --beta parameter is not supplied
This commit is contained in:
1 parent
c8605b904f
commit
7a2066074b
2 files changed
+13
-16
No files matched your search
+7
-6
@@ -1,10 +1,10 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from build_metainfo import *
|
|
||||||
from resolve_download import *
|
from resolve_download import *
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
is_studio = '--studio' in sys.argv
|
is_studio = '--studio' in sys.argv
|
||||||
|
is_beta = '--beta' in sys.argv
|
||||||
app_tag = "davinci-resolve-studio" if is_studio else "davinci-resolve"
|
app_tag = "davinci-resolve-studio" if is_studio else "davinci-resolve"
|
||||||
|
|
||||||
print("Building for tag " + app_tag)
|
print("Building for tag " + app_tag)
|
||||||
@@ -13,12 +13,13 @@ if __name__ == "__main__":
|
|||||||
(version, release_id, download_id) = get_latest_version_information(
|
(version, release_id, download_id) = get_latest_version_information(
|
||||||
refer_id='77ef91f67a9e411bbbe299e595b4cfcc',
|
refer_id='77ef91f67a9e411bbbe299e595b4cfcc',
|
||||||
app_tag=app_tag,
|
app_tag=app_tag,
|
||||||
|
stable=is_beta is False,
|
||||||
)
|
)
|
||||||
print(f"Download latest version of Davinchi Resolve{' Studio' if is_studio else ''}...")
|
print(f"Download latest version of Davinchi Resolve{' Studio' if is_studio else ''}...")
|
||||||
download_using_id(download_id)
|
download_using_id(download_id)
|
||||||
print(f"Building meta info...")
|
print(f"Building meta info...")
|
||||||
build_metainfo(
|
# build_metainfo(
|
||||||
app_id='com.blackmagic.ResolveStudio' if is_studio else 'com.blackmagic.Resolve',
|
# app_id='com.blackmagic.ResolveStudio' if is_studio else 'com.blackmagic.Resolve',
|
||||||
app_description="DaVinci Resolve Studio" if is_studio else 'DaVinchi Resolve',
|
# app_description="DaVinci Resolve Studio" if is_studio else 'DaVinchi Resolve',
|
||||||
app_tag=app_tag,
|
# app_tag=app_tag,
|
||||||
)
|
# )
|
||||||
@@ -26,20 +26,16 @@ headers = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_latest_version_information(app_tag: str, refer_id: str = '77ef91f67a9e411bbbe299e595b4cfcc'):
|
def get_latest_version_information(app_tag: str, refer_id: str = '77ef91f67a9e411bbbe299e595b4cfcc', stable=True):
|
||||||
data = {
|
response: requests.Response = requests.get(
|
||||||
"product": app_tag,
|
f"https://www.blackmagicdesign.com/api/support/latest-stable-version/{app_tag}/linux"
|
||||||
"platform": "linux"
|
if stable else
|
||||||
}
|
f"https://www.blackmagicdesign.com/api/support/latest-version/{app_tag}/linux",
|
||||||
|
|
||||||
response: requests.Response = requests.post(
|
|
||||||
"https://www.blackmagicdesign.com/api/support/latest-version",
|
|
||||||
cookies=cookies,
|
cookies=cookies,
|
||||||
headers={
|
headers={
|
||||||
**headers,
|
**headers,
|
||||||
'Referer': 'https://www.blackmagicdesign.com/support/download/' + refer_id + '/Linux',
|
'Referer': 'https://www.blackmagicdesign.com/support/download/' + refer_id + '/Linux',
|
||||||
},
|
},
|
||||||
data=json.dumps(data),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
parsed_response = json.loads(response.content.decode('utf-8'))
|
parsed_response = json.loads(response.content.decode('utf-8'))
|
||||||
@@ -49,7 +45,7 @@ def get_latest_version_information(app_tag: str, refer_id: str = '77ef91f67a9e41
|
|||||||
minor=parsed_response["linux"]["minor"],
|
minor=parsed_response["linux"]["minor"],
|
||||||
patch=parsed_response["linux"]["releaseNum"],
|
patch=parsed_response["linux"]["releaseNum"],
|
||||||
build=parsed_response["linux"]["build"],
|
build=parsed_response["linux"]["build"],
|
||||||
beta=-1 if parsed_response["linux"]["beta"] is None else parsed_response["linux"]["beta"]
|
beta=parsed_response["linux"]["beta"] if "beta" in parsed_response["linux"] else -1
|
||||||
), parsed_response["linux"]["releaseId"], parsed_response["linux"]["downloadId"])
|
), parsed_response["linux"]["releaseId"], parsed_response["linux"]["downloadId"])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user