Beispiel #1
0
    def read_mythem_series_js_from_fcode(self, fcode):
        """
		Given an Fcode this method find the corresponding id-series
		:param fcode:
		:return:
		"""
        s3_bucket = self.data_conf['s3_bucket']
        s3_fcode_serie_map = self.data_conf['fcode_serie_mapping_path']
        self._logger.info(f'Searching {fcode} in MYTHEMATICS series from '
                          f'{s3_bucket}/{s3_fcode_serie_map}')
        try:
            fcode_serie_map = json.loads(
                S3Utils.read_s3_file(self.s3, s3_bucket, s3_fcode_serie_map))
            idserie = fcode_serie_map['idserie'].get(fcode)
        except FileNotFoundError:
            self._logger.info(
                f'MYTHEMATICS {fcode} series NOT found: file {s3_bucket}/{s3_fcode_serie_map} not found'
            )
            return None

        if idserie is not None:
            self._logger.info(f'IdSerie {idserie}-{fcode} match found')
            mythem_js = self.read_mythem_series_js(idserie)
            self._logger.info(f'MYTHEMATICS {fcode} series Found!')
            return mythem_js
        else:
            self._logger.info(f'MYTHEMATICS {fcode} series NOT found!')
            return None
Beispiel #2
0
    def f_to_fdcode(self, fcode):
        s3_bucket = self.data_conf['s3_bucket']
        s3_ffd_mapping = self.data_conf['s3_ffd_mapping']

        fd_mapping = json.loads(
            S3Utils.read_s3_file(self.s3, s3_bucket, s3_ffd_mapping))
        return fd_mapping['video_content_ids'].get(fcode, None)
Beispiel #3
0
    def fd_to_fcode(self, fd_code):
        """

		:param fd_code: fd code
		:return: fcode
		"""
        s3_bucket = self.data_conf['s3_bucket']
        s3_fdf_mapping = self.data_conf['s3_fdf_mapping']
        fd_mapping = json.loads(
            S3Utils.read_s3_file(self.s3, s3_bucket, s3_fdf_mapping))
        return fd_mapping['fcode'].get(fd_code, None)
Beispiel #4
0
    def read_mythem_season_js(self, season_id):
        mythem_key_file = f"{self.data_conf['s3_mythematics_season_fingerprint']}/{season_id}.json"
        s3_bucket = self.data_conf['s3_bucket']

        try:
            self._logger.info(
                f"Searching season {season_id} in MYTHEMATICS from {s3_bucket}/{mythem_key_file}"
                "")
            mythem_js = json.loads(
                S3Utils.read_s3_file(self.s3, s3_bucket, mythem_key_file))
            self._logger.info(f'MYTHEMATICS SEASON {season_id} found!')
            return mythem_js
        except FileNotFoundError:
            self._logger.info(f'MYTHEMATICS SEASON {season_id} NOT found!')
            return None
Beispiel #5
0
    def read_mcm_content_series(self, content_id):
        mcm_key_file = f"{self.data_conf['s3_mcm_series']}/{content_id}.json"
        s3_bucket = self.data_conf['s3_bucket']

        try:
            self._logger.info(
                f"Searching {content_id} in MCM from {s3_bucket}/{mcm_key_file}"
                "")
            mcm_js = json.loads(
                S3Utils.read_s3_file(self.s3, s3_bucket, mcm_key_file))
            self._logger.info(f'MCM series {content_id} found!')
            return mcm_js
        except FileNotFoundError:
            self._logger.info(f'MCM series {content_id} NOT found!')
            return None
Beispiel #6
0
    def read_mythem_js(self, content_id):
        """
		Given an fcode return the dictionary (json) of the corresponding Mythematics len-10-Fcode content
		:param content_id:
		:return:
		"""

        mythem_key_file = f"{self.data_conf['s3_mythematics_fingerprint']}/{content_id}.json"
        s3_bucket = self.data_conf['s3_bucket']
        try:
            self._logger.info(
                f"Searching {content_id} in MYTHEMATICS from {s3_bucket}/{mythem_key_file}"
                "")
            mythem_js = json.loads(
                S3Utils.read_s3_file(self.s3, s3_bucket, mythem_key_file))
            self._logger.info(f'MYTHEMATICS {content_id} found!')
            return mythem_js
        except FileNotFoundError:
            self._logger.info(f'MYTHEMATICS {content_id} NOT found!')
            return None