View unanswered posts    View active topics

All times are UTC - 6 hours

Post new topic Reply to topic  [ 1 post ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Sat Jan 31, 2009 11:25 am 
Joined: Wed Mar 01, 2006 7:07 pm
Posts: 17
Location: Orlando, FL
I patched myth2ipod to start working again and have started using it again now that I have an iPhone. Now that I gave my young daughter my old nano I have come to realize I need to separate feeds. So I have broken them up by Recording Group. I am not a programmer, I just read through the code and looked up stuff through google to do what I needed to do. I basically append the recording group name to the generated xml file and then filter it on the subscription link.

First add an additional parameter to the user job, in this case Recording Group (%RECGROUP%)
/usr/local/bin/myth2ipod "%DIR%" "%FILE%" "%RECGROUP%"

Then in /usr/local/bin/myth2ipod around line 72, change the number of arguments.

sub Encode4Portable{
   if ($#ARGV != 2) {
      print "Encoding requires options.\nusage: myth2ipod <options> DIRECTORY FILE\n";

The next section down, add the new variable for the Recording Group ($recordinggroup = $ARGV[2])
I placed it right after $file = $ARGV[1]
# Get the show information
$directory = $ARGV[0];
$file = $ARGV[1];
$recordinggroup = $ARGV[2];
@file = split(/_/, $file);
   $chanid = $file[0];
   $start = substr $file[1],0,14;
   if($debug == 1){ print "$chanid\n$start\n"};
if (! -e $directory."/".$file){
   print "Opps, the file ".$directory.$file." does not exist.\n";

Near line 160 add the $recordinggroup to the file path.
# Create XML with <ITEM> tag for this video file
sub CreateItemXML {
      open(ITEM, ">$feedpath$chanid\_$start.$portable.$recordinggroup.xml");

This is the part that I skipped, I did it by hand. But this will make sure the feed.php file will be generated the next time (I think.)

Here is a link to an image to fix the image path Image

# Generate the RSS feed by combining the ITEM XML Files
sub GenerateRSSFeed {

   open(RSS, ">$feedfile");
      print RSS "<?php\n";
      print RSS "header(\"Content-Type: text/xml\");\n";
      print RSS "echo \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\"; ?>\n";
      print RSS "<rss xmlns:itunes=\"\" version=\"2.0\">\n";
      print RSS "<channel>\n";
      print RSS "<title>MythTV - <? if (\$_GET['title'] == \"\") { \$title = \"*\"; echo \"Recorded Programs for \".\$_GET['group']; }\n";
      print RSS "else { \$title = \$_GET['title']; echo str_replace(\"_\",\" \",\$_GET['title']); } ?> </title>\n";
      print RSS "<itunes:author>MythTV - myth2ipod</itunes:author>\n";
      print RSS "<link>".&encodeForXML($feedurl)."</link>\n";
      print RSS "<itunes:subtitle>Transcoded recording for your iPod Video.</itunes:subtitle>\n";
      print RSS "<itunes:summary>Myth TV Recorded Programs for the iPod v.1</itunes:summary>\n";
      print RSS "<description>Myth TV Recorded Programs for the iPod v.1</description>\n";
      print RSS "<itunes:owner>\n";
      print RSS "<itunes:name>MythTV</itunes:name>\n";
      print RSS "<itunes:email>mythtv\@localhost</itunes:email>\n";
      print RSS "</itunes:owner>\n";
      print RSS "<itunes:explicit>No</itunes:explicit>\n";
      print RSS "<language>en-us</language>\n";
      print RSS "<copyright>Copyright 2005.</copyright>\n";
      print RSS "<webMaster>mythtv\@localhost</webMaster>\n";
      print RSS "<itunes:image href=\"".&encodeForXML($feedurl)."mythipod_200.jpg\" />\n";
      print RSS "<itunes:category text=\"TV Shows\"></itunes:category>\n";
      print RSS "<category>TV Shows</category>\n";
      print RSS "<itunes:image href=\"".&encodeForXML($feedurl)."mythipod_200.jpg\"/>";
      print RSS "<image>";
      print RSS "<url>".&encodeForXML($feedurl)."mythipod_200.jpg</url>\n";
      print RSS "<title>MythTV 2 iPod</title>\n";
      print RSS "<link>".&encodeForXML($feedurl)."</link>\n";   
      print RSS "<width>200</width>\n";      
      print RSS "<height>200</height>\n";      
      print RSS "</image>\n";
      print RSS "<? foreach (glob(\$title\.\"*\.".$portable.".\".\$_GET['group']\.\".xml\") as \$file) {include \$file;} ?>\n";
      print RSS "</channel>\n";
      print RSS "</rss>\n";
   if($debug == 1){ print "I created a feed file, was I supposed to?\n"};

   return 0;

Now to edit the feed.php file, if it already exists.


Line 6 and 7
<title>MythTV - <? if ($_GET['title'] == "") { $title = "*"; echo "Recorded Programs for ".$_GET['group']; }
else { $title = $_GET['title']; echo str_replace("_"," ",$_GET['title']); } ?></title>

Add the passed parameter to the file call.
foreach (glob($title."*.ipod.".$_GET['group'].".xml") as $file) {
   include $file;

So now when you subscribe to your video feed in iTunes pass it the parameter for each recording group.
You can use the matching name from the xml files that are created in the ipodfeed directory.


I hope this helps someone. Thanks for watching!


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu