From ed5e28e392f12b3a480aab6868e94079784bb115 Mon Sep 17 00:00:00 2001 From: Dhanush Varma Date: Sat, 21 Feb 2026 17:34:56 +0530 Subject: [PATCH 1/2] Fix SQLAlchemy 2.x subquery deprecation warnings in controllers --- mod_ci/controllers.py | 6 +++--- mod_customized/controllers.py | 2 +- mod_sample/controllers.py | 8 ++++---- mod_test/controllers.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mod_ci/controllers.py b/mod_ci/controllers.py index 1414e1b0..7ad64bfb 100755 --- a/mod_ci/controllers.py +++ b/mod_ci/controllers.py @@ -2437,7 +2437,7 @@ def progress_type_request(log, test, test_id, request) -> bool: results = g.db.query(count(TestResultFile.got)).filter( and_( TestResultFile.test_id == test.id, - TestResultFile.regression_test_id.in_(results_zero_rc), + TestResultFile.regression_test_id.in_(results_zero_rc.select()), TestResultFile.got.isnot(None) ) ).scalar() @@ -2513,13 +2513,13 @@ def update_final_status(): finished_tests = g.db.query(TestProgress.test_id).filter( and_( TestProgress.status.in_([TestStatus.canceled, TestStatus.completed]), - TestProgress.test_id.in_(platform_tests) + TestProgress.test_id.in_(platform_tests.select()) ) ).subquery() in_progress_statuses = [TestStatus.preparation, TestStatus.completed, TestStatus.canceled] finished_tests_progress = g.db.query(TestProgress).filter( and_( - TestProgress.test_id.in_(finished_tests), + TestProgress.test_id.in_(finished_tests.select()), TestProgress.status.in_(in_progress_statuses) ) ).subquery() diff --git a/mod_customized/controllers.py b/mod_customized/controllers.py index c90cbc91..255ca23f 100755 --- a/mod_customized/controllers.py +++ b/mod_customized/controllers.py @@ -82,7 +82,7 @@ def index(): g.log.error('GitHub token not configured, cannot fetch commits') populated_categories = g.db.query(regressionTestLinkTable.c.category_id).subquery() - categories = Category.query.filter(Category.id.in_(populated_categories)).order_by(Category.name.asc()).all() + categories = Category.query.filter(Category.id.in_(populated_categories.select())).order_by(Category.name.asc()).all() tests = Test.query.filter(and_(TestFork.user_id == g.user.id, TestFork.test_id == Test.id)).order_by( Test.id.desc()).limit(50).all() diff --git a/mod_sample/controllers.py b/mod_sample/controllers.py index 5d315f5c..80455182 100755 --- a/mod_sample/controllers.py +++ b/mod_sample/controllers.py @@ -69,11 +69,11 @@ def display_sample_info(sample) -> Dict[str, Any]: sq = g.db.query(RegressionTest.id).filter(RegressionTest.sample_id == sample.id).subquery() exit_code = g.db.query(TestResult.exit_code).filter(and_( TestResult.exit_code != TestResult.expected_rc, - and_(TestResult.test_id == test_commit.id, TestResult.regression_test_id.in_(sq)) + and_(TestResult.test_id == test_commit.id, TestResult.regression_test_id.in_(sq.select())) )).first() not_null = g.db.query(TestResultFile.got).filter(and_( TestResultFile.got.isnot(None), - and_(TestResultFile.test_id == test_commit.id, TestResultFile.regression_test_id.in_(sq)) + and_(TestResultFile.test_id == test_commit.id, TestResultFile.regression_test_id.in_(sq.select())) )).first() if exit_code is None and not_null is None: @@ -87,12 +87,12 @@ def display_sample_info(sample) -> Dict[str, Any]: exit_code = g.db.query(TestResult.exit_code).filter( and_( TestResult.exit_code != TestResult.expected_rc, - and_(TestResult.test_id == test_release.id, TestResult.regression_test_id.in_(sq)) + and_(TestResult.test_id == test_release.id, TestResult.regression_test_id.in_(sq.select())) ) ).first() not_null = g.db.query(TestResultFile.got).filter(and_( TestResultFile.got.isnot(None), - and_(TestResultFile.test_id == test_release.id, TestResultFile.regression_test_id.in_(sq)) + and_(TestResultFile.test_id == test_release.id, TestResultFile.regression_test_id.in_(sq.select())) )).first() if exit_code is None and not_null is None: diff --git a/mod_test/controllers.py b/mod_test/controllers.py index 67de3a4d..3d1aac2b 100644 --- a/mod_test/controllers.py +++ b/mod_test/controllers.py @@ -61,7 +61,7 @@ def get_test_results(test) -> List[Dict[str, Any]]: :type test: Test """ populated_categories = g.db.query(regressionTestLinkTable.c.category_id).subquery() - categories = Category.query.filter(Category.id.in_(populated_categories)).order_by(Category.name.asc()).all() + categories = Category.query.filter(Category.id.in_(populated_categories.select())).order_by(Category.name.asc()).all() results = [{ 'category': category, 'tests': [{ From 78d58873bb0520415836f758565d717d9d2c7136 Mon Sep 17 00:00:00 2001 From: Dhanush Varma Date: Sun, 22 Feb 2026 17:02:36 +0530 Subject: [PATCH 2/2] Implement audio track processing in MediaInfoFetcher --- mod_sample/media_info_parser.py | 33 +++++++++++++++++++-- tests/test_sample/test_media_info_parser.py | 12 +++----- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/mod_sample/media_info_parser.py b/mod_sample/media_info_parser.py index 9a44bd39..1cea7fcf 100644 --- a/mod_sample/media_info_parser.py +++ b/mod_sample/media_info_parser.py @@ -64,6 +64,10 @@ def get_media_info(self, force_parse=False) -> Optional[List[Dict[str, Any]]]: 'name': 'Video', 'value': self.video_tracks }) + result.append({ + 'name': 'Audio', + 'value': self.audio_tracks + }) result.append({ 'name': 'Captions', 'value': self.caption_tracks @@ -111,8 +115,7 @@ def _process_track(self, track) -> None: elif track_type == 'Video': self._process_video(track) elif track_type == 'Audio': - # TODO: Implement at some point - pass + self._process_audio(track) elif track_type == 'Text': self._process_text(track) @@ -186,6 +189,32 @@ def _process_video(self, track) -> None: self.video_tracks.append({'name': name, 'value': result}) + def _process_audio(self, track) -> None: + """ + Process audio information from a track. + + :param track: track + :type track: dict + """ + result = self._process_generic(track, ['Format', 'CodecID', 'Duration', 'BitRate', 'Language']) + + if 'Channel_s_' in track: + result['Channels'] = track['Channel_s_'] + + if 'SamplingRate' in track: + rate = round(int(track['SamplingRate']) / 1000, 1) + result['Sampling rate'] = f'{rate} kHz' + + if 'BitRate' in result: + bitrate = round(int(result['BitRate']) / 1000) + result['BitRate'] = f'{bitrate} kbps' + + name = f"Stream nr. {len(self.audio_tracks)}" + if 'ID' in track: + name = f"ID: {track['ID']}" + + self.audio_tracks.append({'name': name, 'value': result}) + def _process_text(self, track) -> None: self.caption_tracks.append({ 'name': f"ID: {track['ID']}", diff --git a/tests/test_sample/test_media_info_parser.py b/tests/test_sample/test_media_info_parser.py index b2c7d06f..ec835e76 100644 --- a/tests/test_sample/test_media_info_parser.py +++ b/tests/test_sample/test_media_info_parser.py @@ -68,7 +68,7 @@ def test_get_media_info(self): result = MediaInfoFetcher.get_media_info(MOCK_MediaInfoFetcher, False) MOCK_MediaInfoFetcher._process_tracks.assert_not_called() - self.assertEqual(len(result), 4) + self.assertEqual(len(result), 5) def test_get_media_info_forced(self): """Test get_media_info with forced parsing.""" @@ -77,7 +77,7 @@ def test_get_media_info_forced(self): result = MediaInfoFetcher.get_media_info(MOCK_MediaInfoFetcher, True) MOCK_MediaInfoFetcher._process_tracks.assert_called_once() - self.assertEqual(len(result), 4) + self.assertEqual(len(result), 5) def test__process_tracks_file_key_error(self): """Test _process_tracks method with key error in self.media_info.""" @@ -143,17 +143,13 @@ def test__process_track_video(self): MOCK_MediaInfoFetcher._process_video.assert_called_once_with(track) def test__process_track_audio(self): - """ - Test _process_track method for audio track. - - This is currently not supported. - """ + """Test _process_track method for audio track.""" MOCK_MediaInfoFetcher.reset_mock() track = OrderedDict([('@type', 'Audio')]) MediaInfoFetcher._process_track(MOCK_MediaInfoFetcher, track) - MOCK_MediaInfoFetcher._process_audio.assert_not_called() + MOCK_MediaInfoFetcher._process_audio.assert_called_once_with(track) def test__process_track_text(self): """Test _process_track method for text track."""