From a9db5639901c86553b28613a0a56b1ff58dafbe8 Mon Sep 17 00:00:00 2001 From: tcely Date: Sat, 22 Feb 2025 11:50:48 -0500 Subject: [PATCH 1/2] Be more consistent with `fmt` This was the cause of many rename operations. --- tubesync/sync/models.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index f3c051fa..6e8700ed 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -883,14 +883,19 @@ class Media(models.Model): resolution = self.downloaded_format.lower() elif self.downloaded_height: resolution = f'{self.downloaded_height}p' + if resolution: + fmt.append(resolution) if self.downloaded_format != Val(SourceResolution.AUDIO): vcodec = self.downloaded_video_codec.lower() + if vcodec: fmt.append(vcodec) acodec = self.downloaded_audio_codec.lower() - fmt.append(acodec) + if acodec: + fmt.append(acodec) if self.downloaded_format != Val(SourceResolution.AUDIO): fps = str(self.downloaded_fps) - fmt.append(f'{fps}fps') + if fps: + fmt.append(f'{fps}fps') if self.downloaded_hdr: hdr = 'hdr' fmt.append(hdr) @@ -922,13 +927,19 @@ class Media(models.Model): # Combined vformat = cformat if vformat: - resolution = vformat['format'].lower() - fmt.append(resolution) + if vformat['format']: + resolution = vformat['format'].lower() + else: + resolution = f'{vformat['height']}p' + if resolution: + fmt.append(resolution) vcodec = vformat['vcodec'].lower() - fmt.append(vcodec) + if vcodec: + fmt.append(vcodec) if aformat: acodec = aformat['acodec'].lower() - fmt.append(acodec) + if acodec: + fmt.append(acodec) if vformat: if vformat['is_60fps']: fps = '60fps' From b3a21f2e27157c31a224117b8027f3695c143424 Mon Sep 17 00:00:00 2001 From: tcely Date: Sat, 22 Feb 2025 11:55:14 -0500 Subject: [PATCH 2/2] fixup: quoting --- tubesync/sync/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index 6e8700ed..b2a43e53 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -930,7 +930,7 @@ class Media(models.Model): if vformat['format']: resolution = vformat['format'].lower() else: - resolution = f'{vformat['height']}p' + resolution = f"{vformat['height']}p" if resolution: fmt.append(resolution) vcodec = vformat['vcodec'].lower()