-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Counting slides #607
Comments
This message was generated by git-bob (version: 0.17.0, model: github_models:gpt-4o, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully. To address the issue of counting slides, here's how it can be done in Python: import yaml
import requests
from pptx import Presentation
def count_slides_in_zenodo_records(yml_file_path):
with open(yml_file_path, "r") as yml_file:
data = yaml.safe_load(yml_file)
total_slides = 0
for url in data.get("urls", []):
if "https://zenodo.org" in url:
record_id = url.split("/")[-1]
api_url = f"https://zenodo.org/api/records/{record_id}"
response = requests.get(api_url)
response_data = response.json()
for file in response_data.get("files", []):
if file["key"].endswith(".pptx"):
file_response = requests.get(file["links"]["download"])
with open("temp.pptx", "wb") as temp_file:
temp_file.write(file_response.content)
presentation = Presentation("temp.pptx")
total_slides += len(presentation.slides)
return total_slides
# Example usage:
# total = count_slides_in_zenodo_records("example.yml")
# print(f"Total slides: {total}") This implementation parses the |
Ok, git-bob try exactly this code using |
This message was generated by git-bob (version: 0.17.0, model: github_models:gpt-4o, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully. The changes address the implementation of slide counting in Zenodo records as described in issue #607. A YAML file ( resources/nfdi4bioimage.yml YAML file containing example URL data as input for the slide counting script. During solving this task, the following errors occurred:
|
solved in 270f149 |
Assume, we have a yml-file containing a list of urls. If the url contains "https://zenodo.org", we could use the zenodo API to access all files in the zenodo record. If these files end with "pptx", we could download the file, count the number of slides in the file and sum the numbers up to get the total count of slides in all pptx files in all zenodo records listed in our yml file.
git-bob comment on how to do this with python.
The text was updated successfully, but these errors were encountered: