Native XBMC RSS feed for new shows and movies

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
MDPauley Offline
Senior Member
Posts: 264
Joined: Mar 2004
Reputation: 0
Location: Centreville, Va
Post: #41
jabba_29 Wrote:Any ideas?

Thanks in advance..

J

Can we see your RssFeeds.xml file?
find quote
jabba_29 Offline
Member+
Posts: 278
Joined: Oct 2009
Reputation: 2
Location: Finland
Post: #42
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rssfeeds>
  <!--RSS feeds. To have multiple feeds, just add a feed to the set. You can also have multiple sets.-->
  <!--To use different sets in your skin, each must be called from skin with a unique id.-->
  <set id="1">
    <feed updateinterval="5">http://localhost:8080/rss.asp</feed>
<!-- <feed updateinterval="5">http://192.168.xxx.x/atv/atv.php</feed> -->
    <feed updateinterval="30">http://192.168.xxx.x/atv/rss.php</feed>
  </set>
</rssfeeds>
Thanks for the interest. I have tried several methods. localhost is on the XBMC, definitely 8080. Even tried the direct IP - same result.

The commented out feed is a php script that opens the rss.asp with curl.
Again, these work on my PC, but not on my XBMC.
I am using MiniMeedia skin for what it's worth.
find quote
craigey1 Offline
Junior Member
Posts: 40
Joined: Aug 2008
Reputation: 0
Post: #43
jabba_29 Wrote:I have used the code above (well modified a bit, but started with the original)

Can you post your modified code? I had problems on my xbox after modifying the code too much.
find quote
jabba_29 Offline
Member+
Posts: 278
Joined: Oct 2009
Reputation: 2
Location: Finland
Post: #44
Code:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Recently Added TV Shows</title>
<link>http://localhost:8080/rss.asp/</link>
<description>Newly added shows</description>
<language>en-us</language>

<%
var Response;
var setHeader;
var resetHeader;

setHeader = xbmcAPI("setresponseformat(webheader;false;webfooter;false;opentag;<tag>;closetag;</tag>;openRecord;<item>;closeRecord;</item>;openField;\n;closeField;\n;closefinaltag;false)");
Response  = xbmcAPI("QueryVideoDatabase(SELECT '\n<title>',strTitle,': ', C00,'</title>\n' FROM episodeview ORDER BY idEpisode DESC Limit 6)");
write(Response);
resetHeader = xbmcAPI("SetResponseFormat()");


%>
</channel>
</rss>
Obviously, changing the link makes no difference -
and I have taken out <description>
but this displays in readers on my PC no problems.
find quote
craigey1 Offline
Junior Member
Posts: 40
Joined: Aug 2008
Reputation: 0
Post: #45
I had the same issue when I removed the description. I found the description slowed down the script, so removed it & found that although I could still see the feed in IE. The xbox didn't display anything after the Newly added shows.

All I can suggest is adding the description back in & see if that works again. Perhaps you could just add a string such as "a" in the description tags, rather then grabing the data in the DB.
find quote
jabba_29 Offline
Member+
Posts: 278
Joined: Oct 2009
Reputation: 2
Location: Finland
Post: #46
Just to let you know the outcome. I have got this fixed - sort of.
I think that this was something to do with 'bom' perhaps and
unwanted characters being saved when I saved the
copy/paste for the first time.

The final code that I have on my XBMC is as follows, modified for my needs.
Note that this still only works remotely from another PC.

rss.asp
[HTML]<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://localhost:8080/" xmlnsBig Grinc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Recently Added TV Shows</title>
<link>http://localhost:8080/rss.asp</link>
<description>Newly added shows</description>
<language>en</language>
<%
var setHeader;
var Response;
var resetHeader;

setHeader = xbmcAPI("setresponseformat(webheader;false;webfooter;false;opentag;<tag>;closetag;</tag>;openRecord;<item>;closeRecord;</item>;openField;\n;closeField;\n;closefinaltag;false)");
Response = xbmcAPI("QueryVideoDatabase(SELECT '\n<title>',strTitle,' - \"', C00,'\"</title>\n<description>New episode</description>\n' FROM episodeview ORDER BY idEpisode DESC Limit 6)");
write(Response);
resetHeader = xbmcAPI("SetResponseFormat()");

%>
</channel>
</rss>[/HTML]

To get this to work, I then open the file with php on my PC's server with curl
and strip out most things and format to compliant RSS again.

Thought I would post it for prosperity,
hope it helps someone in the future:

rss.php

PHP Code:
<?php

$file 
'http://<ATV:IP>/rss.asp';

        
// create curl resource 
        
$ch curl_init(); 

        
// set url 
        
curl_setopt($chCURLOPT_URL$file); 

        
//return the transfer as a string 
        
curl_setopt($chCURLOPT_RETURNTRANSFER1); 

        
// $output contains the output string 
        
$output curl_exec($ch); 

        
// close curl resource to free up system resources 
        
curl_close($ch);

$s '<rss version="2.0"';
$e '</rss>';

$table_start strpos($output$s); 
$table_end   strpos($output$e) + strlen($e); 
$table_len   $table_end $table_start

$what  = array('</channel>','</rss>',"\n");
// purely source formating
$what2 = array(
    
'</title><description>',
    
'</description><title>',
    
'</item><item>',
    
'<item><title>',
    
'</description></item>'
);

$with  '';
$with2 = array(
    
"</title>\n<description>",
    
"</description>\n<title>",
    
"</item>\n<item>",
    
"<item>\n<title>",
    
"</description>\n</item>"
);

$pattern = array (
    
"/<rss [^>]*>(.*?)<\/language>/ims"'/\s\s+/',
    
"/<title [^>]*>(.*?)<\/title>/ims"'/\s\s+/',
    
"/<description [^>]*>(.*?)<\/description>/ims"'/\s\s+/' 
);
$change = array (
    
'',
    
htmlentities("\\1"),
    
htmlentities("\\1"
);
$table substr($output$table_start$table_len);
$table preg_replace($pattern$change$table); 
$table str_replace ($what,  $with,  $table);
$table str_replace ($what2$with2$table);
/*
*/
$channel_title 'Newly added TV Shows';
$channel_link  'http://<PC:IP>/';
$channel_desc  'TV Show recently added on ATV';

header('Content-Type: application/rss+xml; charset=utf-8');
echo 
'<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="'
$channel_link .'" xmlns:dc="http://purl.org/dc/elements/1.1/">'."\n";


echo 
'<channel>
 <title>'
$channel_title .'</title>
 <link>'
$channel_link .'</link>
 <description>'
$channel_desc .'</description>
 <language>en</language>'
."\n";
 
 
echo 
$table;

echo 
'
</channel>
</rss>'

Convoluted I know Smile
find quote
MDPauley Offline
Senior Member
Posts: 264
Joined: Mar 2004
Reputation: 0
Location: Centreville, Va
Post: #47
jabba_29 Wrote:rss.php

If you want to use php to create the feed there are much easier ways to do it.
1) Have php access the .db file directly
2) curl the httpapi directly from php (the main way create my feed).

I have sample code for the second option somewhere, I'll see if I can dig it up and share it...
find quote
jabba_29 Offline
Member+
Posts: 278
Joined: Oct 2009
Reputation: 2
Location: Finland
Post: #48
MPauley73 Wrote:If you want to use php to create the feed there are much easier ways to do it.
1) Have php access the .db file directly
2) curl the httpapi directly from php (the main way create my feed).

I have sample code for the second option somewhere, I'll see if I can dig it up and share it...
That would be great ... although this method will do for the time being...
find quote
>>X<< Offline
Alaska Group
Posts: 2,899
Joined: Jun 2009
Location: On a farm trying to catch a fox
Post: #49
I installed this today and had some problems basically only "kizer's" scripts worked which were minus movie year adding year the same as other scripts resulted in nothing again not sure if this is a problem with later builds or just windows who knows

Anyway had a look in my db with SQLite browser just to better understand things and now have a working script with what I want eg : movie (Year) and TVShowTitle (Season X - Episode X), just thought I'd add to the mix

Assumes port 80 is being used

RssFeeds.xml

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rssfeeds>
  <!-- RSS feeds. To have multiple feeds, just add a feed to the set. You can also have multiple sets.     !-->
  <!-- To use different sets in your skin, each must be called from skin with a unique id.                 !-->
  <set id="1">
    <feed updateinterval="30">http://localhost:80/movies.asp</feed>
    <feed updateinterval="30">http://localhost:80/tv.asp</feed>
  </set>
</rssfeeds>

movies.asp

Code:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Latest Added Movies</title>
<link>http://localhost:80/movies.asp/</link>
<description>This is my rss 2 feed for newest xbmc movies</description>
<language>en-us</language>

<%
var Response;
var setHeader;
var resetHeader;

setHeader = xbmcAPI("setresponseformat(webheader;false;webfooter;false;opentag;<tag>;closetag;</tag>;openRecord;<item>;closeRecord;</item>;openField;\n;closeField;\n;closefinaltag;false)");
Response = xbmcAPI("QueryVideoDatabase(select '<title>', C00, ' (', C07,')', '</title>' from movie ORDER BY idMovie DESC LIMIT 5)");
write(Response);
resetHeader = xbmcAPI("SetResponseFormat()");
%>
</channel>
</rss>

tv.asp

Code:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Latest Added TV</title>
<link>http://localhost:80/tv.asp/</link>
<description>This is my rss 2 feed for newest xbmc tv shows</description>
<language>en-us</language>

<%
var Response;
var setHeader;
var resetHeader;

setHeader = xbmcAPI("setresponseformat(webheader;false;webfooter;false;opentag;<tag>;closetag;</tag>;openRecord;<item>;closeRecord;</item>;openField;\n;closeField;\n;closefinaltag;false)");
Response = xbmcAPI("QueryVideoDatabase(SELECT '<title>',strTitle,': ', C00, ' (Season ', c12 , ' - Episode ', c13 ,')', '</title>', '<description>',c01,'</description>' FROM episodeview ORDER BY idEpisode DESC Limit 5)");
write(Response);
resetHeader = xbmcAPI("SetResponseFormat()");

%>
</channel>
</rss>
(This post was last modified: 2010-01-20 22:34 by >>X<<.)
find quote
Post Reply