February 27, 2010, 06:25:53 am
News:
Pages: [1]
Print
Author Topic: RSS feed creator  (Read 1930 times)
bagster
Sr. Member
****
Posts: 259


View Profile
« on: November 19, 2007, 04:31:45 pm »

Hi.  I started a script to make rss feed of what I record on my OSD.  I think you may find it useful, so if you want to beta test it, just copy this in a file in the same directory as your .mp4, change some settings to reflect your config, and enjoy!  Your lighttd config must have access to your media content.  This is really a very basic alpha version, if people like it I may make a binary for it, and maybe a UI for it (list rss feeds on the OSD menu, and when you make a new recording, you can choose in which feed you want to publish it).  In this version, I run it manually, but if you want it to run once (or twice) a day, just change the botton section and put it in a loop.  Here is the code:
=====================================

#!/bin/sh
#
# Script to generate RSS feed of all movies in a specific folder
# If you want many feed, seperate recordings in different folders.
# TODO: Parse movies names and make different feeds with them
#       Expire old movies if they have been feeded
#       Create multiple feeds in the same folder, based on filename
#
# Yves Pelletier (pelletiy @ gmail . com)
# bagster in Neuros forums
#

# We set some values to make the podcast more clean
FILENAME="osdrss.xml"
# Podcast section
PODTITLE="Default folder on my OSD"
PODDESCRIPTION="There are the defaults recordings of my OSD, like on-the-fly recordings"
PODLINK="http://10.10.10.130/USB/"
PODSUBTILE="OSD defaults recordings"
# Episode section (items)
TITLE="Will be generated later"
LINK="http://generate.a.link.if.you.want"
GUID="http://10.10.10.130/USB/"
DESC="Welcome to the new recordings of the OSD"
ENCLO="http://10.10.10.130/USB/"
CATEGORY="podcast"
PUBDATE=`date`

header () {
#this function create the xml header
cat > $FILENAME << EOF
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>$PODTITLE</title>
    <description>$PODDESCRIPTION</description>
    <link>$PODLINK</link>
    <language>en-us</language>
    <copyright>Copyright 2007</copyright>
    <lastBuildDate>Sat, 25 Mar 2006 11:30:00 -0500</lastBuildDate>
    <pubDate>$PUBDATE</pubDate>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <webMaster>root@root.com</webMaster>
EOF
}

bottom (){
cat >> $FILENAME << EOF
</channel>
</rss>
EOF
}

items () {
        # Search all .mp4 files in source path
        for files in `ls *.mp4` ; do
                echo Validating $files
                #fuser is different on OSX than on linux, skipping this on the dev part
                #if fuser -s $files ; then
                if [ 1 -lt 0 ] ; then
                        echo File $files in use, will add it in the next run
                else
                        # Add the file to the rss feed
                        DESC=`ls -al $files`
                        PUBDATE=`ls -al $files | cut -b 44-55`
                        fileuniq=`date +%m%d%H%M`
                        cat >> $FILENAME << EOF
<item>
<title>$files</title>
<link>$PODLINK</link>
<guid>${GUID}${files}</guid>
<description>$DESC </description>
<enclosure url="${ENCLO}${files}" length="11779397" type="video/mp4"/>
<category>Podcasts</category>
<pubDate>$PUBDATE</pubDate>
</item>
EOF
                fi;
        done;
}

header
items
bottom

exit 0
#==========================================================


if you want to run it permanently, start it in your rc.user, and change the bottom code for this:

while [ 1 ] ; do
header
items
bottom
sleep 86400
done

Please post comments. (please more comments than my OSD widget Wink)
Logged
bagster
Sr. Member
****
Posts: 259


View Profile
« Reply #1 on: November 19, 2007, 04:36:54 pm »

I forgot to tell the purpose of this script  Undecided

I have an appleTV, and I was looking to a simple way to add shows recorded with the OSD to it.
So my itunes on my Mac is  subscribed to this podcast.
The shows are transferred to my mac, and I can watch them in itunes or on my appleTV (or sync them to my ipod touch, but I don't have a apple touch at the moment, so I can't test  )
Logged
illin_technology
Full Member
***
Posts: 170


View Profile
« Reply #2 on: November 20, 2007, 02:20:25 am »

This is great, I think this feature (once fleshed out and smoothly implemented) could really heighten interest in the OSD.  Easy iTunes/iPod/podcast aggregator compatibility.

Any other developers interested in this?  Neuros team members?

Myself, I don't know how to use this script, I'm an end user.  With step by step instructions I could figure it out, but, I wouldn't know what to do without someone helping my hand.
Logged
bagster
Sr. Member
****
Posts: 259


View Profile
« Reply #3 on: November 20, 2007, 09:11:58 am »

I'll try to explain step by step how to do it.
You have to get a way to copy a file on the OSD.
You can copy/paste is in a telnet session, or copy it in a samba share.
Name the file osdrss.sh, and, in a telnet session, do this command:
chmod +x osdrss.sh
Now, if the script is in the place where you have your .mp4, execute the script
./osdrss.sh
It will generate a .xml file.  This is the file you have to subscribe in iTunes.
Be sure your web server is working on the osd, and that you can copy the file on the OSD, and i'll help later.
Logged
rblanco
Jr. Member
**
Posts: 54


View Profile
« Reply #4 on: December 03, 2007, 01:16:22 am »

This is great, I think this feature (once fleshed out and smoothly implemented) could really heighten interest in the OSD.  Easy iTunes/iPod/podcast aggregator compatibility.

I would like to see something like this as a podcast aggregator also! 
How about it???

Thanks!


Logged
bagster
Sr. Member
****
Posts: 259


View Profile
« Reply #5 on: December 03, 2007, 09:59:40 am »

How do you want it?
Do you want just 1 podcast with everything you record?
Or 1 by schedule, or 1 by folder?
I can try to make it easier to use...
Logged
Pages: [1]
Print
Jump to: