Listing from CIFS (SMB)


(ilker Aktuna) #1

Hi,

I’d like to get a list of all files with m3u extension on my NAS storage and display the list on a Smart app.
How can I connect to cifs URI and get list of files in a specified path from my smart app ?

Would it be possible to list the files in a dropdown selection input ?

Thanks.


(Joshua Lyon (SharpTools.io Dashboard)) #2

Where do you ultimately plan on playing the files? (eg. with what media player?)


(ilker Aktuna) #3

I will play with my Sonos speakers and also Kodi app on Android device.
Why does it matter ?


(Patrick Stuart [@pstuart]) #4

yeah, not going to be possible with the current local hub action, would have to put up a webserver to return the list from an rest api call.


(Michael Hess) #5

I suppose you could do this with EG and the connector somehow? Have it create a VS for each item returned, then tear it down upon refresh or something? Probably thinking WAY outa the box on that one.


(ilker Aktuna) #6

ok. I can get the list from my web server (on the same server with CIFS share)
but how can get the output from web call ?
and how do I put it in a pull down selection list ?

thx.


(ilker Aktuna) #7

thx. but what is EG and VS ?


(Michael Hess) #8

Sorry was more asking Pat on that one as it was a random thought. Event Ghost, awesome but old bit of software for automating things, have to run on a windows PC that’s always on. I’ve used it to interface different HA stuff, but in this case, there is a connector to send and receive to ST, I’ve not used it though. VS is a virtual switch in ST.


(ilker Aktuna) #9

well I have a windows pc always on. (the CIFS share is on it in any case)
but why do I need a 3rd party software other than Web server ?
If CIFS is not reachable by smart app, then I can get the list via Web server and list as pstuart suggested.
But I don’t know how to get thelist and display in a selection box.

Any clue on that ?


(Michael Hess) #10

No idea here, I just come up with wild a** ideas, still no good at programming.


(Joshua Lyon (SharpTools.io Dashboard)) #11

The reason I asked is to better understand what the problem is. CIFS was your solution, but I wasn’t sure what the problem was or any other context.

I was also curious what media player you are using as some of them already have SmartApps that have more detailed control than others. For example, I wrote a Kodi integration with a set of custom commands that are constantly expanding.

It sounds like what you are looking for isn’t something that SmartThings offers out of the box… so you’ll either need to develop a SmartApp for it or better describe what you are trying to accomplish and perhaps there’s another approach to solving your problem.


For your question about creating a list in a SmartApp, I would encourage you to check out the inputs and Dynamic preferences sections of the SmartApp guide in the documentation:

http://docs.smartthings.com/en/latest/smartapp-developers-guide/preferences-and-settings.html#input


(ilker Aktuna) #12

Your app may help me and I could add Sonos to it as well. But it does not play files from any source, right ?

What I am trying to do :

I would like to get a list of all m3u files from my cifs server (I can also start a web server on it if cifs is not supported by ST apps)
Then I will put these files on a selection list and when the user selects, I want the CIFS URI to be sent to my Sonos speakers (and Kodi) to play.

What I don’t know :

I don’t know how to write a basic smart app to get a list of files from my cifs ( or http) server.
I don’t know how to put that list on a selection (preferably pull down)

What I know :

I know how to form the URI for Sonos speaker to play. (well at least I have something in my mind)

I have read info on the page you suggested about dynamic preferences.
I understand that this would work :

input(name: "sensorAction", type: "enum", title: "is", options: attributeValues(m3ulist))

But I don’t understand how I can form the “m3ulist” variable before displaying that input.
Any ideas or examples ?

Thanks.


(Joshua Lyon (SharpTools.io Dashboard)) #13

Was that comment about Sonos or Kodi? My Kodi SmartApp can trigger playing files on Kodi from any source that Kodi supports. Someone else might be able to chime in on the Sonos capabilities.

playFile("smb://NASaddress/path/to/file.m3u")

(ilker Aktuna) #14

I still could not find how to get a list of files from my cifs ( or http) server and put that list on a selection.

I’d appreciate any help/example usage…


(ilker Aktuna) #15

I’d appreciate any help about this.