Automatic Updating of New Podcasts with Radio DJ

That has to be one of the lamest topics I’ve ever made for a blog post but it’s at least descriptive.

This is a short guide for users of the Free RadioDJ software who want to automate the process of adding new podcasts to the rotation.  This is mildly complicated but not overly so and it does require the use of outside programs to make it work.  For this example, I’ll be using the NoAgenda podcast.

The first thing you’ll need is a pod catching program.  I use gPodder but if you have a preferred alternative you can use whatever you like.  The key here is that the program needs to download the files into one regular location that you can reference with some batch files.

For those who are less familiar with the old school DOS environment and batch files, basically, a batch file, or .bat is a file which contains command line commands which will be executed in order.  It’s similar to making scripts in Linux only for Windows/DOS.  For simplicity, I recommend making a single .bat file for each show you want to run and naming them something like renameSHOW.bat.  I keep mine in the c: Root directory but you can put them in a folder somewhere if you’d like.  It’s probably better to try to keep all files in folders without spaces since DOS and the command line can get funny when spaces are involved.  This goes for your downloaded Podcasts as well.

To change the default download directory in gPodder, right click a Podcast and change the name description to one without spaces.  For example, if the default picked up is “No Agenda”, change it to “NoAgenda”.  For other programs you’ll have to figure this out on your own.

Next, create a batch file.  If you have file extensions turned on you can right click in the c: directory and do a “Create new –> Text File” then name it, for example “renamenoagenda.bat”  Alternately, simply open up Notepad, then save as “renamenoagenda.bat” in the appropriate directory.

Edit the file with Notepad or any preferred basic ASCII editor.  Add the lines shown below.

if exist d:PodcastsNoAgendanoagenda*.mp3 del d:PodcastsNoAgendanaradio.mp3

rename d:PodcastsNoAgendanoagenda*.mp3 naradio.mp3

You’ll want to replace the paths in this manner. “d:PodcastsNoagenda is the directory where the Podcasts are stored.  This will be dependant on your program and settings.  I have a second drive in my Pc where I store all the music RadioDJ uses.

“noagenda*.mp3” is the generic name of what’s downloaded by gPodder.  Each episode is something like “Noagenda-Episode-Date-Whatever.mp3.  They ALL start with “noagenda” and all end with “.mp3”.  using this will pick any episodes in the directory.

The file “naradio.mp3” is the file used by RadioDJ.  It is a generic file that RadioDj has in it’s list and it is of the type “Variable Length Audio”.  This will make RadioDJ get the length when it goes to play this file.  i use this format “radioXXXX".mp3” for simplicity.  For example, I’m also rotating FLOSS Weekly, which is called “radiofw.mp3”.  The key here is that the file CANNOT have the same starting name as the downloaded podcasts.  If I were to call it “noagendageneric.mp3” for example, then it would be picked up by the “noagenda*.mp3” call which would screw everything up.

Now, the essense of what this file is doing. 

if exist d:PodcastsNoAgendanoagenda*.mp3 del d:PodcastsNoAgendanaradio.mp3

 

This line says “if there is a file named noagenda*.mp3*, then delete the generic file.  I had trouble originally because I simply had the .bat delete the generic file.  This presents and issue if a Podcast has not been updated and there is not a new file to replace it.

rename d:PodcastsNoAgendanoagenda*.mp3 naradio.mp3

This line says “Rename noagenda*.mp3 to the generic file.”  This will create the new generic file that Radio DJ will use.  Also of note, this will “consume” the new episode.  This whole process requires that there is only one new episode.  if you’re clever this script COULD be adopted to create a series of rotating episodes.  I’m not going to get into that detail here however.  Essentially it would be a series of scripts that run daily.

Which brings up the next step.  You’ve created a batch file, now you need to schedule it to run using Windows task scheduler.  Simply set it up to run as needed.  For example, i run new episodes at 7PM, so i run the file at 6:30 PM on the day it’s needed.  The changes are essentially instantaneous so i could run them as 6:59 if I wanted.  I also have a short new segment which runs hourly.  This one runs at 4AM.

The thing that will sort of break this is if the downloaded new episodes do not use a regular file name.  Also if your Podcast feed isn’t updated in time.  The result hwoever will be that the generic file won’t change and an old episode will run in it’s place, so at least something should run.

Programming (Part 2)

I promised a part two so here it is…

The first post can be found here.

As previously mentioned, my previous self taught programming experience involved BASIC and whatever the TI-85 uses.  I had my first official taste of taught programming in College a couple of years after High School with C.  My Engineering degree required I take “Programming for Engineers” which was basically C programming to solve iterative math problems.  Most of the programs we did were by the book style involving arrays and graph style equations.  The book for the course was actually two books and we only got through maybe one of them since Engineers aren’t computer programmers.

This was fun but at the time I was rather busy with school so I didn’t to doo much beyond what was required for class.  A couple semesters later however was different.  I finished my Associates in 2.5 years meaning I finished in December.  I wanted to start the Bachelor’s track in the Fall since it makes all of the class schedules work out better so I had a semester to kill.  So in addition to working a whole bunch, I took two classes just for fun, Basic electronics and Computer Science 101.

CS101 was essentially C++ Programming for beginners.  There are some keys here.  I’ve had experience with C, which is very similar to C++, especially at this level of programming.  Also The TI-85 language is reasonably similar to C at this level of programming.  Basically, I’ve had a decent amount of experience at this.  The end result was that I excelled in this class, I did better than everyone else (most of which were actual Computer Science Majors).  The teacher also set up a side class for whomever wanted to attend learning some visual windows based elements.

The fun was in the larger assignments though.  Most of the quick assignments didn’t leave much room for creativity.  “Mr. Shopkeeper needs a program that will calculate 7% sales tax for his sales.  Make a program that takes the total bill in and outputs the total with tax” doesn’t leave much room for expansion.

The larger assignments were all simple games with variable elements that allowed for much more fun.  We also got more time to work on these, maybe a week or two.  I could easily code the basic assignment in a day leaving me, well, a week or two, to code “extras”.

This is where I created my first three “real games”.  Note the scare quotes.  Truth is, these are all rather buggy as evidenced by the fact that they don’t like unexpected input and are generally pretty crummy.

So I present to you, Tug of War, Pearl Diver, and Let’s Win at the Races.  All of these titles were given out by the class as was the basic premise of the game.

The parts that I added was anything graphical, even if it is ASCII graphics.  The requirement was only for a text based input and output.  Ok, yeah, it’s pretty simple, big deal.

I’ve done a few other projects that never got completed, the most ambitious was a PC based sequel to my previously mentioned Dragon Quest series.  This one was somewhat Zork like with a text based interface only it added a one on one random battle system like Final Fantasy and a level up system similar to Final Fantasy 2 where skills build as you use them and class is based on your skills.  I got as far as completing the map (without descriptions).  So you can wander around an empty world in it’s current state.  One day I hope to get back to it.

My other self taught programming project involves HTML, if you want to call it programming.  A better word is probably “coding”.  Back in 1998 when I first started building webpages I started in MS Frontpage.  I noticed there was a lot of flack for people who used Frontpage so I bought this big fat HTML book (HTML Complete, $20, great value).  So I taught myself basic coding of HTML.  These days I don’t use this skill as much since blogs make things much much easier but this skill does come in hand a lot when I’m trying to manually tweak my WordPress templates.

Programming is something I enjoy when I have time though my main complaint is always finding a decent free compiler.  The only free C++ complier I’ve ever found was by Borland and it is absolutely TERRIBLE for user friendlyness.  I plan to do some additional programming in the near future for fun it’s mostly a matter of finding time.  I’d love tog et into more visual element and make actual graphics and program that run in Windows.  Also there are quite a few more modern languages out there now.

Anyway, if I build anything new, you’ll be surely seeing it here.

Programming (Part 1)

Hey, it’s pointless personal trivia day!  Hooray.

Anyway, I’ve never taken up computer programming in any official “this is what I’m going to do for work” sort of level but it’s off and on been a background hobby of mine.  I’ve been considering getting back into it lately which has inspired this historical blog post.

The first programming language I ever learned any part of was BASIC.  This was around 1987-1988 when I was 7 or 8 years old.  I know this because, at the time, my dad had gone back to school to finish his degree in Computer Science and I learned a bit of Basic from him based on what he was learning at the time in college.  I never used it for anything super elaborate.  The most complicated piece of code I ever created involved a simple password that would then display a bunch of text or ask questions that would display different text based on the user’s response.  Simple “If Else” style programming.

This “If Else” method of programming is very simple but it’s a set up that can be used for a lot if managed properly.  It’s a method that would translate over tot he next segment of my programming years in High School.  Because I was in Advance Math, I was required to own a fancy TI-85 Graphic Calculator.  The most exciting thing any of us ever did on these calculators was to program little games and programs.

I had two major programming projects I created for the TI-85 and irritatingly, both have been completely lost to the throws of time.  I didn’t get a PC link cable until well after High School so I had no effective way to back up my hard work.  The first and main undertaking I ever had was a pair of games called “Dragon Quest”.

The name Dragon Quest was chosen in tribute to Dragon Warrior, before I knew Dragon Warrior was in fact also secretly called Dragon Quest in Japan.  The first game was a very simple RPG, all contained in one saved file.  You would exist at the town most of the game.  You could buy potions to heal in this town or stay at the inn to heal.  You also ha the option to “explore”.  Exploring would result in one of two encounters, a small dragon or a wizard.  Everything did a set amount of damage so the whole game was extremely predictable.  After 20 battles, exploring would result in an encounter with the “Dragon Lord” who was a much tougher dragon.

The battles were the shinning point in this game.  It took a ton of memory but the battles were all graphical.  You’d see a wizard, dragon, or Dragon Lord graphic on screen to indicate the type of encounter.  Your two attacks, slash and stab, would overlay a different graphic depending on which was used.  These were basic black and white images created in the calculator’s Graph Drawing function.

Many people liked this game in my High School and it was generally pretty distributed among people who had graphic calculators.

So I created a sequel.  The sequel dropped all graphics in the interest of saving memory.  However, this memory saving allowed for a TON more features.  The player could now learn 4 different spells over town, a fireball, healing, nuke and better healing.  You could also spend money from encounters on new weapons to do more damage.  All damage was now variable. The encounters were much more varied with two dozen types of enemies that would randomly show up.  Halfway through you’d be given the option to solve a series of riddles and fight the mighty White Dragon in order to earn the best Sword, Xcalubur.  Instead of 20 encounters the number was increased to 50.  There was also the addition of a menu driven system since I had figured out how to work this function.  Lastly, since 50 battles was a lot to make it through, the game featured a three file save system that would write everything to a file.

The next best feature, which was highly underlying and not visible to the player, was that the game was broken up into a series of modular files.  I had learned how to call one file within another.  This meant that the main game was in fact, nothing but a series of calls to other files.  It also meant one part could be much more easily tweaked as needed.

The most impressive part of all this really was that I’d never had any level of education in how the TI-85 was supposed to be programmed.  I had the manual, which described the available functions and commands, and the rest as all trial and error or luck.

I mentioned that I had created two major projects.  Dragon Quest was the first, the second was “Windows for the TI-85”.  At least that’s what I called it.  It wasn’t really very Windowsish.  Basically I created a menu based graphical icon based system for launching the programs on my Calculator.  Unfortunately the icons were part of a static background and the menus were all hard coded so it wasn’t portable to anyone else’s calculators.  It was more of an experiment than anything.

Next… Part 2: The HTML, C, and C++ Years….