Restarting KDE’s Plasma Shell via Konsole (command line)

As much as I love KDE as my desktop environment (on top of Ubuntu, so Kubuntu), it does occasionally happen that the Plasma Shell freezes up (usually when I’ve been running my computer for quite a while then boot up a game and begin to push the graphics a bit. Often, I just shut down when I’m done and that resets everything. However, there is a quick way to shutdown and restart the Plasma Shell that will bring everything back up.

In KDE Plasma Shell 5.10+, the command to kill the Plasma Shell is:

kquitapp5 plasmashell

In KDE Plasma Shell 5.10+, the command to restart the Plasma Shell is:

kstart5 plasmashell

In earlier versions of KDE 5, the commands were:

killall plasmashell
kstart plasmashell

Linux – Music File Naming Conventions

I have been collecting music files for decades, like a lot of people. My total collection includes over 10,000 tracks. When I built my own NAS recently, I decided it was time to do a careful audit of my music as I hadn’t organized my music in a very long time. In the process, I realized that I had to decide on a clear naming convention system for my music.

Music File and Folder Naming

There are some tricky components to this. Assuming you want all of your music in one main folder (not everyone does), the next question is what level of folder comes next. I’ve typically used the Artist as the next folder, so the folder structure looks like this:

MUSIC -> ARTIST
Written slightly differently:
[MUSIC]/[ARTIST]

I typically use software to manage the renaming and also add the information to the tags at the same time to make this easier. In the process, I realized that the structure above should really be:

MUSIC -> ALBUM ARTIST
Written slightly differently:
[MUSIC]/[ALBUM ARTIST]

The reason it should be “ALBUM ARTIST” rather than just “ARTIST” is for albums that have multiple artists. Albums with multiple artists can get really messy if they aren’t organized by the ALBUM ARTIST, which I usually tag as “VARIOUS ARTISTS,” which means the multi-artist albums all end up in a folder called “VARIOUS ARTISTS.”

However, using “ALBUM ARTIST” can also be advantageous when the album is primarily by one person but they have a guest artist on one or two tracks. Using the primary artist as the “ALBUM ARTIST” solves the problem of the separate tracks being organized in a different folder.

The next level below ALBUM ARTIST is the ALBUM TITLE, like this:

MUSIC -> ALBUM ARTIST -> ALBUM TITLE
Written slightly differently:
[MUSIC]/[ALBUM ARTIST]/[ALBUM TITLE]

This structure generally works for most artists and albums to keep things relatively organized. The next issue is the naming convention for the song files themselves. I don’t think this part matters as much, but I have seen different approaches. Some seem to think that including the name of the artist and the album in the name of the file along with the track number and title of the track is necessary, like this:

[TRACK #] – [ARTIST] – [ALBUM TITLE] – [TRACK TITLE].[file extension]

Alternatively, since the file itself is organized within folders that indicate the artist and album, others use the following convention:

[TRACK #] – [TRACK TITLE].[file extension]

This results in shorter names for the files themselves. I’m not sure that there is a better or worse approach. However, including the artist and album title does run a higher risk of running into a character limit for a track (on most operating systems, files can only have a 255 character name).

In light of the file name length concern, I have opted to go with the second, shorter naming convention. Here’s an actual example from a recent album purchase:

[Music]/[The Head and the Heart]/[Living Mirage]/01 – See You Through My Eyes.flac

Finally, there is also the issue of multi-disc albums. I used to put the different discs into separate folders. Now, I add the disc number at the beginning of the file name, like so:

[DISC#]-[TRACK #] – [TRACK TITLE].[file extension]

Organizing and Naming Software

The software I have used for quite some time for playing my music, Clementine, has had some issues with recent releases, leading me to switch to a forked version called Strawberry. However, as I’ve worked with both of these, I’ve come to realize that their ability to manage ID3 tags and lookup up metadata and tag information is problematic. As a result, I’ve switched to using Picard, that relies on MusicBrainz directly (the other two have implementations of this that are buggy in the latest versions of the software).

Picard also does the best job of actually filling out all of the information in the ID3 container, pulling in as much information as possible. As I result, I’ve switched to using Picard for tagging my music.

As for organizing the files, I switch back and forth between having Clementine/Strawberry organize the files (when I import them, I do this), but when I complete the tag information in Picard, I often have Picard redo this just to make sure everything is organized correctly.

Linux – Fixing “apt-get” failed installation

Occasionally, when I try to install an update or install software via the console using apt-get, something goes wrong. To date, I have never had the failure of a package to install ruin my system. However, it isn’t uncommon after such an incident to get an error the next time I run apt-get. The easiest way to fix apt-get is to run the following command:

sudo dpkg --configure -a

The above command is the replacement for the old command in Debian-based distributions:

sudo dpkg-reconfigure --all

Almost every time I have run into an apt-get error, the above command has been able to solve the problem. It’s a useful command to have on hand if you’re running a Debian-based Linux distribution (like Kubuntu, my distribution of choice).

Linux – Downloading YouTube Videos with VLC

I occasionally need to download a video from YouTube (e.g., my son’s school posts a video of him and I want a copy). There used to be browser extensions to do this. Most of those don’t work anymore. But I did find a new approach that is pretty slick and uses software I already have installed in Kubuntu – VLC. Here’s how to download a video from YouTube using VLC.

First, find the URL of the video. Here’s one of my videos you can download if you’d like: https://www.youtube.com/watch?v=XNvxYB4GUtw.

Second, open VLC. (I’m not going to go over installation of VLC. If you can’t do that, you’ve got bigger issues. ;) ) On Linux, click on the “Media” menu option and look for “Convert/Save.”

In the window that opens up, click on the “Network” tab, then enter the URL for the YouTube video.

At the bottom of the window, click on “Convert/Save.”

You’ll get a new window. In the new window, choose the format you want to convert the video to in the “Profile” box. Then type in the “Destination” location.

When you’re ready, hit “Start.”

VLC will then play the video. When it’s done, your converted file should be where you told it to be.

(NOTE: Occasionally, the output will be empty. If that happens, when the video finishes playing, VLC will show the playlist view. Right-click on the video in the playlist and select “Save.” You’ll get the same pop up window as above. Over-write the same file and it should work.)

LibreOffice Calc – Creating Charts with Conditional Formatting

I was working on creating a chart in LibreOffice Calc that was kind of weird. Basically, I wanted to show change over time in a dichotomous variable (e.g., political party affiliation in the US – Democrat or Republican). I could, theoretically, make a chart where presence is indicated by “1” and absence is indicated by “0” or “2,” but I didn’t want the chart to suggest that one value was better than the other, which is what such a chart would indicate:

This chart format seems to suggest that Democrats are something and Republicans are not.

I realized, then, that what I needed was a way to tell the software which color to code each bar in the bar chart. Of course, that is possible by clicking on every single bar and customizing the color. But, with my data already indicating whether it should be one color or another and with over 100 cases to code, I was hoping to find a better approach.

I ended up finding a couple of websites (here, here, and here) that discussed a feature in LibreOffice Calc that was introduced in version 4.5 called “property mapping.” That seemed to hold the answer. However, as of LibreOffice 6.0.3 (the version I happened to be using), the “Property Mapping” option in the Data Range window of a chart was gone. Even so, the general process still works. So, here’s how to create the kind of chart I wanted.

First, make sure you’ve got your data entered (obviously). Second, select the data you want to chart:

Select “Insert -> Chart” and then choose “Column” chart:

On the Next page of the Chart Wizard, make sure you’ve got your data selected correctly (I had to select “First column as label”):

The problem with this, of course, is that I have coded everyone in the dataset with a “1” even though, in reality, some of the Governors in this dataset were Republicans and some were Democrats. Right now, it looks like everyone was a Democrat, but this is where the conditional formatting comes on.

In your spreadsheet, you need to set up your conditional coding. This is done with “IF” statements. Here’s the code I used:

=IF(D2="Republican",COLOR(255,0,0),IF(D2="Democrat",COLOR(0,0,255),COLOR(255,255,0)))

Basically, what this code does is checks to see whether a cell has “Republican” in it or “Democrat.” If it is Republican, color 255,0,0 is selected (RED, which is reported in the cell as 16711680). If it is Democrat, color 0,0,255 is selected (BLUE, which is reported in the cell as 255). The last part of the formula indicates that everyone else should have a different color (YELLOW = 255,255,0). Dragging that down, I get a color code for every one of the values in my chart. Once I have this in place (which should really be done before you start the chart wizard, but can be done after the fact), now I can use this to adjust the bar fill color in my chart.

Adding this to the chart is done in the “Data Series” step in the Chart Wizard. Alternatively, if you’ve already created your chart, select it, and right-click. Then click on “Data Ranges” and you can adjust this there. In the Data Series window, under “Data ranges:”, select “Fill Color”:

You’ll note that the “Range for Fill Color” box is empty. We’re going to fill that with the values we just generated using our conditional code. You can do this by clicking on the button next to that empty box, then select the corresponding values:

Once you have selected your fill color, your chart will now have the corresponding conditional fill colors:

Of course, this chart still looks pretty crappy. The y-axis needs to be adjusted, the columns shouldn’t have any space between them, and it needs a title. Here’s my finished chart:

The chart provides a graphical representation of a dichotomous variable using color to illustrate shifts between political parties without suggesting that one party is better than the other. Et voila – conditional color formatting in LibreOffice charts.