I have spoken in the past about the podcast management system I have created, but have never gone into much detail about how I manage the playing of episodes.
Prompted by MrX’s HPR episode hpr3132, “Keeping track of where I am” I will describe it now.
- Details of all my podcasts are in a database which runs on my desktop PC
- I keep details from the feed for each episode
- If I currently hold a relating to an episode file then the database knows the path to it
- Since I’m a hoarder, I keep episode details in the database for episodes I have already listened to.
- Every podcast feed is assigned to a group. I have groups such as music, science, documentary and technical.
- I interface to the database on my desktop PC using command-line scripts and through Pdmenu menus.
- The episodes are on a Raspberry Pi which runs all the time and has an SSD attached, and I mount the podcast directory on my desktop using NFS
- I download podcast episodes overnight on the RPi using a locally hacked version of the venerable
Bashpodder, which I have talked about in the past.
- I have several MP3 players with Rockbox installed
- I usually load my players using a script that is aware of the feed groupings that I have defined. It makes a playlist in the database and writes a copy on the player. The database playlist table holds the alias of the player so I can have a playlist per player in it.
- I have another script which can upload the contents of a feed for when that is convenient.
- As I play an episode I run a script that marks that episode in the database as being played.
- It’s Rockbox that tracks which episode I’m listening to and where I am in the audio on the player
- After playing an episode I run a script that lists episodes marked playing and allows me to delete them from my PC and from the database
- I don’t actually delete anything from the player until I next upload to it
- There is an issue with the size of a group and the space on a player. This has worsened recently because I don’t seem to be able to listen to podcasts fast enough and most of my players don’t have a huge amount of space on them.
- Since I don’t delete files on the player until I upload new ones I don’t always know how much space there will be. I have to find a solution to this!
- I have a script that shows numbers of files and total sizes for the groups, both for files copied to players and those pending. I plan to use these sizes to make decisions about what gets uploaded.
- In the worst case I can write episodes to a player selected by feed name if there are capacity issues.
Uploading feed contents to a player
The player being used in this example is a Sansa Clip with an alias of
'Clip'. This player (as with most of my players) runs Rockbox. It gets mounted on
/media/usb2. The commands that are run (by the alias
player_mount) look on the player for a file called
PlayerName and display it using
$ player_mount ____ _ _ / ___| (_)_ __ | | | | | '_ \ | |___| | | |_) | \____|_|_| .__/ |_|
Next, the script
copy_episodes performs the upload of episodes from a particular feed. The
-c C option says to remove any media found in the
PODCASTS directory on the player. Using
-c N allows further feeds to be appended to what’s already on the player. The feed name is a regular expression, so
'Hacker' maps to Hacker Public Radio. The script generates a playlist on the player in the
Playlists directory for use by Rockbox, it’s called
podcasts.m3u and contains paths to the episodes which are relative to the player.
$ ./copy_episodes -m /media/usb2 -p Clip -c C -f Hacker Warning: There are already files on the player Deleting media files Copying files from feed 'Hacker' to the Clip player 1: /home/cendjm/Bashpodder/Podcasts/2020-08-14/hpr3140.ogg 2: /home/cendjm/Bashpodder/Podcasts/2020-08-17/hpr3141.ogg 3: /home/cendjm/Bashpodder/Podcasts/2020-08-18/hpr3142.ogg 4: /home/cendjm/Bashpodder/Podcasts/2020-08-19/hpr3143.ogg 5: /home/cendjm/Bashpodder/Podcasts/2020-08-20/hpr3144.ogg 6: /home/cendjm/Bashpodder/Podcasts/2020-08-21/hpr3145.ogg 7: /home/cendjm/Bashpodder/Podcasts/2020-08-24/hpr3146.ogg Created playlist COPY 7 NOTICE: Rows changed = 7 $ player_umount
There is a backup of the playlist on the PC and the
playlists table in the database is also updated. The messages
'COPY 7' and
'NOTICE: Rows changed = 7' are generated by the database for debugging purposes.
I use an alternative script (
copy_group) when uploading episodes to a player by group.
player_umount unmounts the player.
The playlist is used on the player by navigating to the
'Playlist Catalogue' entry in the main menu. Clicking the central button on the Sansa Clip shows the list with the name
'podcasts'. Clicking on that shows a numbered list of episodes. Clicking on the first entry starts the playing of the playlist.
My Rockbox players are set to write a bookmark for the currently playing episode when the player is turned off. They are also set to auto-resume after stopping, so I can stop and turn off during the playback of an episode and the player will resume where I left off when I turn it on again. If for any reason I navigate away from the playlist I can get back to where I was with the
'Resume Playback' item on the main menu, or I could look in
'Recent Bookmarks' to find the bookmark for what was being played before.
My Rockbox player collection:
alias | manufacturer | model | gigs ---------+--------------+----------------+------ Fuze | SanDisk | Sansa Fuze V2 | 16GB Clip | SanDisk | Sansa Clip+ | 8GB H10 | iRiver | H10 | 5GB Clip3 | SanDisk | Sansa Clip+ | 4GB Mini | Apple | iPod Mini | 4GB H10-6GB | iRiver | H10 | 6GB Fuze2 | SanDisk | Sansa Fuze V1 | 2GB Clip2 | SanDisk | Sansa Clip+ | 8GB Fuze3 | SanDisk | Sansa Fuze | 6GB Fuze4 | SanDisk | Sansa Fuze V1 | 4GB Zip1 | SanDisk | Sansa Clip Zip | 4GB Zip2 | SanDisk | Sansa Clip Zip | 4GB
I run several scripts to mark episodes as being played and to delete those I have listened to. The following is an edited transcript.
The first section shows what’s active on any players known to the database. The
'Clip' player has the HPR episodes added above, none of which have yet been played. I’m up to podcast episode 38 on the playlist for the
1 [Clip,01] HPR: GIMP: Selection Tools 2 [Clip,02] HPR: Lessons learnt from Magic the Gathering game design 3 [Clip,03] HPR: tcsh 4 [Clip,04] HPR: LibreOffice 7.0 Released! 5 [Clip,05] HPR: Pentesting: Insecure Object Reference 6 [Clip,06] HPR: A light bulb moment, part 1 7 [Clip,07] HPR: Help Me Help you with HPR eps! 8 [Zip2,38] mintCast 338 - Two Oh Snap 9 [Zip2,39] mintCast 338.5 - The Ripple Effect 10 [Zip2,40] mintCast 339 - OLTs? More Like OLGeez 11 [Zip2,41] mintCast 339.5 - ZFS Butter Recognize 12 [Zip2,42] mintCast 340 - Unit of Measurement 13 [Zip2,43] mintCast 340.5 - Will It Blend? . . . Select number(s): 8 Marking: 8: mintCast 338 - Two Oh Snap Made 1 change(s) 01: [Zip2 ] mintCast 337.5 - Managing the Managers 02: [Zip2 ] mintCast 338 - Two Oh Snap Select numbers: 1 Deleting: 1: mintCast 337.5 - Managing the Managers
I truncated the complete list on
'Zip2'. The prompt
'Select number(s):' is asking which of these episodes I’m next going to listen to. I select 8, which is a mintCast episode on the
The next prompt
'Select numbers:' follows a list of episodes currently marked as being played. I select number 1, the previous mintCast episode I just finished. This is then deleted and the database updated.
The listing then shows how many podcast files still exist, with their cumulative size. This is followed by a (truncated) list of durations of the remaining episodes. I currently have 1 week, 1 day, 47 minutes and 58 seconds of continuous listening to catch up with my 10GB of podcasts!
Total = 262 (83 directories) 10G Podcasts/ [2020-08-24 09:00:53] 01 weeks, 1 days, 01 hours, 57 minutes, 02 seconds [2020-08-24 11:02:42] 01 weeks, 1 days, 00 hours, 47 minutes, 58 seconds -------------------------------------------------------------------------------- Player: Zip2 Album: MP3 - mintCast Artist: mintCast Title: mintCast 338 - Two Oh Snap Length: 01:13:31 Genre: Podcast Track: 338 Year: 2020 Comment: The podcast by the Linux Mint community for all users of Linux. Path: /home/cendjm/Bashpodder/Podcasts/2020-07-02/ep338.mp3 --------------------------------------------------------------------------------
Finally a display script is run against all episodes marked as playing to show a summary of what is being listened to on my players.
I usually only have a maximum of three players active at any time. That way, I can change to another player when the one I’m listening to needs its battery recharged.
Managing ID3 and similar tags on episodes
As I process the day’s batch of incoming podcasts I manipulate the audio metadata (tags). I have a Perl script I wrote which uses a rules file for each feed and performs checks and actions on the episodes it finds.
In general I try to ensure that podcast episodes have a valid title that can be seen in the lists shown above. Sometimes the audio does not contain tags, so my script can access the fields from the RSS or Atom feed and use these to fill in the audio tags.
Some feeds place the feed name in the title (as with the mintCast example above), but if not, I use rules to add something meaningful. In the case of HPR the title usually makes no reference to HPR itself, so I add the characters
'HPR: ' to the front of the title for my convenience.
I find it surprising how many feeds produce episodes which have no metadata at all. I used to write to feed owners and ask for these to be filled in but this was largely a waste of time, so I evolved my
tag_manager script to make decisions about what should be in the metadata fields.
- Rockbox - an alternative operating system for certain music players
- figlet - a program for making large letters out of ordinary text