Author Topic: Need your feed-back on my own WDTV GUI ...  (Read 49722 times)

May 11, 2009, 08:06:50 AM
Reply #45

redindian

  • Hero Member

  • Offline
  • *****

  • 643
    • True Font Family - Any font, any website, any browser
Is it me or are there no attachments to AirSeb's last post?

EDIT: My bad, it's within an older release van Zorander. :-)
« Last Edit: May 11, 2009, 09:09:04 AM by redindian »

May 11, 2009, 09:13:14 AM
Reply #46

cionci

  • Full Member

  • Offline
  • ***

  • 106
Cionci,
Because on my current version (Network + NFS sharing ), I've got a mysql database to manage a 'media library' for my Movie Categories, Movies Favorites, and in the future the possibility to retrieve all the Movies of a director, or an actor. So I have to move the database to the WDTV sqlite3 db  ::).
so some work to adapt.
AirSeb
Thanks now it's clear, but in that manner you have to run a Mysql instance on another machine on the network ?
Have you tried to install Mysql from optware ?
mysql - 4.1.22-2 - Popular free SQL database system
Obviously you have to test performance and resources needed to run it.

May 11, 2009, 10:41:24 AM
Reply #47

AirSeb

  • Newbie

  • Offline
  • *

  • 33
Cionci,
Yes but, I have already played with the Sqlite3 DB that is already shipped by WD, and it's runing correctly for what I have to manage as data on a SQL motor. I used a mysql because I had already a mysql running in my system, but I will just create another DB near the WDTV.cas DB and it should be ok. Just to add PHP extension for Sqlite3 on the wdtv box.
The job I am running everytime I add new movies on my collection is running very quickly, so I think it could run in an effcient way on the Sqlite3 DB.
we will see.
AirSeb

May 11, 2009, 11:35:44 AM
Reply #48

redindian

  • Hero Member

  • Offline
  • *****

  • 643
    • True Font Family - Any font, any website, any browser
Hi AirSeb,

Got the basic /osd-php/ working now. Thanks for the info.

How do I read the current directory from PHP?

There is nothing in $_SERVER, $_ENV, getcwd() or even phpinfo() to use.

May 11, 2009, 11:39:48 AM
Reply #49

AirSeb

  • Newbie

  • Offline
  • *

  • 33
Hi redindian,
What do you mean by current directory ?
AirSeb

May 11, 2009, 11:42:06 AM
Reply #50

redindian

  • Hero Member

  • Offline
  • *****

  • 643
    • True Font Family - Any font, any website, any browser
I need the current path/directory to know what Movie the user is currently browsing so I can generate a custom GUI for this movie.

Or is there some other way to get this info in PHP?

May 11, 2009, 11:48:06 AM
Reply #51

AirSeb

  • Newbie

  • Offline
  • *

  • 33
redindian
Ah first good pb to solve, I tried to found this info in the log of the dmaosd binary but it updates this info in its log after showing the page so not the solution, same thing with reading in the memory stack of the dmaosd binary, anything to be used. That's why when I was upset, I finish to hack the IR remote controller, and I manage in my side the browsing of the file system to be synchronized with the osd (so to be in the right place in the file system where it is after several actions on the remote controller).
So there is here a first step to code to solve this pb of file sytem browsing.
but once you have this info, the more interersting begins with the graphical aspects ...
AirSeb

May 11, 2009, 11:52:02 AM
Reply #52

redindian

  • Hero Member

  • Offline
  • *****

  • 643
    • True Font Family - Any font, any website, any browser
Haha, you are actually hacking the IR so you know what folder the user has reached? Nice job! :-)

Ok, I'll wait for your release before wasting a lot of time on that. I thought it was much simpler, too bad.

May 11, 2009, 12:03:01 PM
Reply #53

AirSeb

  • Newbie

  • Offline
  • *

  • 33
redindian,
yes because I have spent more than two weeks to find something avoiding to hack the IR, but finding nothing even with C low level Ptrace instruction to read the osd stack memory. So that's why, I have finished to hack the IR to have complete the hand on how I will manage my GUI. So I have a binary launched on WDTV start that capture the remote controller actions and create two .txt file:
- path.txt, where i log all the different paths in wich the user is entered (it a dynamic file, everytime the user use the back command , I remove the last path of the file to always have almost the current directory in wich the user is. In the same time I keep the information in this file of the current directory in wich he is entered before its last enter).
- IR.txt that logs all the remote controller actions, and in fact each time the user use the enter command, I just replay the different actions on the remote controller between two enters to know in wich directory he is .
So you are right, not very interesting development to redo. so just wait a little, and you could use my code to adapt it to your needs.
In fact , some code to write before beginning to play with the GUI aspects.
AirSeb

May 11, 2009, 12:56:20 PM
Reply #54

redindian

  • Hero Member

  • Offline
  • *****

  • 643
    • True Font Family - Any font, any website, any browser
Impressive. I would think it should be much easier.

Maybe someone can make a wrapper that logs the last directory accessed within /tmp/media/.

If it is possible to create a FUSE filesystem that processes the file as PHP, surely it must be possible to log the file last accessed.

Or maybe create a hook somewhere else. I'm not familiar with that stuff, but somewhere along the line the WDTV has to access the directory on the network. And when it does there are going requests over the network adapter to request the contents of the directory. In case of CIFS/SMB the request contains the full directory path. It must be possible to somehow log that information.

Anyhow, big thumbs up for your solution! Can't wait to see dynamic GUI in action.

The reason I was trying something myself was that I was not going to use a database at all. But just use the simple XBMC info file to store information about the movie. This way my XBMC will be able to read the info too, as well as other media players.

For now I've added a RSS feed using PHP. It's fun to have this OSD with PHP working :-)

May 11, 2009, 01:14:47 PM
Reply #55

kaim

  • Jr. Member

  • Offline
  • **

  • 60
This is really interesting. WD TV on its way to be better than any HTPC!
Thank you for making this possible and I really hope that WD will take this chance and start some competitions for the best user-generated content - that would definitely be a win-win solution.

Keep it up!

May 11, 2009, 05:01:06 PM
Reply #56

elmarweber

  • Hero Member

  • Offline
  • *****

  • 500
    • WDTV Tools
Or maybe create a hook somewhere else. I'm not familiar with that stuff, but somewhere along the line the WDTV has to access the directory on the network. And when it does there are going requests over the network adapter to request the contents of the directory. In case of CIFS/SMB the request contains the full directory path. It must be possible to somehow log that information.

This is possible, but there is one caveat when wanting to use this to modify the OSD files on the fly:
According to our experiments the WDTV first accesses the OSD files and AFTER that reads the directory. So any modifications you do are not loaded from the OSD until it displays another folder. Currently the only way seems to be what AirSeb has done, but IMHO tracing the IR commands to calculate the OSD position can be unreliable, e.g. the OSD skips a page if you press the up/down button longer and you definitely have a problem in folders where the content changes from time to time (e.g. incoming torrent directory).
I'm currently looking in the heap memory of the dmaosd process. The currently accessed folder occurs at several locations. But I've not determined yet if it is there before the OSD files are loaded.

ciao,
elm

May 11, 2009, 10:55:52 PM
Reply #57

redindian

  • Hero Member

  • Offline
  • *****

  • 643
    • True Font Family - Any font, any website, any browser
Too bad it's that hard. Good to hear there might be other options left. Until then we'll have to use the IR hack then.

I've got a RSS feed and weather info on my main screen now. :-)

I think I'll work on it a little more and add a web interface so people can configure it. If it's any good I'll then release it as a plugin to Disc0's webserver.

May 12, 2009, 12:57:29 AM
Reply #58

AirSeb

  • Newbie

  • Offline
  • *

  • 33
elmarweber, redindian,
Hope you could find something avoiding to hack the IR. But I have tried to do this even sniff NFS exchanges to retrieve the path, but unsucessfull. There is no pb to retrieve the old path (in the log of the dmaosd, or in its memory stack), but the last path is updated after dmaosd is loading its xml files so I always have not the current path. Concerning the dmaosd stack memeory sniffing , you could find the information of it proprietary @@file_info_selected variable,but the way dmaosd is handling his memeory range make very difficult and very long to parse a huge range of memeory to retrieve this information.
So if you could something, will be very interesting to know how you could to do it.
AirSeb

May 12, 2009, 01:19:10 AM
Reply #59

elmarweber

  • Hero Member

  • Offline
  • *****

  • 500
    • WDTV Tools
Hi AirSeb,

Hope you could find something avoiding to hack the IR. But I have tried to do this even sniff NFS exchanges to retrieve the path, but unsucessfull. There is no pb to retrieve the old path (in the log of the dmaosd, or in its memory stack), but the last path is updated after dmaosd is loading its xml files so I always have not the current path.
thats sadly true, its in the wrong order. would be enough if someone at WD switches the two commands =)

Concerning the dmaosd stack memeory sniffing , you could find the information of it proprietary @@file_info_selected variable,but the way dmaosd is handling his memeory range make very difficult and very long to parse a huge range of memeory to retrieve this information.
So if you could something, will be very interesting to know how you could to do it
I've written a fuse overlay that dumps the heap and stack memory of dmaosd every time it reads the basic_browse.xml file (this is rather fast, just copying three MB of memory).
I then analyzed the memory dumps and found certain patterns in them. There are enough references to the opened directory. But the problem is to distinguish the current ones from old ones from old ones that are already freed, i.e. no longer referenced.
I was not able to perform some kind of reverse lookup on the strings so that I can determine the common pointer that always references the current directory. I'm currently trying to reduce the number of candidates by checking if the memory at the address was freed, but I'm not sure how and if that is possible.

I'll keep you posted.

ciao,
elm