I was going to take a crack at the id3v2 tags but it already
frustrated me. I don't have any use for them so I can't get motivated
to do much more. These notes may get someone else motivated to
following through and tweaking to their needs.
The song title is supposed to be after the TIT2 tag, but there are
often a bunch of gibberish hex characters after TIT2 so you can't grab
the first thing after TIT2. I tried several approaches, and settled on
the least elegant:
grep -A 20 TIT2 "$(lsof -p $(pidof mediaserver) | grep -m 1 mp3 | awk
'{print substr($0, index($0,$9))}')" | grep -m 1 [a-z]
It takes 20 lines after TIT2 (half is gibberish) then greps the first
line with a lowercase letter. This actually works pretty well because
there is only gibberish between TIT2 and the title, but it assumes the
tag contains a lower case letter. Personally, I wouldn't want to see
any titles that are in all caps anyway.
The title is often followed by other tags like TYER, TALB, and TRCK.
Someone could make a list of tags and just use sed to get rid of them
all. Also, this makes grep search the whole file for "TIT2" and it
takes a couple seconds to execute. It's faster to use "head -c 2000"
then pipe to grep.
If it isn't a v2 tag, there will be no output, so you could use tail
to get the other style of tag.
> now the issue is to make it useful... I suppose I could pipe it into
> minimalistic text, but the issue would be to do it on track change...
> and even so, minText only updates like every 2 minutes...
What got me started on this idea was that I listen to a lot of
podcasts. I have a tasker shortcut to toggle the Beyondpod podcast app
between pause and play and change the icon accordingly. Sometimes I
pause the playback then start it later, but I don't remember what I
was listening to or whether I want to continue or start something
else.
I added a minimalistic text widget that is normally blank, but when I
tap pause (and when the headphones are removed), it gets the file name
and puts it in a MT variable and displays it. That way, when I turn
the phone on later, the podcast title is displayed on the homescreen
so I know what's going to come on when I hit play. Tapping play also
blanks out the MT widget because I don't need the filename when I'm
listening to it.