Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 7

using the GetVolumeList()

How can you find the available USB drives available using the GetVolumeList()?
I noticed some flash drives need a path using "ext1" and some use "ext2". I think this depends on how the USB drive is formatted. I want to make sure I have the right URL path before I start playing the video on the USB drive.
Thanks
0 Kudos
6 Replies
Highlighted
Level 10

Re: using the GetVolumeList()

So use GetVolumeList(), don't guess. Just exclude the usual suspects (common:, pkg:, tmpSmiley Happy and whatever remains is external drive. Btw, i suspect with a USB hub more than 1 devices can be connected so you may get both ext1 and ext2 simultaneously
0 Kudos
Highlighted
Level 7

Re: using the GetVolumeList()

How do you use the GetVolumeList()?
I understand it's an object containing a list of available USB drives. How would I go about using brightscript to achieve this? I understand other languages such as PHP, but I'm having a hard time finding examples for brightscript. I've gone through the SDK examples but would like to find a simple "bare bones" example.
If I use a MAC OS Extended (Journaled) USB drive, I need to use ext2 but if the USB is formatted as MS-DOS (FAT) it only works using ext1. I wonder why that is...
0 Kudos
Highlighted
Level 10

Re: using the GetVolumeList()

BrightScript is a dialect of BASIC (like Visual Basic is). Learn it. Is not worse than PHP.

Something like this should do:
fs = createObject("roFileSystem")
usb_drive = invalid
for each vol in fs.getVolumeList():
if left(vol, 3) = "ext" then usb_drive = vol
end for
Level 7

Re: using the GetVolumeList()

Thanks!
These simple bare bones examples is what I was looking for. I would have never thought of creating an roFileSystem first. Everything else make complete sense.
Thanks again for your help.
0 Kudos
Highlighted
Level 9

Re: using the GetVolumeList()

Bookmark this: http://sdkdocs.roku.com/display/sdkdoc/ ... umentation
Then read it "all", and do searches there
A quick search for getvolumelist returns link to ifFileSystem page: http://sdkdocs.roku.com/display/sdkdoc/ifFileSystem
0 Kudos
Highlighted
Level 8

Re: using the GetVolumeList()

While this method failed for me it did get me to think on it more and what I didnt realize for some reason is that it needs to be done in a task component. 

So for anyone wondering how to access the usb or volumes available in general.

Create a task and call it from your scene, group or custom component with Brightscript.

m.volumeTask = m.top.FindNode("volumeList") ' to stop the task after it returns the data
m.volumeTask.control = "RUN"

Add the node to stop the task.

<volumeReader
id="volumeList"
control="STOP" />

And the for the task node itself...

sub init()
m.top.functionName = "getvolume"
end sub

sub getvolume()
fs = createObject("roFileSystem")
print fs.getVolumeList()
end sub

This in turn will return your roList as documented.

<Component: roList> =
(
    "cachefs:"
    "common:"
    "ext1:"
    "ext2:"
    "pkg:"
    "tmp:"
)

Maybe this help some people who had a misunderstanding such as myself.

0 Kudos