, Sunday, 30 July 2017 2:20 PM (Category: Books
I've been using FBReader as my Linux desktop epub reader for a few years. It's pretty neat, lets me test the epubs before I move them into Calibre. Recently, I did a clean Slackware install for my desktop, and now I can't install FBReader. Can't work it out.
This weekend, I've been sorting out a lot of books, cleaning them up, renaming them, removing duplicates, that sort of thing, and I need an epub reader.
I looked online for options and found things like CoolReader, Lucidor, even a command line program called 'epub', but couldn't find them for Slackware or couldn't install them.
It got awkward loading each book into Calibre, viewing it, and then deleting it. Then I remembered that Calibre's ebook reader is a stand-alone application. Found it in /opt/calibre and it's called ebook-viewer. Works just fine. I don't like typing that much each time on the command line so I set up an alias
and now it's really neat. I just type something like
and I can check it easily. I don't need the other readers any more, I can just work with this one.
, Saturday, 22 July 2017 1:32 PM (Category: General
I've been using cmus as my music player on Linux lately. It's neat, I love it, but I have trouble remembering some of the controls and commands. I went looking for a cheat sheet for it, and I found a couple on Cheatography.
Not only did they have cheat sheets, you can easily create your own. The existing cheat sheets for cmus probably suited their creators, but I have other needs. So I signed up and started building my own. This is a really neat site. I've got most of the info in my own cmus cheat sheet, but I'm not done yet, so I haven't published it. I'll probably have it done this weekend and I'll add it here.
In the meantime, it looks a bit like this:
I finished it and published it. You can download the cmus Cheat Sheet from Cheatography. As time goes by, I will tweak it and maybe add some stuff to it.
, Thursday, 19 January 2017 10:55 PM (Category: Linux
I use a lot of external hard disks on my systems. I mount them manually. I'm using Slackware with fvwm2, although all my servers are not using any desktop or window manager, so my desktop doesn't automatically recognise the drives and mount them for me, and that's exactly how I want it.
On my media server, I have four 4T drives attached. These contain backup copies of my movies. Each disk has a different directory structure and contains very different things. They get mounted to /mnt/sdb1, /mnt/sdc1, /mnt/sdd1 and /mnt/sde1. The minidlna config file points to different things on each mount point. But the same disk doesn't go to the same mountpoint every time. Every time I boot the server and then mount the drives, they get mounted to the mount points in a slightly different order. I usually have to go and change the config file for minidlna after each boot.
There had to be a better way. I went searching and found it.
Each partition on a drive has a UUID. This is an identifier that reasonably uniquely identifies it. I have to find the UUID and then add it to /etc/fstab so I can mount the right hdd to the right mount point every time.
Finding the UUID is a two part process that you do once per drive. So attach the drive., and then run
dmesg. That will show which device point the drive is attached to. For example:
[1546114.360259] usb 2-1.2: new high-speed USB device number 9 using ehci-pci
[1546114.505810] usb 2-1.2: New USB device found, idVendor=0bc2, idProduct=ab34
[1546114.505816] usb 2-1.2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[1546114.505828] usb 2-1.2: Product: Backup+ Desk
[1546114.505830] usb 2-1.2: Manufacturer: Seagate
[1546114.505832] usb 2-1.2: SerialNumber: NA7H0KL4
[1546114.506925] scsi host13: uas
[1546114.508350] scsi 13:0:0:0: Direct-Access Seagate Backup+ Desk 040B PQ: 0 ANSI: 6
[1546114.510183] sd 13:0:0:0: [sdb] Spinning up disk...
[1546127.523061] sd 13:0:0:0: [sdb] 9767541167 512-byte logical blocks: (5.00 TB/4.55 TiB)
[1546127.523066] sd 13:0:0:0: [sdb] 2048-byte physical blocks
[1546127.556980] sd 13:0:0:0: [sdb] Write Protect is off
[1546127.556986] sd 13:0:0:0: [sdb] Mode Sense: 4f 00 00 00
[1546127.557720] sd 13:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[1546127.640220] sdb: sdb1
[1546127.643048] sd 13:0:0:0: [sdb] Attached SCSI disk
In this example, I can see that the drive is on /dev/sdb and the partition is on /dev/sdb1. Using that, I can find the UUID with the blkid utility.
# blkid /dev/sdb1
/dev/sdb1: UUID="1fc72131-ba02-4944-81c9-313b28aec42e" SEC_TYPE="ext2" TYPE="ext3" PARTUUID="89361733-9d1a-45d5-b34f-a0e925b8676f"
Once I have the UUID I can set up an entry in /etc/fstab so that drive will always be mounted to the same mount point.
UUID="1fc72131-ba02-4944-81c9-313b28aec42e" /mnt/video1 auto noauto,users,sync 0 0
First, make sure I have a mount point called /mnt/video1.
Now I can just say
mount /mnt/video1 and it will be mounted correctly. I never have to worry about whether it's sdb or sdc or sdd or sde.
I could even set all my drives up so they automount at boot time. I haven't done that yet, but I think it would be easy to do. I would make the entry in /etc/fstab be something like this:
UUID="1fc72131-ba02-4944-81c9-313b28aec42e" /mnt/video1 auto auto 2 2
, Sunday, 19 June 2016 10:38 PM (Category: Music
This is a saga about my music library and maintaining it. This is not for everyone, this is my hobby, it gives me pleasure to do this and keep my library maintained, and to write software for it, and write scripts, and fiddle with it. This is about me having fun, my way. Your mileage will undoubtedly vary.
Streaming vs Own Library
I know that most people have abandoned their own music libraries and simply use Spotify or Rhapsody or Apple Music and pay a monthly fee and get access to a reasonable range of music. I hear that Amazon is about to fire up their own streaming library too. That's all good, it's an easy way to get access to good quality music easily, and have zero maintenance.
I don't participate. I have a fine little library of music that spreads across many genres, and is deep in areas that I like. I am particular about some things. For example, I like early Mike Oldfield, especially Ommadawn and Hergest Ridge. I grew up with those two pieces and really love them. I listened to them on CD recently and went WTH? That's not what I remember. And I researched. He remastered them and for my tastes, the new versions sound like completely different pieces of music. I want to listen to what I grew up with, not with what he now considers the definitive version. So I bought the two boxed sets of these two pieces and they contain the new versions and the original versions. I ripped them and can now listen to the original versions, the way my mind hears them. But on the streaming services, I think all you can get is the new versions. That's just one example of why I don't want to rely on the streaming services.
Also bandwidth. My way, my music is on a HDD and there's no wasted bandwidth. This is a downside according to my co-workers who don't want to carry a HDD and manage it and back it up. And they don't care about how much of work's bandwidth they use during the day.
If Spotify lose an artist and have to pull all that artist's music, it doesn't affect me. If Rhapsody has only the last few releases by a band, say Gaye Bykers On Acid, when they had lost their fyre, but don't have their first two releases - Drill Your Own Hole and Stewed To The Gills - that doesn't affect me either. I bought the vinyl and converted them to mp3s myself. Much better music than the later stuff.
So I maintain my own curated library of music.
But one of the issues of maintaining my own curated library of music, is the metadata - the tags. A library of music has to have accurate metadata so you can find it, sort it, organise it, enjoy it. Music players rely on the tags in the mp3 files to make sense of it all.
So the tags are stored in the mp3 files. The file contains both the music and the metadata. For most people, that is the only location of the metadata, the tags. If they replace their mp3s, say a re-rip for better quality, they have to enter all that data in again. You could use external services to populate the tags for you. I estimate that the public suppliers of track data and tags are pretty good with tags for new rock and pop. Probably 95+% accurate. For older rock and pop, it's really variable. Maybe 70% accurate. For classical music, it's abysmal. So many errors, so much missing data. I care about this stuff, but nearly everyone else doesn't. It's a hobby for me, like collecting stamps. I want the data to be right. Storing the data in the music file and having to re-enter it if the music file changes is not the way I want to go. I want a permanent repository of data that exists outside the music file. And not in a database. I want something simple, text based, and stored with the mp3s so it's portable.
A very long time ago, I collaborated with Richard on this very issue. We went through a number of iterations until we came to a system that we were happy with. In each directory with mp3s, we store a simple text file called track.dat. This contains all the mp3 tag data I could possibly want, in a simple scheme. I have a Perl program called tagger.pl that reads that file and adds the tags to the mp3s. If I replace the mp3s, I just run tagger.pl and it uses the data in track.dat and shoves it into the mp3 so the music players can see it. If I get better data, or fix mistakes in the data, I just run tagger.pl again and again and again and it takes the information in track.dat and stuffs in into the mp3.
I have my library of music at home, and at work, mostly on Linux machines, and occasionally on a Mac so I can put some music on my iPhone. The prime repository is not a Mac. It is an external hard disk on my Linux desktop. iTunes is not my prime repository, iTunes is just the end of a chain, a conduit for putting the music in my device. I don't listen on my iPhone much any more. I listen mainly on my home and work Linux desktops. So my scheme has to be OS independent; independent of any one music player; simple, text-based for easy editing; and able to work with a lot of data.
I have 123,000 tracks in my library, about 9,000 CDs or LPs or whatever. I have a lot of data. I enjoy working with it, and I enjoy listening to it.
id3v2 and Sort Order
Richard and I developed that scheme in 2005, and we've been using it ever since. We each use it in different ways. It's a great initial design but we've deviated in the application. Shows how good it is that it works for both of us. As the years have gone by, I have improved both the metadata I store in track.dat, and the tools I use to take the metadata out of track.dat and insert it into the mp3s.
I'm on Linux so I use the id3v2 command line utility to put the tags into the mp3s. This utility dates back quite some years, and hasn't been updated in a while. It worked pretty well for me till about 2010, and then the tagging scheme changed a little. I think it handles mp3 tags up to version 2.3, but not 2.4 and beyond. Until last week, I continued to use it.
Over the years, I have only ever had one problem and that was the artist and composer name order. The way I've been doing it, Tim Buckley appears under T for Tim. I would prefer he appear under B for Buckley. Similarly, Claude Debussy appears under C for Claude, rather than D for Debussy. If you want to find Debussy's music, you have to know his first name. I always forget the first names of the classical composers. I want the artists and composers to appear in last name order.
MP3 tags are stored with four-character tags. For example, the artist name (really performer name = P) is stored with the TPE1 tag, and the composer name is stored with the TCOM tag. Modern music players do accept tags for sort order. Sort-artist is stored with TSOP, and sort-composer sort is stored with TCOS. So to achive the desired result for Tim Buckley and Claude Debussy, I would have tags like this:
and the normal name is displayed, but the sort version is used for sorting. Works really nicely. Except, the utility id3v2 does not accept the new tags. I can't put them into the mp3.
There's also one downside to the new scheme. Most modern music players have the concept of an ALBUM-ARTIST. This helps with compilation cds. The album artist is stored with the tag TPE2 and the sortable version in tag TSO2. This is really unfortunate for classical music because traditionally TPE2 was for the orchestra and TPE3 was for the conductor. But now that TPE2 has been co-opted as the album artist, you can't store the orchestra in the mp3. I was bummed out when I found this.
So I would like to use the new tags that allow sort artist and sort composer, but the utility id3v2 does not support them. The source code is available, and I have worked with it. I cannot make the modifications to allow the newer tags, I am not clever enough a programmer.
And that is where matters stood until recently. As part of an effort to find an alternative, I installed a Python module called mutagen which looked really promising. I played with it, and it's neat. I could write little utilities to interrogate mp3s and work with them. And it's all Python. Love it.
Then I found that mutagen comes with a utility called mid3v2 which is a drop-in
replacement for id3v2. Same switches, same everything. Presumably the name is something like Mutagen id3v2. It's a Python script, so I have a better chance of understanding it. I've been playing with it, and it works and it's now my base tagging utility. All I had to do to get it into use was change "id3v2" in my tagger.pl to mid3v2. The irony of calling a Python program with a Perl program has not escaped me. Best of all, mid3v2 supports the sort order tags. So now I can do everything I want to do with tagging.
And now I face a new project - a major overhaul of every track.dat file, adding new tags, improving the data to take advantage of the new features, cleaning up some earlier design decisions. And then re-tagging all the mp3s. This is going to be fun.
I have over 10,000 track.dat files. Luckily, I do not have to edit every one by hand. I already have utilities - both shell and Perl - that read all the track.dat and search for one tag and value and replace it with another tag and value. It was short work to enhance that so the search for one tag and value and append another.
So I can say "search for artist = Tim Buckley" and add the line sort-artist = Buckley, Tim" on the next line, and it will read through all 10,000 files and edit them. I backed up my data first. But it works cleanly and nicely and takes about three seconds to read and edit all 10,000 track.dat files. I have been cleaning up composers and artists, and having to make decisions. How do I determine the sort order for Nusrat Fateh Ali Khan? What is the last name of Ralph Vaughan Williams? What about Orlande de Lassus? Does that go under D or L? For me this is fun.
There is one other advantage to mid3v2. It's fast. id3v2 was quite slow on external USB hard drives. mid3v2 is not slow at all.
So there we are. I have a new project to work on. At the end, I will have a nicer music library that is better organised. I will have learnt a lot in the meantime, and it will give me the opportunity to write new utilities and shell scripts and Perl programs and Python programs. For me, this is fun.
, Sunday, 19 June 2016 6:01 PM (Category: Work
I joined Linked In in 2009 when it was new. It was like Facebook for work. But it didn't really do anything for me. I think it has helped a lot of people get jobs and make contacts, and that's fine for them, but I haven't seen any benefit. I didn't make much effort joining and creating contacts and links and putting up profiles and doing all the regular things that you are expected to. My work situation is fairly stable, and quite busy, and I have not been looking for a job.
Linked In has irritated me, with a lot of nagging emails over the years, although I turned off notifications. That has been better last couple of years, but there were times when it got really annoying.
I've had a lot of my skills confirmed by other people, like my SQL Server skills, and my Microsoft products skills. These days, I wouldn't know how to fire up anything Microsoft, so I don't know how my non-existent skills in these fields got confirmed.
But it doesn't matter. I'm a few years away from retirement now. I think my job is reasonably secure for those last few years. If it wasn't, then I would just retire early. So I don't get any benefit from Linked In, and I don't want to participate any further. And recently, it got bought by Microsfoft. I don't really care about that, but it reminded me that I didn't really want to be in Linked In any more, so I went to delete my account. I couldn't see any reference to it when I logged on, so I did some research and found where it's kept.
Under Privacy and Settings, near the bottom, there's a link to Closing Your Account. They do a short exit interview and ask why you are leaving. I said I was retiring and didn't want it any more. Then for security I have to enter my password again, and there are two buttons - Back To Settings, and Close Account. But Close Account is greyed out and can't be clicked. So right now, it is not possible to close your Linked In account and leave. Perhaps while the Microsoft purchase is taking place, this is a special measure to keep the number of members at normal levels to keep the sale price stable. Or something.
So I can't leave. What can I do? I can poison my data. I am now a 77 year old banker from Philadelphia, with skills in banking and lying, and a work goal of retiring. I altered all my data. I can do that, even if I can't leave. I'll come back after the Microsoft purchase is concluded and see if I can delete my account then.