Beispiel #1
0
def folder_for_app(results_dir : str, app : Bundle) -> str:
    """Return the output directory for a certain application
    inside the user-specified results directory.

    Note that this function _does not_ touch the filesystem.
    Therefore, no directories are created as part of this functionality"""
    app_bundle_id = app.bundle_identifier()
    if app_bundle_id is '' or app_bundle_id is None:
        app_bundle_id = 'b.UNKNOWN'

    app_version = app.version()
    if app_version is '' or app_version is None:
        app_version = 'v.UNKNOWN'

    return os.path.join(results_dir, app_bundle_id, app_version)
Beispiel #2
0
    def extract_data(self, app: Bundle, result_path: str) -> bool:
        app_bundle_id = app.bundle_identifier()
        if not app.is_mas_app():
            self.log_info(
                'Application {} is not from the Mac App Store. Will not query iTunes for metadata.'
                .format(app_bundle_id))
            return True

        metadata = itunes_api.lookup_metadata(bundleId=app_bundle_id)
        if not metadata:
            self.log_info('Metadata could not be extracted for {}'.format(
                app.filepath))
            return True

        outpath = os.path.join(result_path, 'itunes_metadata.json')
        with open(outpath, "w") as outfile:
            json.dump(metadata, outfile, indent=4)

        return True