Skip to content
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

Support iterators #94

Open
rgaudin opened this issue Jan 21, 2021 · 15 comments
Open

Support iterators #94

rgaudin opened this issue Jan 21, 2021 · 15 comments
Labels
enhancement New feature or request
Milestone

Comments

@rgaudin
Copy link
Member

rgaudin commented Jan 21, 2021

Archive needs support for a few iterators:

  • Archive.iterByPath()
  • Archive.iterByTitle()
  • Archive.iterEfficient() (arguable)
  • Archive.findByPath(path)
  • Archive.findByTitle(title)
@rgaudin rgaudin added the enhancement New feature or request label Jan 21, 2021
@rgaudin
Copy link
Member Author

rgaudin commented Jan 21, 2021

Awaiting this to remove Archive.get_entry_by_id(), Entry.index and Item.index as it's the only way to loop over the zim content at the moment and we use it in tests.

@mgautierfr
Copy link
Collaborator

It would be nice to have a "default" iterator (iterEfficient?) on Archive itself.

This way we could iterate over archive with :

archive = Archive("foo.zim")
for entry in archive:
    print(entry.title)

@rgaudin
Copy link
Member Author

rgaudin commented Jan 21, 2021

absolutely 👍

@rgaudin rgaudin added this to the 1.0 milestone Jan 26, 2021
@rgaudin rgaudin pinned this issue Jan 26, 2021
@kelson42 kelson42 removed this from the 1.0 milestone Feb 3, 2021
@kelson42 kelson42 added this to the 1.1.0 milestone Aug 12, 2021
@stale
Copy link

stale bot commented Dec 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

1 similar comment
@stale
Copy link

stale bot commented Mar 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

@stale stale bot added the stale label Mar 2, 2022
@kelson42 kelson42 modified the milestones: 1.2.0, 1.3.0 May 7, 2022
@stale stale bot removed the stale label May 7, 2022
@stale
Copy link

stale bot commented Jul 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

@stale stale bot added the stale label Jul 10, 2022
@kelson42 kelson42 modified the milestones: 2.1.0, 2.2.0 Sep 28, 2022
@stale stale bot removed stale labels Sep 28, 2022
@kelson42 kelson42 modified the milestones: 2.2.0, 3.1.0 Apr 6, 2023
@kelson42 kelson42 modified the milestones: 3.1.0, 3.2.0 Apr 27, 2023
@dentropy
Copy link

Turns out zim-tools can list all the articles you need

ZIM Articles List

@kelson42 kelson42 assigned rgaudin and unassigned mgautierfr Nov 1, 2023
@rgaudin rgaudin assigned mgautierfr and unassigned rgaudin Nov 1, 2023
@kelson42
Copy link
Contributor

kelson42 commented Nov 4, 2023

This feature is not directly of interest for us but is a MUST for people using python-libzim to ready/inspect ZIM files. How much effort would be needed to implement it?

@rgaudin
Copy link
Member Author

rgaudin commented Nov 4, 2023

It is of interest to us. We're using the workaround. I can't do it on my own in a reasonable time but I think it would be easy for @mgautierfr

@kelson42
Copy link
Contributor

kelson42 commented Nov 5, 2023

@mgautierfr How much work woukd be needed to get this feature implemented?

@mgautierfr
Copy link
Collaborator

Should be pretty straightforward. Few hours, a day at most.

@kelson42 kelson42 modified the milestones: 3.2.0, 3.4.0 Nov 7, 2023
@traverseda
Copy link

It is of interest to us. We're using the workaround. I can't do it on my own in a reasonable time but I think it would be easy for @mgautierfr

What's the work around?

@SrGnis
Copy link

SrGnis commented Nov 26, 2023

It is of interest to us. We're using the workaround. I can't do it on my own in a reasonable time but I think it would be easy for @mgautierfr

What's the work around?

I suppose is referring to this

@traverseda
Copy link

traverseda commented Nov 26, 2023

Thanks for the very quick response! Here's what that looks like in practice, in case this feature isn't added soon.

  zim = Archive(os.path.expanduser("~/test.zim"))                                                                                       
                                                                                                                                                                 
  for i in range(0,zim.all_entry_count):                                                                                                                         
      entry = zim._get_entry_by_id(i)                                                                                                                            
      print(entry)                                                                                                                                                                 
  

@kelson42
Copy link
Contributor

We will implement it soon

@kelson42 kelson42 modified the milestones: 3.4.0, 3.5.0 Dec 3, 2023
@kelson42 kelson42 modified the milestones: 3.5.0, 3.6.0 Aug 29, 2024
@rgaudin rgaudin modified the milestones: 3.6.0, 3.7.0 Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants