Set line number of radio station programmatically

I want to set the line number of the radio station in the playlist.m3u to be played programmatically. Is there a possibility to get the actual line number? I plan to maintain a global variable holding that number and to change ist via a rotary encoder working on two free GPIO pins and to show the station on a LCD display. Is there any experience in that?