uSirius - asx, mms, asf, feed, and caching questions

Post your TVersity Media Server questions and bug reports here

Moderators: mikepaul, ronenmiz, hroo772

uSirius - asx, mms, asf, feed, and caching questions

Postby jsm174 on Wed Dec 20, 2006 1:26 am

Hello.

I've written a small program to help stream Sirius satellite radio to my MP101. I'd like to release the application, but I really need to get some issues fixed first.

Basically behind the scenes, uSirius logs into Sirius, fetchs the channels, and generates RSS feeds. (I used the TVersity one as an example)

Inside the feed, it contains links back to my uSirius application. When a item is fetched, it redirects to the correct Sirius stream url. Here is an example of my xml:

Code: Select all
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">
- <channel>
  <title>uSirius Channel Feed</title>
  <link>http://http://192.168.1.101:811/feed?type=asx&r=1166594895</link>
  <guid>http://http://192.168.1.101:811/feed?type=asx&r=1166594895</guid>
  <description>English</description>
  <language>en-us</language>
- <item>
  <title>1 - SIRIUS Hits 1</title>
  <link>http://192.168.1.101:811/stream?channel=1&stream=siriushits1&genre=pop&category=music&type=asx&r=1166594895</link>
  <description>The songs at the top of the charts and the latest pop hits.</description>
  <media:content url="http://192.168.1.101:811/stream?channel=1&stream=siriushits1&genre=pop&category=music&type=asx&r=1166594895" type="video/x-ms-asf" medium="audio" />
  <language>English</language>
  <upnp:region>United States</upnp:region>
  </item>


I really wanted the feed to just contain urls as an mms link, but the embedded web server I'm using (GoAhead) gets totally crazy and pretty much locks the machine up if something other than an HTTP request hits it.

Anyway, if I enter the url of the stream as an Audio URL in TVersity, I have no problems. Everything works as expected. If I try to use the XML feed, since they're not mms links, TVersity tries to fetch each one, one by one. What's also weird is that it fetchs the feed more than once as well.

Here are my logs:

Code: Select all
01:15:45 - Incoming request for uSirius Channel Feed
01:15:45 - Incoming request completed.
01:15:45 - Incoming request for uSirius Channel Feed
01:15:45 - Incoming request completed.
01:15:45 - Incoming request for uSirius Channel Feed
01:15:45 - Incoming request completed.
01:15:45 - Incoming request for uSirius Channel Feed
01:15:45 - Incoming request completed.
01:15:45 - Incoming request for asx
01:15:45 - 1 - SIRIUS Hits 1: The songs at the top of the charts and the latest pop hits.
01:15:46 - Incoming request for asx
01:15:46 - 2 - StarLite: Contemporary lite songs from the brightest stars in pop music.
01:15:48 - Incoming request for asx
01:15:48 - 3 - SIRIUS Love: Romantic ballads and soft pop music, featuring lyrics of love.
01:15:50 - Incoming request for asx
01:15:50 - 4 - Movin' Easy: Soft and easy favorites all day and all night.
01:15:51 - Incoming request for asx
01:15:51 - 5 - SIRIUS Gold: The roots of rock  roll, from the late '50s and early '60s.
01:15:53 - Incoming request for asx
01:15:53 - 6 - '60s Vibrations: Relive the musical revolution of the '60s and early '70s.
01:15:55 - Incoming request for asx
01:15:55 - 7 - Totally '70s: The most popular music from the '70s.
01:15:57 - Incoming request for asx
01:15:57 - 8 - Big '80s: The defining hit music of the '80s.
01:15:58 - Incoming request for asx
01:15:58 - 9 - The Pulse: From pop to rock, this is the '90s  Now.


Normally, I wouldn't care that it's trying to fetch each URL, but in this situation I really do. Behind the scenes I'm connecting to Sirius, playing with cookies, etc. I really want to access their site as least as possible.

Finally, I think TVersity seems to cache the transcoding. If I play the same channel again, it will be what I heard before. Is there some option in the feed I can use to force the url not to cache?

Sorry for all the questions. I'd appreciate any help I can get. I'm so close to being finished.

TVersity certainly has breathed new life into my MP101.

Thanks,
-- Jason
jsm174
 
Posts: 48
Joined: Wed Dec 20, 2006 12:49 am

Postby ronenmiz on Wed Dec 20, 2006 5:09 pm

Sounds like a great solution, I realy hope it work sout!

TVersity is trying to determine what format is the stuff inside the asx and hence it is doing all that. Is the ASX URL coming from Sirius or from you?
TVersity will not try to check what is the format if the URL has a file extension that is indicative of a format (e.g. .mp3 or .wma). Otherwise it wil fetch the header of the URL and try to check the HTTP mime type or the actual file. This latter case involves several HTTP get requests with ranges, could this be the issue? I hope the information here will help you overcome those issues.

Regarding caching, it is only done if the media is believed to be non live. I am wondering what is causing it to think it is not live and of finite size. This is the key to resolve this issue, since right now we do not offer any other solution. Of-course since you know the URLs, you can always look in the cache area and delete old files... The file names are based on a simple mapping of URLs to legal file names. I can share the logic if you think it may help.
ronenmiz
Site Admin
 
Posts: 8615
Joined: Mon May 02, 2005 2:43 pm

Postby jsm174 on Wed Dec 20, 2006 6:13 pm

Thanks!

After going through all the different scenarios, I decided to allow the user to select which feed they want.

If the user chooses the ASX feed, what is returned is the ASX file returned by Sirius. If they choose the ASF or MMS urls, I just do a HTTP 1.0 302 with a location of that URL.

So you're saying that if my content url is includes the extension, it would not have to try to fetch it?

currently:

Code: Select all
http://192.168.1.101:811/stream?channel=1&stream=siriushits1&genre=pop&category=music&type=asx&r=1166594895



should be?

Code: Select all
http://192.168.1.101:811/stream.asx?channel=1&stream=siriushits1&genre=pop&category=music&type=asx&r=1166594895

(In this case I return: [from memory]

<ASX version="3.0">
<ref="http://..."/>
<ref="mms://..."/>
</ASX>
)

Code: Select all
http://192.168.1.101:811/stream.asf?channel=1&stream=siriushits1&genre=pop&category=music&type=asf&r=1166594895

(In this case I return:

HTTP/1.0 302 Redirect
Pragma: no-cache
Cache-control: no-cache
Location: http://blah.blah.blah
Cookie: blah blah blah
)


since mms isn't a file type, I'm confused about that one.

Code: Select all
http://192.168.1.101:811/stream.mms?channel=1&stream=siriushits1&genre=pop&category=music&type=mms&r=1166594895

(In this case I return:

HTTP/1.0 302 Redirect
Pragma: no-cache
Cache-control: no-cache
Location: mms://blah.blah.blah
Cookie: blah blah blah
)


I really wish GoAhead wouldn't go crazy when hit with an mms url. But I'm not sure what else to use for an Open Source C/C++ based web server.


Thanks again!
-- Jason
jsm174
 
Posts: 48
Joined: Wed Dec 20, 2006 12:49 am

Postby ronenmiz on Wed Dec 20, 2006 6:39 pm

In the MMS case, the file extension should be wma. In the ASX case, asx is fine yes.
ronenmiz
Site Admin
 
Posts: 8615
Joined: Mon May 02, 2005 2:43 pm

Postby willie321 on Wed Dec 20, 2006 8:04 pm

Hey jsm,

As a fellow mp101 user I am always looking for ways to improve my unit. As a dual Sirius and XM subscriber who is too lazy to take the units out of the car and put them in the home docks, I would enjoy trying your app. Currently I restream Sirius via Windows Media Encoder, which sucks the life out of my CPU even with 1.2 gigs of memory. If you need a tester count me in!
willie321
 
Posts: 54
Joined: Wed Mar 08, 2006 9:35 pm

Postby jsm174 on Wed Dec 20, 2006 8:33 pm

willie321,

Definitely! Hopefully we'll have this thing figured out soon. It's much more enjoyable if it uses the feeds rather than urls for each channel.

Ronenmiz,

In firefox, if I type

http://192.168.1.101:811/stream.wma?cha ... 1166662073

Now I get the redirect, but also a question to save the stream to disk.

TVersity is still trying to go out and fetch the URLs:

Code: Select all
20:33:39 - Incoming request for uSirius Channel Feed
20:33:39 - Incoming request completed.
20:33:39 - Incoming MMS request for SIRIUS Hits 1, channel 1
20:33:40 - Incoming request completed.
20:33:40 - Incoming MMS request for SIRIUS Hits 1, channel 1
20:33:40 - Incoming request completed.
20:33:40 - Incoming MMS request for StarLite, channel 2
20:33:41 - Incoming request completed.
20:33:41 - Incoming MMS request for StarLite, channel 2
20:33:42 - Incoming request completed.
20:33:42 - Incoming MMS request for SIRIUS Love, channel 3
20:33:42 - Incoming request completed.
20:33:42 - Incoming MMS request for Movin' Easy, channel 4
20:33:43 - Incoming request completed.
20:33:43 - Incoming MMS request for SIRIUS Gold, channel 5
20:33:44 - Incoming request completed.
jsm174
 
Posts: 48
Joined: Wed Dec 20, 2006 12:49 am

Postby jsm174 on Thu Dec 21, 2006 6:31 pm

willie321,

If your interested in running a Beta, send me an email (jsm174@gmail.com), and I'll tell you where to get it.

Thanks alot!
-- Jason
jsm174
 
Posts: 48
Joined: Wed Dec 20, 2006 12:49 am

Postby jsm174 on Thu Dec 21, 2006 11:18 pm

If anyone is interested in trying out uSirius with TVersity and an MP101 (or any other media player for that matter), you can download the beta here:

http://www.millardsoftware.com/usirius/uSiriusv10BETA_setup.zip

The README is far from complete. I should complete it sometime over the holiday.

I'm hoping Santa brings me a Roku Soundbridge Radio to test this out with.

uSirius is still having caching issues with TVersity. And the mms feeds are the only way TVersity won't try to access Sirius site for each channel in the feed.

Please email me with any comments or questions.

Thanks,
-- Jason
jsm174
 
Posts: 48
Joined: Wed Dec 20, 2006 12:49 am

Postby willie321 on Fri Dec 22, 2006 5:57 am

Jason,

So far so good...Thanks!
willie321
 
Posts: 54
Joined: Wed Mar 08, 2006 9:35 pm

Postby ronenmiz on Fri Dec 22, 2006 12:40 pm

When you download it, it will go and get it so that it can serve it, but when you add the playlist it is not supposed to go and get the header anymore.
ronenmiz
Site Admin
 
Posts: 8615
Joined: Mon May 02, 2005 2:43 pm

Postby jsm174 on Fri Dec 22, 2006 1:26 pm

When you download it, it will go and get it so that it can serve it, but when you add the playlist it is not supposed to go and get the header anymore.


Sorry I'm just trying to figure out what we're talking about.

If I use any xml/rss feed that contains content-urls that start with "http://", TVersity accesses every <item></item> in the feed. I tried adding .wma, .asx, .asf. It just doesn't work.

So at the last minute I decided to put back in the xml/rss feed that contains content-urls that start with mms. I seem to handle them better now, and the MP101 works like a champ.

Here is my feed url:

Code: Select all
http://192.168.1.101/feeds/lineup.xml?type=mms&r=1166811347&genre=rock&category=music


Here is my feed rss/xml:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">
<channel>
  <title>uSirius Channels (MUSIC - Rock)</title>
  <link>http://192.168.1.101/feeds/lineup.xml?type=mms&amp;category=music&amp;genre=rock&amp;r=1166811396</link>
  <guid>http://192.168.1.101/feeds/lineup.xml?type=mms&amp;category=music&amp;genre=rock&amp;r=1166811396</guid>

  <description>English</description>
  <language>en-us</language>
  <item>
   <title>10 - The Who Channel             -- uSirius 1.0 BETA          </title>
   <link>mms://192.168.1.101/streams/stream?type=mms&amp;channel=10&amp;id=thebridge&amp;genre=rock&amp;category=music&amp;r=1166811396</link>

   <description>Five decades of maximum RB! It's the music of The Who, 24-7.</description>
   <media:content url="mms://192.168.1.101/streams/stream?type=mms&amp;channel=10&amp;id=thebridge&amp;genre=rock&amp;category=music&amp;r=1166811396" type="audio/x-ms-wma" medium="audio"/>
   <language>English</language>
   <upnp:region>United States</upnp:region>
  </item>
  <item>
   <title>14 - Classic Vinyl             -- uSirius 1.0 BETA          </title>

   <link>mms://192.168.1.101/streams/stream?type=mms&amp;channel=14&amp;id=classicvinyl&amp;genre=rock&amp;category=music&amp;r=1166811396</link>
   <description>The top tracks from classic rock's formative years.</description>
   <media:content url="mms://192.168.1.101/streams/stream?type=mms&amp;channel=14&amp;id=classicvinyl&amp;genre=rock&amp;category=music&amp;r=1166811396" type="audio/x-ms-wma" medium="audio"/>
   <language>English</language>
   <upnp:region>United States</upnp:region>

  </item>
  <item>
   <title>15 - Classic Rewind             -- uSirius 1.0 BETA          </title>
   <link>mms://192.168.1.101/streams/stream?type=mms&amp;channel=15&amp;id=classicrewind&amp;genre=rock&amp;category=music&amp;r=1166811396</link>
   <description>Classic rock's 2nd generation, with songs from the late '70s onward.</description>

   <media:content url="mms://192.168.1.101/streams/stream?type=mms&amp;channel=15&amp;id=classicrewind&amp;genre=rock&amp;category=music&amp;r=1166811396" type="audio/x-ms-wma" medium="audio"/>
   <language>English</language>
   <upnp:region>United States</upnp:region>
  </item>



This kind of feed works great.

Here is an asf feed url:

Code: Select all
http://192.168.1.101/feeds/lineup.xml?type=asf&r=1166811347&genre=rock&category=music


Here is an asf feed xml/rss:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">
<channel>
  <title>uSirius Channels (MUSIC - Rock)</title>
  <link>http://192.168.1.101/feeds/lineup.xml?type=asf&amp;category=music&amp;genre=rock&amp;r=1166811591</link>
  <guid>http://192.168.1.101/feeds/lineup.xml?type=asf&amp;category=music&amp;genre=rock&amp;r=1166811591</guid>

  <description>English</description>
  <language>en-us</language>
  <item>
   <title>10 - The Who Channel             -- uSirius 1.0 BETA          </title>
   <link>http://192.168.1.101/streams/stream?type=asf&amp;channel=10&amp;id=thebridge&amp;genre=rock&amp;category=music&amp;r=1166811591</link>

   <description>Five decades of maximum RB! It's the music of The Who, 24-7.</description>
   <media:content url="http://192.168.1.101/streams/stream?type=asf&amp;channel=10&amp;id=thebridge&amp;genre=rock&amp;category=music&amp;r=1166811591" type="video/x-ms-asf" medium="audio"/>
   <language>English</language>
   <upnp:region>United States</upnp:region>
  </item>
  <item>
   <title>14 - Classic Vinyl             -- uSirius 1.0 BETA          </title>

   <link>http://192.168.1.101/streams/stream?type=asf&amp;channel=14&amp;id=classicvinyl&amp;genre=rock&amp;category=music&amp;r=1166811591</link>
   <description>The top tracks from classic rock's formative years.</description>
   <media:content url="http://192.168.1.101/streams/stream?type=asf&amp;channel=14&amp;id=classicvinyl&amp;genre=rock&amp;category=music&amp;r=1166811591" type="video/x-ms-asf" medium="audio"/>
   <language>English</language>
   <upnp:region>United States</upnp:region>

  </item>


When I add this feed to TVersity, it hits:

Code: Select all
http://192.168.1.101/streams/stream?type=asf&amp;channel=10&amp;id=thebridge&amp;genre=rock&amp;category=music&amp;r=1166811591

http://192.168.1.101/streams/stream?type=asf&amp;channel=14&amp;id=classicvinyl&amp;genre=rock&amp;category=music&amp;r=1166811591

http://192.168.1.101/streams/stream?type=asf&amp;channel=10&amp;id=thebridge&amp;genre=rock&amp;category=music&amp;r=1166811591


Maybe I check the user-agent or something, and if its TVersity I could return something different?


If you want maybe I can send you a video clip or something of what's going on.

I'd really like to figure out the caching thing though. If I play channel 20, hit stop, come back and play channel 20, it will just play what was saved to disc.

Thanks again,
-- Jason
jsm174
 
Posts: 48
Joined: Wed Dec 20, 2006 12:49 am

Postby ronenmiz on Fri Dec 22, 2006 4:34 pm

Come to think of it, you are right. TVersity checks the codec versions of WMA URLs and this involves reading the header. The idea is to identify WMA that is using for example the lossless codec and be able to transcode it for devices that cannot handle lossless WMA but not transcode WMA7/8/9 for devices that can handle it. With mms we do not do it and also with mms the caching issue should go away.

Regarding the cache, do you maybe return a finite size in the HTTP content length header? Kill this header.
ronenmiz
Site Admin
 
Posts: 8615
Joined: Mon May 02, 2005 2:43 pm

Postby jsm174 on Fri Dec 22, 2006 4:45 pm

On an ASX request, I'm really just returning the exact header and response that Sirius returns. I just switch the content type from text/html to video/ms-asf. In that situation, though, they do return a content-length for the asx 3.0 xml. It looks something like this:

Code: Select all
<ASX Version="3.0">

<entry>
<ref href="blahblah&mswmext=.asx"/>
<ref href="mms://blahblah&wmcache=0"/>
</entry>
<entryref href="blahblah"/>

</ASX>


As for when I do an asf or mms redirect, I just send back

Code: Select all
#define USIRIUS_HTTP_HEADER_STREAM_REDIRECT \
   "HTTP/1.0 302 Redirect\r\n" \
   "Pragma: no-cache\r\n" \
   "Cache-control: no-cache\r\n" \
   "Location: %s\r\n" \
   "Cookie: %s\r\n" \
   "\r\n"

As for the feed urls, I send back

#define USIRIUS_HTTP_HEADER_FEED \
   "HTTP/1.0 200 OK\r\n" \
   "Server: %s\r\n" \
   "Pragma: no-cache\r\n" \
   "Cache-control: no-cache\r\n" \
   "Content-Type: text/xml;charset=UTF-8\r\n" \
   "\r\n"



-- Jason
jsm174
 
Posts: 48
Joined: Wed Dec 20, 2006 12:49 am

Postby ronenmiz on Sat Dec 23, 2006 1:54 pm

This all looks good, so I guess Sirius is streaming their radio station such thay it looks non live to the receiver, or we have some bug... Not sure how to proceed though. We do not have a Serious subscription and cannot test these URLs.
ronenmiz
Site Admin
 
Posts: 8615
Joined: Mon May 02, 2005 2:43 pm

Postby willie321 on Sun Dec 24, 2006 3:01 pm

I've been testing for Jason for the past few days, and have been impressed by uSirius! I can now stream Sirius without a double transcode method. It sure saves my CPU for other tasks. Not to mention better sound quality.
willie321
 
Posts: 54
Joined: Wed Mar 08, 2006 9:35 pm

Next

Return to Technical Questions and Bugs

Who is online

Users browsing this forum: MSN [Bot] and 5 guests