#100DaysToOffload

Code Project: Fresh RSS to WordPress Digest

I actually briefly mentioned this project when I write about moving from TinyTinyRSS to FreshRSS. This has become a bit of an evolving and ongoing project however, so I’ve decided to catalogue it in it’s own page. This little script worked out much better than I expected, and I’ve modified it a bit over time, and have ideas to modify it going forward even more. Starting off, the code can be found here in this Github GIST.

I’ve left a bit of commented out code that i might use later for troubleshooting or adding additional features. The general gist of the code, it pulls the last 24 hours worth of news stories I have favorited from my FreshRSS install, then formats them into a digest format and posts it here, in this blog. They get sorted into their own category, you can find them here.

This is basically a thing I’ve seen others do that I’ve wanted to do for a while. It’s also partially just for my reference more than anything, it’s sort of a log of everything I have found interesting on a particular day more than anything. Others may or may not find it interest, which is why I also filter that category out of the home page feed.

Originally, it was just a list of URLs and titles. I realized that it might be useful to have SOME idea what the link was about before clicking it, so I have been playing with the summary as well. My first attempt was a bit dodgy because it actually posted the entire article as the summary. Currently, it just arbitrarily chops it off at a few hundred characters. I want to improve it even farther at some point by pushing it through some summarizing AI and getting an actual proper summary but I have not gotten there yet.

There re a few other things I want to add but I’m not sure they re easily possible. Firstly, I would love to be able to parse some sort of categories into the digest. So say, all the “Video Game” links are together and Music links are together. FreshRSS has categories but they don’t seem to show up in the feed anywhere.

This would also allow me to split these posts between this blog and my other blog, Lameazoid. I do share interesting video games news from FreshRSS, but I mostly don’t share Toy related articles, because it feels a little TOO FAR out there for what I want to post to this blog. If there were a way to have the categories, I could easily have the script split the feed by categories and post a digest to each blog.

I also wish there was a way to add my own notes and commentary occasionally. I don’t think it showed up in the feed either, but TinyTinyRSS had a notes feature. I am not sure if FreshRSS has that as well. I probably should try to at least suggest these features to the creators on GitHub, or maybe get really adventurous and create my own plug-ins for FreshRSS to accomplish these tasks.

Code Project: VLC Portable Playlist to Text Dump

It’s kind of funny how one post can lead to another sometimes.  This one is pretty basic but it also just shows a bit how useful I find knowing my way around computer systems to be.  Yesterday I posted about my little annual music playlists.  And as part of that, I wanted to actually post the playlist. I am pretty sure there is a fairly universal “playlist file type” out there and being open source, I had assumed that VLC on my phone stored the playlists somewhere in playlist files.

That assumption was wrong, it uses a .db file.  A little portable database.  There is an option to dump this file to the root of the phone, presumably for backup purposes, but it’s also useful to just browse it like I am doing here.  The file itself can be opened and browsed with SQL Lite’s DB manager.  It’s standard databases inside for tracks and artists and playlists.

Fortunately, I have had some experience dealing with database queries, so I set about building what was needed tog et the data I wanted.  Pull the Playlist I want, in this case “2023 Best” but I could change that to do any available Playlist.  This gives the tracks by id, but the tracks themselves are stored in a separate table for media.  So that needs joined in.  The media table stores track names, but not artist names, so an additional join is needed to get the artist names.  This complicated things a bit because both the playlist table and artist table have a column “name” so more clarity needed to be added.

The result was this little query that dumps out a basic table of Artist and Song title.

SELECT Artist.name, Media.title 
FROM Playlist
Inner Join playlistmediarelation ON playlist_id=id_playlist
Inner Join Media ON id_media=media_id
Inner Join Artist ON media.artist_id=Artist.id_artist
WHERE Playlist.name = '2023 Best'
ORDER BY Artist.name

Now, I could have done some cute clever trick now to merge the two into a new column and add in a ” – ” between but it was easier to drop it all into a notepad file and do a fine/replace on the weird space character that it stick in between the Artist and track title.

The added bonus here is I can easily use this query again anytime I want to dump a Playlist to text.

The Annual Playlist for 2023

A few years ago, I was sorting through some older music, and came across old Mix Tapes and CD-Rs.  It’s really fun because unlike digital music, these are essentially static playlists.  This is a window into what I was listening to at that time.  And no, you didn’t misread that, Mix Tapes.  and they were mostly from the 90s era.  My first car didn’t have a CD player, it just had a cassette deck.  Teenage me would regularly visit the local library and check out a variety of CDs, then spend the week picking out my favorite tracks and recording them to tapes.  I also recorded some from the radio.  I had a stereo with a dual cassette deck so I could easily copy some back and forth among my tapes.

Here is a fun blast from the past for ya. I had a thing for a while where I would make little custom art for my tapes too, most of them had Gunsmith Cats artwork but I also did some for Dance Dance Revolution as well.

Something really amusing I noticed here is that “Car Tape 3” includes 2 Alanis Morrisette songs, both of which are on my 2023 playlist (below).

Digital playlists aren’t quite as robust.  They are honestly kind of a pain to deal with over time, because the files can move around and then the playlists essentially just break.  But I did try to sort of replicate the experience of an annual playlist after the nostalgia trip of these tapes and CDs.  Basically, usually sometimes in January, I make a new playlist for the year, simply named, for example, “2023 Playlist.”  For the first few I would star with the previous year and seriously trim it down.  More recently I just start from scratch.  The idea is, it can evolve over the year though.  Essentially, i start with a “best of” from previous years, music I want to listen to “now” in January, then over the course of the year, I might remove some songs, and I might add some songs.  

The bigger point is, I have the old lists, if I wanted to go back and listen to things, though, that would also still have the digital music problem of, “The music was moved/removed and the list is broken.”  

But at least I do still have the list.      

More recently though I have been thinking of sticking these in a more meaningful file for future nostalgia (Ironically, a song that I debated adding to this year’s list but decided not to in favor of other Dua Lipa tracks).  Probably some sort of simple Excel file or something, then I can eventually manipulate the listings in 5 year when I decided to do some sort of retrospective blog post and list out “This song was on 8 out of 12 Playlists!” sort of nonsense.

For now, I wanted to just, post the list, for the start of this year.  I’ll alphabetize it by artist, but the order doesn’t matter, these are always just played on shuffle.

Alanis Morissette - All I Really Want
Alanis Morissette - Ironic
Alice Merton - No Roots
Alice Merton - 2 Kids
Alice Merton - Funny Business
Alice Merton - Easy
Alice Merton - Lash Out
Aurora - The Woman I Am (Vevo Live)
Aurora - Giving In To The Love
Aurora - Cure For Me
Aurora - A Temporary High
Aurora - Blood In The Wine
Aurora - Animal
Aurora - Hunger
Aurora - The Seed
Aurora - I Went Too Far
Aurora - Murder Song (5, 4, 3, 2, 1)
Aurora - Gentle Earthquakes
Aurora - All Is Soft Inside
Aurora - Churchyard
Avril Lavigne - Here's To Never Growing Up
Avril Lavigne - Things I'll Never Say
Bt - Never Gonna Come Back Down
Bt - Movement in Still Life
Bt - Satellite
Bt - Smartbomb
CHVRCHES - The Killing Moon (Amazon Original)
CHVRCHES - The Mother We Share
CHVRCHES - Gun
CHVRCHES - Recover
CHVRCHES - Killer
CHVRCHES - Screaming
CHVRCHES - Bitter End
CHVRCHES - Violent Delights
CHVRCHES - Good Girls Explicit
CHVRCHES - Death Stranding
CHVRCHES - Never Ending Circles
CHVRCHES - Clearest Blue
CHVRCHES - Graffiti
CHVRCHES - Forever
CHVRCHES - Graves
dodie - Monster (Vevo Live)
dodie - Hate Myself
dodie - Cool Girl
dodie - Monster
Dua Lipa - Physical
Dua Lipa - Good In Bed Explicit
Dua Lipa - Cool
Fred V & Grafix ft. Ruth Royall - Sunrise (Season Mix)
Griff ft Sigrid - Head on Fire
Juno Reactor - Guardian Angel
Juno Reactor - Samurai
Katy Perry - Electric
Kim Petras - Icey (Vevo Live)
King Princess - PAIN
M83 - Midnight City
Magdalena Bay - Killshot
Magdalena Bay - Mercurial World
Metallica - Enter Sandman
Metallica - The Unforgiven
Neil Frances - On the Lookout (feat. Raffaella)
Nigel Stanford - Automatica
Nirvana - Smells Like Teen Spirit
Nirvana - Come as You Are
Nirvana - On a Plain
Orla Gartland - Things That I've Learned
Orla Gartland - You're Not Special, Babe [Explicit]
Orla Gartland - Pretending [Explicit]
Orla Gartland - Flatline
Paramore - Misery Business
Radiohead - Everything In Its Right Place
Raffaella - Grown Up (Vevo Live)
Raffaella - Blonde (Vevo Live)
Raffaella - Hell Yeah
Raffaella - Sororicide
Raffaella - Bardot
Raffaella - BUICK
Sigrid - A Driver Saved My Night (Vevo Live)
Sigrid - It Gets Dark (VevoLive)
Sigrid - Deep
Sigrid - Dip My Heart in Confetti
Sigrid - Dancer
Sigrid - Mistake Like You
Sigrid - A Driver Saved My Night
Sofi Tukker - Hey Lion
Sofi Tukker - Awoo (feat. Betta Lemme)
Taylor Swift - Getaway Car
Taylor Swift - This Is Why We Can’t Have Nice Things
Taylor Swift - New Romantics
Taylor Swift - Fearless (Taylor’s Version)
Taylor Swift - Love Story (Taylor’s Version)
Taylor Swift - You Need to Calm Down
Taylor Swift - Lavender Haze
Taylor Swift - Anti‐Hero
Taylor Swift - Vigilante Shit
Taylor Swift - Mastermind
Tessa Violet - Bad Ideas
Tessa Violet - Games
The Cranberries - Dreams
The Cranberries - Zombie
Wolf Alice - Smile

SQL Woes

For the most part, managing my web server is pretty straightforward, especially because I don’t really get a ton of traffic. Its mostly just keeping things up to date through standard channels.

Occasionally I have a bit of a brain fart moment. I recently was doing regular Linux updates on the server. I noticed a message I had seen before about some packages being held back. Occasionally I will go through and update these, because I am not real sure why they are being held back, but don’t really see any reason they should be.

Then MySQL broke.

So I went digging in some logs and searching for solutions, and decided I needed to roll back the version. Following a guide I found, I discovered… I had done this before, which I now vaguely remebered. Because the old .deb file was still there from last time I broke it.

Anyway, this didn’t fix it, MySQL still was not launching.

I decided that maybe it was time to just switch to MariaDB, which I believe is the spiritual successor to MySQL. And the process was simple enough, I would not even need to dump my Databases. So I uninstalled MySQL, installed MariaDB and… It worked!

Then it stopped working.

I restarted the SQL service and it worked!

Then it…. Stopped working… Again…

So I checked logs again and corrected some issues there and again it worked, then a half hour or so later it stopped working.

One thing I had come across in troubleshooting the original MySQL issue was that there was a command, mysql_upgrade that needed to be run to change how some tables are configured. I couldn’t do that before because I couldn’t even get MySQL to run. But I could get MariaDB to run at least for a bit, and had successfully gotten this upgrade command to run.

So I decided to, once again, try MySQL again, so I uninstalled MariaDB, and purged everything out, rebooting a few times to be sure. And MySQL would not even install anymore, so more purging, this time, including the Databases.

One thing I was glad I had decided to do, “Just in Case” when MariaDB was “working” was dump the databases out with backups. I was glad I did at this point. So with absolutely everything purged, MySQL installed and was working.

I set about recreating the databases from the dumps, and while I was at it updated all the passwords, since I had to recreate the user accounts used by WordPress anyway.

And now everything is working smoothly again.

A couple of links that were actually helpful in solving my problem.

https://stackoverflow.com/questions/67564215/problems-installing-mysql-on-ubuntu-20-04

https://learnubuntu.com/install-mysql/

Code Project: Automated List From Reddit Comments

This is one of those quick and kind of dirty projects I’ve been meaning to do for a while. Basically, I wanted a script that would scrape all of the top level comments from a Reddit post and push them out to a list. Most commonly, to use on /r/AskReddit style threads like, well, for this example, “What is a song from the 90s that young people should listen to.”

Basically, threads that ask for useful opinions on list. Sometimes it’s lists of websites or something. Often it’s music. The script here is made for music but could be adjusted for any thread. Here is the script, I’ll touch on it a bit in more detail after.

## Create an APP for Secrets here:
## https://www.reddit.com/prefs/apps

import praw

## Thread to scrape goes here, replace the one below
url = "https://www.reddit.com/r/Music/comments/10c4ki0/name_one_90s_song_kids_born_after_2000_should_add/"

## Fill in API Information here
reddit = praw.Reddit(
    client_id="",
    client_secret= "",
    user_agent= "script by u/", # Your Username, not really required though
    redirect_uri= "http://localhost:8080",
)


submission = reddit.submission(url=url)
submission.comments.replace_more(limit=0)
submission.comment_limit = 1

for x in submission.comments:
    with open("output.txt", mode="a", encoding="UTF-8") as file:
        if "-" in x.body:
            file.write(str(x.body)+"\n")
            # print(x.body)

The script uses praw, Python Reddit API Wrapper. A Library made for use in Python and the Reddit API. It requires free keys which can be gotten here: https://www.reddit.com/prefs/apps. Just create an app, the Client ID is a jumble of letters under the name, the secret is labeled. User Agent can be whatever really, but it’s meant to be informative.

The thread URL also needs filled in.

The script then pulls the thread data and pulls the top level comments.

I’m interested in text file lists mostly, though for the sake of music based lists, if I used Spotify, I might combine it with the Spotify Playlist maker from my 100 Days of Python course. Like I said before though, this script is made for pulling music suggestions, with this but of code:

        if "-" in x.body:
            file.write(str(x.body)+"\n")
            # print(x.body)

It’s simple, but if the comment contains a dash, as in “Taylor Swift – Shake it Off” or “ACDC – Back in Black”, it writes it to the file. Otherwise it discards it. There is a chance it means discarding some submissions, but this isn’t precision work so I’m OK with that to filter out the chaff. If I were looking for URLs or something, I might look for “http” in the comment. I could also eliminate the “if” statement and just have it write all the comments to a file.