Archive for February, 2010|Monthly archive page

Ubuntu 9.10 serving the PS3… pt 4

Ubuntu 9.10 serving the PS3 and everything involved… pt 1 : MediaTomb
Ubuntu 9.10 serving the PS3 and everything involved… pt 2 : HandBrake
Ubuntu 9.10 serving the PS3 and everything involved… pt 3 : Mashpodder
Ubuntu 9.10 serving the PS3 and everything involved… pt 4 : cron

So far I have Mediatomb installed and serving media to my PS3. I’m using Handbrake to rip DVD’s that I own and serving those mp4’s to the PS3 via mediatomb. I am downloading videocasts from the Internet via mashpodder and serving those files to the PS3 via mediatomb. Now I want to automate the downloading of those videocasts and the deletion of them after a week or so. For that we need cron… or crontab.

With cron, I’m going to automatically run mashpodder in the middle of the night and delete the old files that I have been downloading into those Audio and Video folders.

So open a terminal and add some cron jobs. At the commandline type:
$ crontab -e

Now you need to know the path to the mashpodder.sh script. My path is mashpodder-svn23/mashpodder.sh .
Now how to set it up or write it in our cron tab file. The format is:
* * * * * [COMMAND]
1st * – Min (00-59)
2nd * – Hour (00-23)
3rd * – Day of the month (00-31)
4th * – Month (01-12)
5th * – Day of the week ( 01-07)

Example:
00 03 * * * [command] Would be an entry to run a script every night at 3am.

My mashpodder entry looks like this:
30 03 * * * mashpodder-svn23/mashpodder.sh
It runs at 3:30am every night.
If i wanted it to run every Sunday at 3:30am, it would look like this:
35 03 * * 07 mashpodder-svn23/mashpodder.sh
It seems that the week starts on a Monday in cronland. I think we get the point. Experiment, play around with it.

I have mashpodder putting those video/audio files in these directories.
/home/terry/podcasts/Audio
/home/terry/podcasts/Video

I want to delete my videocasts after 10 days and my audiocasts after 180 days. I like to keep the audio around a little longer. I like to be file specific. My ogg file delete entry looks like this.
/home/terry/podcasts/Audio -name '*.ogg' -mtime +180 -exec rm -r {} \;
Now add specific times to delete these files. I use the same timing scheme that I used to run mashpodder.
I had to hunt around for the right delete command. The one I’m using works and is specific. It is also recursive, meaning it hits all subfolders. It will leave all other files alone. I know this is a bit confusing… at least it was to me but I got it hammered out and working. My crontab file looks like this:

I didn’t have to specify the Audio or Video folders in the delete commands. During the hunt for the correct delete command I had commands that would delete everything… even the folders themselves. The above commands do not do that. They are specific. I just left the Audio and Video folder part in there. My current crontab file is >here<.

Lots of good information here. Command scheduling with cron.

That’s it. I just let that machine run 24/7 and it does it’s thing. I fire up the PS3 on a daily basis to see what shows up. Like I said in the other posts, I’ll be re-doing/writing this all over again when the next Ubuntu LTS comes out. Maybe then I can document the whole process a little better. This was an experiment that snowballed and worked out well… for me anyway.

Ubuntu 9.10 serving the PS3… pt 3

Ubuntu 9.10 serving the PS3 and everything involved… pt 1 : MediaTomb
Ubuntu 9.10 serving the PS3 and everything involved… pt 2 : HandBrake
Ubuntu 9.10 serving the PS3 and everything involved… pt 3 : Mashpodder
Ubuntu 9.10 serving the PS3 and everything involved… pt 4 : cron

Installed from synaptic:(make sure this is installed)
curl

Once you have MediaTomb set up  and scanning the media filled folders you want to serve, lets add some more media. I want to download videocasts… or video podcasts.The best option for me is Mashpodder. I say this because I want to automate this downloading of the videocasts on a nightly bases. The automation part will be in part 4. Alright, lets get Mashpodder. Go >here< and download mashpodder-svn23.tar.gz

Download the file to your home directory. In your home directory, right click the tar.gz file and select Extract Here. Or open a terminal and navigate to your home directory. Type:
tar xvf mashpodder-svn23.tar.gz

Both methods should land a folder named mashpodder-svn23 in your home directory. Open this folder. The file we want to look at is mp.conf . Open it with gedit. The stock file should look like this.

It’s pretty self explanatory. What is not explained is that mashpodder will auto generate a “podcasts” folder in your home directory and save the downloaded podcasts here in what ever folder you decide to put them in. Also, your mp.conf file will need to live in this podcasts folder also. I just copied the mp.conf file from the mashpodder-svn23 folder to the podcasts folder… that I just created. Now make the necessary changes to the mp.conf file in your podcasts folder. I split mine into Audio and Video folders. It makes it easier to browse with the PS3. Now this is what my mp.conf file looks like as of today. It’s also located >here<.

I only listen to 2 audio oggcasts on the PS3… because they are music. All other audio pod/ogg casts are handled by gpodder on my laptop. Those go on my portable media player.

Now lets make sure the mashpodder.shell script executable. Open a terminal and navigate to the mashpodder-svn folder in your home directory. Type this:
$ chmod 755 mashpodder.sh
chmod – Changes the permission of a file.
755 means read and execute access for everyone and also write access for the owner of the file.
Now run mashpodder. Open a terminal and navigate to the mashpodder-svn folder in your home directory. Now type:
$ ./mashpodder.sh
It might seem like it’s not working but it is. Give it a few minutes.

Now add the podcasts folder to your Mediatomb scan and all of the videocasts that mashpodder downloads should show up on your PS3 menu. Provided that they are the correct format. Check that out beforehand. Most videocasts these days are in the mp4 format(.mp4/.m4v) . The Mediatomb scan needs to be a recursive scan to get the subfolders.

I”ll be redoing this whole series probably within the year. This is a trial run that is working out pretty good.

Part 4 will cover cron. Every night I’ll be auto downloading videocasts and auto deleting old videocasts. Automation… dig it!

Update: Field 3 in the mp.conf file doesn’t always work as advertised. I just added a new videocast and gave it a 3 in field 3 and it only fetched 1 episode. I should have gotten 3 of them. Oh well. I do know that it will stay up to date though.