Hi all,
I mentioned before that I'm contemplating writing a program to produce
playlists consisting of the top 20 songs from week after week,
hopefully eventually spanning several years.
In English, the algorithm is that songs appear in order of the week
they first achieved their highest position on the chart, and within
that bunch, sort in reverse order of the chart position. As I mentioned
before, Python dicts (or Perl hashes or Lua tables or Ruby whatevers)
are perfect for solving that exact problem.
Doing this involves two challenges:
1) Writing the program
2) Data entry of all the songs
The program's a no-brainer, but the data entry can be a pain in the
petunias, mainly because it's really hard to enter the same song
title__author identically for every week. Well, I just thought of an
automated way to do it, and my way doesn't reinvent the wheel, but
instead uses my favorite tool, dmenu from Suckless Tools...
I envision making a very simple GUI program that rerun for each week,
and I run it maximized. At the screen's bottom it lists the date
(yyyymmdd) and the chart position to be recorded next, and maybe even
lists a screen-scraped top 20 of the current week.
As I said, this program is run for each week's top 20. Before running
the program, I manually screen-scrape the current week's top 20 and put
them into a temp file that is displayed in the program. Then I run the
program. First off, the program sorts the prior 5 weeks of already
recorded song titles__authors and puts the result in a temp file.
Then, for 1 to 20, it queries me for the song at that chart position,
and it makes that query by calling dmenu on the temp file of the last
five weeks. For most of the songs in the top 20, any song title I need
to record will have been recorded in earlier weeks, so I simply
*select* it via dmenu. But for the few that have freshly appeared in
the top 20, dmenu acts not only as a selector, but it can also act as
an input field in which I can input a brand new title__author. By doing
it this way, I won't get different titles for a single song, and in the
majority of cases I won't need to type out the entire title of a song.
My program is slightly complicated by having to handle cases where I
Escape out of dmenu, in which case it shouldn't increment the chart
position, but instead should just ask for the same chart position again.
I'll also need a couple quality control programs. One sorts unique the
current and prior 4 charts into a temp file and displays them with
dmenu so I can quickly see any similar but not identical title__author
combos and correct the situation. I might even make an algorithm to
point out similar but not identical title__authors.
The second quality control program I'll need is a sort of multi-file
version of sed that can search for an aberrant title__author and convert
it to the correct title__author in files for several current and prior
weeks.
All of this sounds very doable to me. Thank goodness for dmenu from
Suckless Tools!
SteveT
Steve Litt
Spring 2020 featured book: Thriving in Tough Times
http://www.troubleshooters.com/thrive