Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
migmigmig
Visitor

How can I get the manifest file as an Associative Array?

I suppose I could "ReadAsciiFile( "pkg:/manifest" ) and parse it myself, but I'm hoping there's a better way.
0 Kudos
10 REPLIES 10
renojim
Community Streaming Expert

Re: How can I get the manifest file as an Associative Array?

I don't think there's any built-in way to do it. I've used this code for a similar purpose:
    manifest = ReadAsciiFile("pkg:/manifest")
lines = manifest.Tokenize(chr(10))
aa = {}
for each line in lines
entry = line.Tokenize("=")
aa.AddReplace(entry[0],entry[1])
end for
print aa

I'm sure there's a way to do it with regular expressions as well.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos

Re: How can I get the manifest file as an Associative Array?

"migmigmig" wrote:
I suppose I could "ReadAsciiFile( "pkg:/manifest" ) and parse it myself, but I'm hoping there's a better way.


Out of curiosity, why would you want to grab information from the manifest file? Is it to retrieve the version?
0 Kudos
migmigmig
Visitor

Re: How can I get the manifest file as an Associative Array?

I'm using the basic "video player" sample code as the basis for my Roku application.

I've expanded the included "categories.xml" from that sample code into "application.xml" and included the ability to specify the entirety of the theme object, the styles of the poster screens, default images if the feed has no images, cooked attributes to be able to specify feeds with params rather than urls, etc, in that xml file.

In the manifest file, I added an extra key for the url to that XML so it can be loaded from the internet as in the original example or directly from the package, depending upon the needs of my customer service teams who will use the eventual framework to create turnkey Roku (and multiple other set-top-box) applications for our customers.

I use the manifest file because it's the one file I will always know where to find. Conceivably, I could have put all of my application configuration variables in the manifest file, but the XML format is more advantageous for complex configuration than a simple ini-style key-value set, so I just use it to configure the url to the real configuration.
0 Kudos
dynamitemedia
Binge Watcher

Re: How can I get the manifest file as an Associative Array?

"migmigmig" wrote:
In the manifest file, I added an extra key for the url to that XML so it can be loaded from the internet as in the original example or directly from the package, depending upon the needs of my customer service teams who will use the eventual framework to create turnkey Roku (and multiple other set-top-box) applications for our customers.


i have done some of the theme work as well read from a xml file on my server so that we could make changes when needed, i think i see where you going with this. I can tell you that we have had some issues with the dreaded "retrieving" and i test on a 20 mb internet connection. if this is for your customers and not roku users, you can prob get away with explaining that to them. sounds interesting however
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
migmigmig
Visitor

Re: How can I get the manifest file as an Associative Array?

I work for a "big company" with lots of other big companies as customers.

The work I do is to create a framework system to make it easier for other semi-programmers and designers in customer-facing teams to quickly crank out mobile and set-top applications for our big company customers. Roku is one of many different client systems to which we are expanding our support.

I'm not sure what you mean by the "retrieving", however? We're aware that the internet is the internet and can be less quick than one might sometimes desire. Are you suggesting that the Roku hardware has more difficulties with the internet than on other connected devices?
0 Kudos
dynamitemedia
Binge Watcher

Re: How can I get the manifest file as an Associative Array?

no i think its a great device, the issue i had was more the fault of my server getting the response back to roku in time.

the "retrieving" will happen if there is any delay, i am sure if your working with big companies then they paid more for there infrastructure and server than I have, LOL

sounds like a great project, good luck
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
guidamedia2
Visitor

Re: How can I get the manifest file as an Associative Array?

Is there a reason not to trim the values when building the array?

"renojim" wrote:
I don't think there's any built-in way to do it. I've used this code for a similar purpose:
    manifest = ReadAsciiFile("pkg:/manifest")
lines = manifest.Tokenize(chr(10))
aa = {}
for each line in lines
entry = line.Tokenize("=")
aa.AddReplace(entry[0],entry[1].Trim())
end for
print aa

I'm sure there's a way to do it with regular expressions as well.

-JT
0 Kudos
RokuJoel
Binge Watcher

Re: How can I get the manifest file as an Associative Array?

"migmigmig" wrote:
I'm using the basic "video player" sample code as the basis for my Roku application.

I've expanded the included "categories.xml" from that sample code into "application.xml" and included the ability to specify the entirety of the theme object, the styles of the poster screens, default images if the feed has no images, cooked attributes to be able to specify feeds with params rather than urls, etc, in that xml file.

In the manifest file, I added an extra key for the url to that XML so it can be loaded from the internet as in the original example or directly from the package, depending upon the needs of my customer service teams who will use the eventual framework to create turnkey Roku (and multiple other set-top-box) applications for our customers.

I use the manifest file because it's the one file I will always know where to find. Conceivably, I could have put all of my application configuration variables in the manifest file, but the XML format is more advantageous for complex configuration than a simple ini-style key-value set, so I just use it to configure the url to the real configuration.



Do yourself and us a favor and don't use the manifest file for anything other than the keys that we have listed for your use, we don't need to see any weird behavior caused by unusual items in the Manifest file, and have to spend hours tracking down why your channel fails in some unexpected way.

There is no reason why you can't create your own file that is "always in the same place". Further, I would suggest setting up your channels to check the internet by default for the xml and if there is no response, fail over to the local xml file. That way, you can control what happens remotely.

- Joel
0 Kudos
renojim
Community Streaming Expert

Re: How can I get the manifest file as an Associative Array?

"guidamedia2" wrote:
Is there a reason not to trim the values when building the array?

Text files often contain spaces at the end of a line. The trim function just gets rid of them if they're there. I wasn't using the code I posted to parse the manifest file, but a file I retrieved that had very similar structure.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.