Sign up here and you can log into the forum!

Mapping an Icon to Video Folder

General WDTVExt forum

Mapping an Icon to Video Folder   

Postby cchance » Sun Oct 10, 2010 10:00 am

Map Videos submenu directly to /Folders

Basically all my wife ever uses now that we got my NAS and the xmounts working is --videos -- local drives -- folders and its a bunch of clicks and annoying really.... with media center thing on to see the nas xmounts

is their a way or a plugin i can use that will remap /videos to the /folders

that way we wont have to deal with scrolling past all movies etc down to folders and navigating so deep?

Even if not remapping /videos maybe mapping a new top level button to the Folders directory (though not as elegant i suppose as having 2 menu items on top for videos)

If so i'd really be greatful

Thanks
cchance
n00b
 
Posts: 1
Joined: Thu Apr 22, 2010 6:12 pm

Re: Mapping an Icon to Video Folder   

Postby recliq » Sun Oct 10, 2010 12:22 pm

Have a look at the MediaFolder wdtvext plugin.
If you change
Code: Select all
Menu.Top["$$Video"]["$$Local Drives"]
to just
Code: Select all
Menu.Top["$$Video"]
it should be what you want. :mrgreen:

Also there is a thread somewhere here discussing menu manipulation...
­WDLXTV Project Maintainer
-:] If you like my contributions feel free to donate for a beer or a new flash drive. ...and always remember: RTFM! (README, FAQ, WIKI) [:-
User avatar
recliq
WDLXTV Team
 
Posts: 5513
Joined: Thu Apr 15, 2010 8:09 am
Location: Kiel, Germany

Re: Mapping an Icon to Video Folder   

Postby Gigaherx » Wed Oct 13, 2010 1:53 pm

Looking at your plugin:

/*
# meta-name="Media Folder"
# meta-desc="Menu shortcut to All Files"
# meta-author="recliq"
# meta-date="2010-06-24"
# meta-version="1.0.0"
# meta-type="wdtvext"
# meta-url="http://"
# meta-filename="MediaFolder.plugin.js"
*/

traceln("MediaFolder: Start loading MediaFolder plugin")

function MediaFolderPlugin(path) {
this.pluginInfo = new Object()
this.pluginInfo.name = "Media Folder"
this.pluginInfo.desc = "Menu shortcut to All Files"
this.pluginInfo.author = "recliq"
this.pluginInfo.date = "2010-06-24"
this.pluginInfo.version = "1.0.0"
this.pluginInfo.url = "http://"
this.pluginInfo.file = "MediaFolder.plugin.js"

this.rootPath = path
traceln("MediaFolder: base path is " + this.rootPath)
}

MediaFolderPlugin.prototype = new Plugin();
MediaFolderPlugin.prototype.constructor = MediaFolderPlugin;

MediaFolderPlugin.prototype.doBuildMenus = function() {
traceln("MediaFolder: [ doBuildMenus ]")
Menu.Top["$$Video"]["$$Local Drives"].handler = function() {
Menu.Top["$$Video"]["$$Local Drives"]["$$Folders"].handler()
}
Menu.Top["$$Video"]["$$Local Drives"].title = "Movies"
Menu.Top["$$Video"]["$$Local Drives"].image = Menu.Top["$$Video"]["$$Local Drives"]["$$Folders"].image
Menu.Top["$$Video"]["$$Local Drives"].focusedImage = Menu.Top["$$Video"]["$$Local Drives"]["$$Folders"].focusedImage
}

MediaFolderPlugin.instance = new MediaFolderPlugin(scriptPath)
Plugin.registerPlugin(MediaFolderPlugin.instance)
traceln("MediaFolder: End loading MediaFolder plugin")


Are you suggesting to replace Menu.Top["$$Video"]["$$Local Drives"] with Menu.Top["$$Video"] 7 times or at one specific place.

Other questions:
the way it is currently it opens USB2 folder - my films (on USB2) are one level deeper, so would love to adjust the link within the folder (OK - just seen that: http://forum.wdlxtv.com/viewtopic.php?f=46&t=954&hilit=MediaFolder&start=10#p7520 ... but possible to get behind the "USB2"?)
And then: this script brings the same "movie" icon (and short cut) up for music and photos,too - i have those on a NAS (at different places). Any chance you can help me adjusting the script to reflect that.

Thank you
WDTV Live (FW: 1.02.21 + b-rad 1.02.21-EXT3-Boot-Live-0.4.5.3 [non-flash] / PsychoTHC OSD mod v6.5.3 USB)
Currently playing around with moviesheets, UMSP and learning about GUI plugins for easier content access.
User avatar
Gigaherx
WDTVer
 
Posts: 26
Joined: Fri Sep 10, 2010 2:40 am
Location: Berlin

Re: Mapping an Icon to Video Folder   

Postby recliq » Thu Oct 14, 2010 9:16 am

To simply replace "Video" with "Folders" try this
Code: Select all
traceln("MediaFolder: Start loading MediaFolder plugin")

function MediaFolderPlugin(path) {
  this.rootPath = path
  traceln("MediaFolder: base path is " + this.rootPath)
}

MediaFolderPlugin.prototype = new Plugin();
MediaFolderPlugin.prototype.constructor = MediaFolderPlugin;

MediaFolderPlugin.prototype.doBuildMenus = function() {
  traceln("MediaFolder: [ doBuildMenus ]")
  Menu.Top["$$Video"].handler = function() {
    Menu.Top["$$Video"]["$$Local Drives"]["$$Folders"].handler()
  }
}

MediaFolderPlugin.instance = new MediaFolderPlugin(scriptPath)
Plugin.registerPlugin(MediaFolderPlugin.instance)
traceln("MediaFolder: End loading MediaFolder plugin")


The other three lines demonstrate how to change the title and the images of a menu item. Instead referencing the icon of an existing menu item (that's what is done in the script) you can also supply your own images like this (absolute path to image needed):
Code: Select all
Menu.Top["$$Video"].image = "/tmp/media/usb/USB1/xxx-xxx-xxx-xxx/myImage.jpg"
Menu.Top["$$Video"].focusedImage = this.rootPath + "myFocusedImage.jpg"

You can do the same for any other menu item...

As for the second question, what is so difficult to understand in my answer you linked?
It's not possible to link menu item with any actual folder on usb drive.
­WDLXTV Project Maintainer
-:] If you like my contributions feel free to donate for a beer or a new flash drive. ...and always remember: RTFM! (README, FAQ, WIKI) [:-
User avatar
recliq
WDLXTV Team
 
Posts: 5513
Joined: Thu Apr 15, 2010 8:09 am
Location: Kiel, Germany

Re: Mapping an Icon to Video Folder   

Postby Gigaherx » Fri Oct 15, 2010 9:07 am

Thanx relicq

will play around tonight, but leaving my "baby" for business trip tomorrow

I have seen your previous comment on linking to folders after posting, so that was an edit. My thought was that within the main "standard" menue you can choose which USB drive before entering the folder structure, with the script I see the USB drive with in the folder menu. Again: if not possible - this is certainly acceptable. I will also look if (in my case for music / photos) there are some tricks when mounting that.

Really like the option shown to use own image - thanx for showing me that
WDTV Live (FW: 1.02.21 + b-rad 1.02.21-EXT3-Boot-Live-0.4.5.3 [non-flash] / PsychoTHC OSD mod v6.5.3 USB)
Currently playing around with moviesheets, UMSP and learning about GUI plugins for easier content access.
User avatar
Gigaherx
WDTVer
 
Posts: 26
Joined: Fri Sep 10, 2010 2:40 am
Location: Berlin

Re: Mapping an Icon to Video Folder   

Postby Gigaherx » Mon Oct 18, 2010 12:37 am

Getting there:
- managed to get behind the USB2 when showing folders,
- moved Shoutcast & YouTube on Menu Lvl.1
- replaced video icon with "my own"

When I started playing around with mounting NAS drives (to achieve something similar for Photos/Music on NAS) I realized that network shares are not working anymore - you already supporting me on this in a different thread. So I need to sort that out before continuing here.
WDTV Live (FW: 1.02.21 + b-rad 1.02.21-EXT3-Boot-Live-0.4.5.3 [non-flash] / PsychoTHC OSD mod v6.5.3 USB)
Currently playing around with moviesheets, UMSP and learning about GUI plugins for easier content access.
User avatar
Gigaherx
WDTVer
 
Posts: 26
Joined: Fri Sep 10, 2010 2:40 am
Location: Berlin

Re: Mapping an Icon to Video Folder   

Postby Markster » Fri Oct 22, 2010 9:56 am

I have a similar request that I hope somone can help with. I want to keep the Video menu logic intact, but move it away from being the default choice.

Instead, I want the default choice to be my own menu. I know that due to DMAOSD hard-coding, you can't change the default away from the $$Video menu.

So, what I want to do is:

1. Create a new menu
2. Copy the $$Video menu and all its children to the new menu (including images, etc.)
3. Rename the existing $$Video to "look" like my own menu, including images, etc.

I wrote the following code to do this and the only problem is that both menu's are acting the same now. The old menu acts\looks like a new menu which is good, but the new menu does not act like the "Old" $$Video menu. It is behaving like they are sharing the same handler?


Here is the code snippet:

// Lets create a new menu item - this will be renamed to look like the current Video menu
var topMenu = new Menu("Movies", "$$Video", "image/home_all_plus_icon_n.png", "image/home_all_plus_icon_f.png", true);
Menu.Top.addChild(topMenu);
Menu.Top.Movies.handler = function(){
Menu.Top["$$Video"].handler(); // This should define the Movie Handler to point to the same function as the Vide Handler does (default one) - i.e. copied\not shared
};
Menu.Top.Movies.image = Menu.Top["$$Video"].image
Menu.Top.Movies.focusedImage = Menu.Top["$$Video"].focusedImage

// Change existing Video menu to look\behave like our new one
Menu.Top["$$Video"].handler = function(){
Menu.Top["$$Video"]["$$Local Drives"]["$$Folders"].handler() // This should change the Video Handler to now be something new
};
Menu.Top["$$Video"].title = "MovieSheets+";
Menu.Top["$$Video"].image = "image/home_all_plus_icon_n.png";
Menu.Top["$$Video"].focusedImage = "image/home_all_plus_icon_f.png";
If you enjoy MovieSheets+, please donate toward the next version.
For specific versions and FAQ's, visit the MovieSheets+ website link
User avatar
Markster
DLX'er
 
Posts: 169
Joined: Sun Oct 17, 2010 9:45 pm

Re: Mapping an Icon to Video Folder   

Postby b1scu1t » Sun Oct 24, 2010 4:14 pm

In follow up to this question, is it possible for me to Map a folder to a Samba Share? For instance TV points to -> user@pw://192.168.1.35/TV

Thanks,
b1scu1t
b1scu1t
WDTVer
 
Posts: 27
Joined: Sun Jun 13, 2010 5:43 am

Re: Mapping an Icon to Video Folder   

Postby kiefermat » Mon Oct 25, 2010 11:29 am

Hi Markster,

I think there are two problems:
1) As far as I have experienced a menu entry which itself is menu with children does not have a handler. So what you would have to do is copy all child menu entries of the $$Video menu to the new menu and set the handler to null.
2) You don't copy the handler but rather you define a new function which when called calls the handler of the $$Video menu which is of course now the new one.

BTW, maybe it helps you. What I did is to map the handler of the $$Video menu to the folder like you did. But I added code to change it back to default when I press the option key on the remote. See code below:
Code: Select all
   
    traceln("Start loading CustomMenu Plugin");
   
    function CustomMenu(path) {   
      traceln("CustomMenu Plugin Constructor")
        this.rootPath = path;
         
      this.debug = new Debug();
      this.debug.Enable = true;
      this.debug.Level = 1;
      this.debug.Prefix = "CustomMenu: ";
    }
   
    CustomMenu.prototype = new Plugin();
    CustomMenu.prototype.constructor = CustomMenu;

    CustomMenu.prototype.doBuildMenus = function()    {
      this.debug.Log("doBuildMenus",1);
   
      this.advancedMode = true;         
      this.toggleMode();
      
      this.Debug.Log("finished doBuildMenus called", 1);
    }
   
   CustomMenu.prototype.toggleMode = function()   {
      this.debug.Log("toggleMode begin",1);
      if(this.advancedMode == true)
      {      
         this.debug.Log("switch to easy mode",1);         
         this.advancedMode = false;
         
         Menu.Top["$$Video"].handler = function ()
         {
            Menu.Top["$$Video"]["$$Local Drives"]["$$USB1"].handler();
         }
         Menu.Top["$$Photos"].handler = function ()
         {
            Menu.Top["$$Photos"]["$$Local Drives"]["$$USB1"].handler();
         }
         Menu.Top["$$Music"].handler = function ()
         {
            Menu.Top["$$Music"]["$$Local Drives"]["$$USB1"].handler();
         }
      }
      else
      {
         this.debug.Log("switch to advanced mode",1);
                  
         this.advancedMode = true;
         Menu.Top["$$Video"].handler = null;
         Menu.Top["$$Music"].handler = null;
         Menu.Top["$$Photos"].handler = null;         
      }
      
      page.redraw(true);
      this.debug.Log("toggleMode end",1);
   }
   
   CustomMenu.prototype.onPageKey =  function(page, key)
    {
      if(page.markupFileName == "villa_home.xml" && key == "23" && page.getParam("root_node_name") == "")
      {               
         this.toggleMode();
      }
   }
     
    // create our plugin with baseParg pointing to current script path
    // global variables scriptName, scriptLocation and scriptFullPath are available, no need to do the following
    CustomMenu.instance = new CustomMenu(scriptPath)

    // register our plugin with Ext
    Plugin.registerPlugin(CustomMenu.instance)
   
   traceln("Plugin.CustomMenu: End loading Example plugin");
kiefermat
n00b
 
Posts: 6
Joined: Mon Sep 27, 2010 10:57 pm

Re: Mapping an Icon to Video Folder   

Postby Markster » Mon Oct 25, 2010 1:54 pm

Kiefermat, thanks for taking the time to respond. Unfortunately I don't see a specific example in your response to my key question? What I want to do is map the existing Video menu directly to the folders handler. This is easy enough to do and it works fine.

The hard part is how do I create a NEW menu option that mimics the "old Video" handler menu flow. That way I can offer the old option if you want to use it, but also offer the faster "direct to folder" option.

Example Menu:

- MovieSheets+ icon: is really the old Video option with my own icon. It gets mapped directly to the folder (see my latest video under MovieSheets+ for an example)
- Video icon - is really a new menu option that mimics all of the original Video menu flow
If you enjoy MovieSheets+, please donate toward the next version.
For specific versions and FAQ's, visit the MovieSheets+ website link
User avatar
Markster
DLX'er
 
Posts: 169
Joined: Sun Oct 17, 2010 9:45 pm

Next

Return to WDTVExt discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron