Networked Media Tank
On-Demand network share mounting - Printable Version

+- Networked Media Tank (http://www.networkedmediatank.com)
+-- Forum: Community Jukebox, Themes, & UserApps Section (/forumdisplay.php?fid=106)
+--- Forum: 200/300/400 Series - Development and User Apps (/forumdisplay.php?fid=121)
+---- Forum: 100 Series - Development and User Apps (/forumdisplay.php?fid=33)
+---- Thread: On-Demand network share mounting (/showthread.php?tid=17494)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24


RE: On-Demand network share mounting - mar_tin - 02-22-2009 09:18 PM

Here is the relevant part of the setting.txt

Code:
servname3=Media
link3=smb://CUBESTATION/media
servlink3=smb://CUBESTATION/media&smb.user=martin&smb.passwd=******

Is it possible that the problem is that the share is password protected?

Edit: I quickly tried out with one of my non passworded share and it works.

Code:
mountFilesystemByPath
input: file:///opt/sybhttpd/localhost.drives/NETWORK_SHARE/Kiiratlan/Anime/Ghost in the Shell.mkv
mountFilesystemByName: Kiiratlan

urlencodeQuery: smb://MARTIN02/Kiiratlan&smb.user=&smb.passwd=
smb%3A%2F%2FMARTIN02%2FKiiratlan&smb.user=&smb.passwd=
performing mount: http://127.0.0.1:8883/smbclient.cgi?smb.cmd=mount&smb.opt=smb%3A%2F%2FMARTIN02%2FKiiratlan&smb.user=&smb.passwd=&smb.name=Kiiratlan
executeMono
/bin/mono.real '-single' 'file:///opt/sybhttpd/localhost.drives/NETWORK_SHARE/Kiiratlan/Anime/Ghost in the Shell.mkv' '-dram' '1'single



RE: On-Demand network share mounting - journey4712 - 02-22-2009 09:46 PM

looks like the problem is there a a link= line between servname and servlink. I can easily adjust the function to take care of this though. Passwords should work but i havn't tested that part locally, i'll see if i can set up a share with a password for that. Should have one more new version of mono.wrapper tonight Smile

journey4712


RE: On-Demand network share mounting - journey4712 - 02-22-2009 10:56 PM

Ok, i've tweaked the routine so it should properly match up the servname to the servlink no matter the order of /tmp/setting.txt. The new file is mono.wrapper-0.04.zip.

You can install this right over the old version, i've also updated the first post in the thread.

journey4712


RE: On-Demand network share mounting - excal - 02-23-2009 01:51 AM

Just tested it out with 2 test shares i made.... Seems to work perfect for me.

Installation went smooth, and no hiccups.

Tried it after a reboot, no problems there either.

Thanks for the awesome work man.
(btw, i used version 0.04 if it matters)


RE: On-Demand network share mounting - halfelite - 02-23-2009 02:14 AM

Great work. I will try this out tonight. Right now i have all my shares mapped at startup using start.sh


RE: On-Demand network share mounting - halfelite - 02-23-2009 04:28 AM

Ok i tried it. Doesnt seem to work. i have password protected shares also. I used version. mono.wrapper-0.04.zip.

Ok tried with no password protected share and no username. Still doesnt work. Looks like it doesnt work with LLink nothing is even showing up in mono.log.


RE: On-Demand network share mounting - halfelite - 02-23-2009 05:34 AM

this is my setting.txt
Code:
servlink1=smb://192.168.0.8/Movies&smb.user=xxx&smb.passwd=xxxx
link1=smb://192.168.0.8/Movies                                    
servname2=Anime                                                    
servname3=TV-Shows                                                
subtitle=eng                                                      
photo_transition=4                                                
servlink2=smb://192.168.0.8/Anime&smb.user=xxxx&smb.passwd=xxxx
link2=smb://192.168.0.8/Anime                                      
dhcp=0                                                            
eth_ipaddr=192.168.0.103                                          
eth_netmask=255.255.0.0                                            
ihome=0                                                            
smbserv=0                                                          
servname4=x264                                                    
link4=smb://192.168.0.8/x264                                      
servlink3=smb://192.168.0.8/TV-Shows&smb.user=xxxx&smb.passwd=xxx
link3=smb://192.168.0.8/TV-Shows                                    
volume=-20                                                          
mute=0                                                              
servlink4=smb://192.168.0.8/x264&smb.user=&smb.passwd=



RE: On-Demand network share mounting - journey4712 - 02-23-2009 05:39 AM

Hmm, if you dont have /tmp/mono.log then there is something else odd going on, sounds more like an installation issue. Even if the mono wrapper doesnt do anything it should still put a line in mono.log just saying that its going to start the regular mono.

try the command `ls -l /bin/mono` from telnet, it should say
Code:
lrwxrwxrwx 1 root root 4 Aug 25 14:31 /bin/mono -> /share/Apps/Mono.Wrapper/mono.php

If that isn't set properly, try running /share/Apps/Mono.Wrapper/init.sh and then check /bin/mono again. If init.sh works to set it up, but its not being automatically setup check that init.sh made it into /share/start_app.sh.


journey4712


RE: On-Demand network share mounting - garp99 - 02-23-2009 05:41 AM

Thanks for this Journey -- added to my "to test" list.

Something to think about...
It would be cool if I could send an http request to the PCH from my NAS and PC whenever they are shutdown or rebooted.

Right now I believe that the PCH has no knowledge of a NAS going into sleep mode or shutdown.
On my NAS, I would like to be able to let the PCH (2 of them) know that it is being shutdown, that way it can un-mount
the share if the NAS is the active one, or refuse if a movie is being played.
Once the NAS comes back on, it could send another call to broadcast that it's ready.

Same concept for shutdown of a PC, un-mount shares that are mounted on the PCH.

Why? I did a reboot of PCH-2 and the next time my kids were using PCH-1 and tried to access PCH-2 as a share or myihome service,
it just reported "Request could not be processed".
When I went to Network Browse, that's when I was forced to enter username and password for PCH-2.


RE: On-Demand network share mounting - halfelite - 02-23-2009 05:51 AM

(02-23-2009 05:39 AM)journey4712 Wrote:  Hmm, if you dont have /tmp/mono.log then there is something else odd going on, sounds more like an installation issue. Even if the mono wrapper doesnt do anything it should still put a line in mono.log just saying that its going to start the regular mono.

try the command `ls -l /bin/mono` from telnet, it should say
Code:
lrwxrwxrwx 1 root root 4 Aug 25 14:31 /bin/mono -> /share/Apps/Mono.Wrapper/mono.php

If that isn't set properly, try running /share/Apps/Mono.Wrapper/init.sh and then check /bin/mono again. If init.sh works to set it up, but its not being automatically setup check that init.sh made it into /share/start_app.sh.


journey4712

All of that checks out.
/tmp # ls -l /bin/mono
lrwxrwxrwx 1 root root 33 Feb 22 20:54 /bin/mono -> /share/Apps/Mono.Wrapper/mono.php

if i run echo "212" > /tmp/irkey. which i guess crashes mono. then it will make a log file to mono.log.

and i get

Code:
/tmp # cat /var/tmp/mono.log
single
mountFilesystemByPath: file:///opt/sybhttpd/localhost.drives/NETWORK_SHARE/Movies/Moviesfolder/Movie.avi
mountFilesystemByName: Movies
Movies already mounted
executeMono
/bin/mono.real 'single' 'file:///opt/sybhttpd/localhost.drives/NETWORK_SHARE/Movies/Moviesfolder/Movies.avi '-dram' '1'



RE: On-Demand network share mounting - journey4712 - 02-23-2009 06:24 AM

@garp
Hmm, should be possible to create something like that. The only thing i'm not sure of yet is how to inform the NMT that the share has been unmounted. It can easily be unmounted with the umount command, but then the next time you click on that disk in the source menu the NMT still thinks its mounted.

@halfelite
Ok, so clicking on a video link for a drive not mounted presents you with the file not found, a video link for a mounted drive works normally, but neither puts anything in your /tmp/mono.log. Echoing 212 into /tmp/irkey creates a mono.log, but then causes a segfault? is the segfault in the wrapper or in the real mono program(i suppose might not be able to tell)?, also what does echoing 212 into /tmp/irkey normally do, play button? What all makes it into mono.log when you do the echo, trying to figure out how far it got through the script.

Should be able to figure this out, i'm just not sure whats going on yet.

journey4712


RE: On-Demand network share mounting - halfelite - 02-23-2009 06:27 AM

(02-23-2009 06:24 AM)journey4712 Wrote:  Ok, so clicking on a video link for a drive not mounted presents you with the file not found, a video link for a mounted drive works normally, but neither puts anything in your /tmp/mono.log. Echoing 212 into /tmp/irkey creates a mono.log, but then causes a segfault? is the segfault in the wrapper or in the real mono program(i suppose might not be able to tell)?, also what does echoing 212 into /tmp/irkey normally do, play button? What all makes it into mono.log when you do the echo, trying to figure out how far it got through the script.

Should be able to figure this out, i'm just not sure whats going on yet.

journey4712

Just put whats in mono.log above your post. It looks like it logs. just not creating mono.log till mono closes and reopens.

And to tell the truth. I went searching why i wouldnt get a mono.log and found this thread.

http://www.networkedmediatank.com/showthread.php?tid=15809&pid=141742#pid141742

were it said mono.log wasnt there.


RE: On-Demand network share mounting - journey4712 - 02-23-2009 06:34 AM

Ok, so that log shows the program seems to think the share is already mounted, but then if the video isn't playing in mono then its obviously not mounted. I'll double check over that code and see what i can think of.


journey4712

EDIT: there also appears to be an odd part in your log, the file passed to mono has an additional -diety.avi after the regular filename, i'm a touch confused about how that got in there.

As to the log being created after mono closes, thats actually just the result of how i wrote the wrapper script, didn't occur to me that it would make a difference, but it does make sense. Basically while mono is running the mono.wrapper script is still running in the background, and then the vary last thing my script does before exiting is write out the log, as opposed to some progs which write to the log on every message.


RE: On-Demand network share mounting - halfelite - 02-23-2009 06:37 AM

(02-23-2009 06:34 AM)journey4712 Wrote:  Ok, so that log shows the program seems to think the share is already mounted, but then if the video isn't playing in mono then its obviously not mounted. I'll double check over that code and see what i can think of.


journey4712

EDIT: there also appears to be an odd part in your log, the file passed to mono has an additional -diety.avi after the regular filename, i'm a touch confused about how that got in there.

Sorry the diety.avi was part of the avi file name. messed the edit.

Since i dont get a mono.log would it be best if i tried to reload to factory settings or reflash the firmware.


RE: On-Demand network share mounting - journey4712 - 02-23-2009 06:44 AM

Well, actually the easiest way to get the log to write out might be to just test a simpler _log() function. If you open up mono.php almost at the top is the following
PHP Code:
function _log($msg) {
  static 
$output = array();

  if(
DEBUG) {
    if(
$msg === TRUE) {
      
file_put_contents(LOGimplode("\n"$output), FILE_APPEND);
      if(!
IS_NMT)
        echo 
implode("\n"$output);
    } else {
      
$output[] = $msg;
    }
  }
  return 
$msg;


just simplify that to
PHP Code:
function _log($msg) {
  
file_put_contents(LOG$msg."\n"FILE_APPEND);
  return 
$msg;


That should hopefully force the script to write out the log immediatly every time.

journey4712

EDIT: I took a browse over that thread you posted, its the same filename but unrelated to this. That thread is about the output from the mono program, in this thread mono.log is the output of my wrapper script.

EDIT2: I've had a chance to page through the mono.php code a bit, without the system writing log files probably not much to do. I'm not sure which would be better reset or reflash, if its not a big issue either would probably be a good test.