tdarr: handle version numbers with leading zeros (e.g. 2.21.01) (#2604)

Using compiled regex to strip leading zeros in front of other digits
This commit is contained in:
Ryan S
2024-06-25 05:49:10 -05:00
committed by GitHub
parent fd14bc6c27
commit 51571329e1
2 changed files with 3 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ description: Tdarr is a Distributed Transcoding System
annotations:
title: Tdarr
type: application
version: 1.2.4
version: 1.2.5
apiVersion: v2
appVersion: 2.17.01
kubeVersion: '>=1.16.0-0'

View File

@@ -8,12 +8,13 @@ from catalog_update.upgrade_strategy import semantic_versioning
# Drop _ffmpeg5 after Cobia is released for a while
RE_STABLE_VERSION = re.compile(r'[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(_ffmpeg5)?')
RE_CLEAN_VERSION = re.compile(r'0+([1-9])')
STRIP_TEXT = '_ffmpeg5'
def newer_mapping(image_tags):
key = list(image_tags.keys())[0]
tags = {t.strip(STRIP_TEXT): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
tags = {RE_CLEAN_VERSION.sub("\\1", t.strip(STRIP_TEXT)): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
version = semantic_versioning(list(tags))
if not version:
return {}