Here it was answered how to implement a progress bar for a beamer presentation. In particular, I liked the first solution. However it has one shortcoming, namely that the progress bar is valid for the entire presentation, so the main part of the code defining the size of the bar is
Now, imagine I have slides with several sections and subsections, where each subsection has several/many slides (the entire document is more than 100 pages). So I would like to have a progress bar that shows progress in the current section (or even subsection). Actually, many of the default themes have this functionality (as noted here) but not in the form of a progress bar.
I could easily adapt the code in the first solution, but for this I need to find commands that would give the number of frames and the number of the first frame in the current section, if they exist.