INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Automating Adding a New View  (Read 3031 times)

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Automating Adding a New View
« on: February 16, 2016, 12:01:01 pm »

I'd like to be able to add a new view to a Library using an external program.  Like "add saved view named TV_view.jvi under Video".

I see Core Command 25000 is Add_View_Scheme .  But it takes no arguments, so I'm not sure how it could be used.

I've read through some of the COM automation documents, and found the Scheme automation and View automation objects, but none of them seem to have a method or function for adding views.

Is this possible with an MC supported interface?

Brian.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Automating Adding a New View
« Reply #1 on: February 16, 2016, 01:57:28 pm »

I don't think so. Why?

I see Core Command 25000 is Add_View_Scheme .  But it takes no arguments, so I'm not sure how it could be used.

As I recently explained in another thread briefly, MCCs generally replicate things you can do in the real UI (so they emulate clicking on something, or pressing a keyboard combo). In some cases, they have parameters that allow "special" versions of what you can do in the UI (for example, a Silent Auto-Import Run) but they don't take "complex" parameters. The parameters allowed for these are always integers (no strings or other things like that), and are usually either booleans (something on/off) or "modes" (0,1,2,3,4,5 each do different things).

Adding a new view from scratch would obviously require pretty complex parameters.

I've read through some of the COM automation documents, and found the Scheme automation and View automation objects, but none of them seem to have a method or function for adding views.

The COM automation documentation on the Wiki isn't 100% complete (but you can browse the Object Tree in Visual Studio so this isn't a huge deal), but it covers most of it. That won't help you on a Mac though. For MC on Mac, you can use basically only MCWS. This however, lets you use pretty much everything except COM, since you can access MCCs and Command Line options through MCWS. It is a bit more fiddly to do things that require launching MC, because you can't access MCWS while MC is closed (but you could launch it first yourself in the script, wait for it to load, and then run your MCWS commands).

COM is deprecated and all new development is done using MCWS (and has been since before the Mac version launched).  In any case, I don't think you can add Views with it. If so, it would probably be complex.

That all said...

You can automate adding Smartlists, and could show these in a View by having a Playlist Group category, or search list, or something. What are you trying to accomplish?
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Automating Adding a New View
« Reply #2 on: February 16, 2016, 02:32:28 pm »

Ah, I see what you mean.  Some of these core commands are just like pressing a button in the UI.  I just ran 25000 and it brought up "add view" in the context of the parent tree I was in.  Makes sense.  Seems super hard to automate, and really not terribly useful, but it's logical.  :)

What am I trying to accomplish?  This isn't a very normal kind of thing for me to want to do.  The goal is to be able to build a set of views using an external program.  You might call the external program an MC customizer, in that it will build views based on selections from a user.  I had hoped there would be supported methods to do this and not to have to resort to trying to work directly on MC's library files.  That seems fraught with danger.

Brian.
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Automating Adding a New View
« Reply #3 on: February 16, 2016, 03:51:59 pm »

Trying to build a tool to tweak someone else's database by adding all your neat views and settings are you?

Perhaps a Windows/Mac scripting tool that has the ability to both run external programs (for MCC commands), and record keystrokes for playback from a script?

Then you record keystrokes while you create views, using only the keyboard because recording mouse clicks is unreliable in many cases where resolution etc. changes, combine the recorded script sections with MCC commands, and you have a solution. Well, maybe. Because maintaining such scripts can be a real pain.

I had similar issues when working with large software solutions, where the database needed to be set to a certain condition for presentations on a particular date. I needed purchase and work orders to be due on the day of the presentation, for example, for any day I presented. A certain amount could be done by importing data into the database, a certain amount by direct manipulation of the database bypassing the programs, and a certain amount needed human intervention, or scripts that run through the data to ensure internal consistency. No one method worked completely, but scripting came closest. However, it was just too much work to maintain the scripts as the software changed, or the scenario that had to be presented changed.

I never did find a perfect solution, but scripting may work pretty well for MC, since it is much simpler. Also, driving MC with its own functions and recorded keyboard actions makes much more sense than trying to directly manipulate the library.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Automating Adding a New View
« Reply #4 on: February 16, 2016, 11:03:24 pm »

Seems super hard to automate, and really not terribly useful, but it's logical.  :)

That particular function isn't well suited to automation, certainly.  The MCC system is extremely useful, but not every single one in there is extremely useful. For something like this, though, a MCC command isn't going to be useful. You'd need a Command Line or MCWS command that would let you import an XML file or something with a predefined View already completely specified.

I'd say your mission is probably a fools errand, without changes on JRiver's side.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Automating Adding a New View
« Reply #5 on: February 16, 2016, 11:22:23 pm »

I didn't mean to sound negative about MCC or anything... I definitely recognize that MCC and MCWS is extremely useful for automation in general.  I've used it for a couple of minor jobs, as well as mapped keys using MCC commands.

I'd hate to think it's a "fools errand", but I certainly agree that there doesn't seem to be a clear to path to doing what I'm after.  I would definitely have JVI files made up already.  It would be just a matter of saying "import this JVI and put it over here in this container, with this name."

This may not be possible at all.  Darn.  :(

Thank you as usual for sharing your knowledge and experience.  :)

Brian.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Automating Adding a New View
« Reply #6 on: February 16, 2016, 11:33:30 pm »

The JVIs don't let you specify tree-path do they? I should really investigate those more, but I haven't bothered really.

But, so many of my Views are based on the cascading filters in the View hierarchy, that without being able to save where in the path a particular view is supposed to fall, they won't be very useful.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Automating Adding a New View
« Reply #7 on: February 16, 2016, 11:44:18 pm »

The JVIs don't let you specify tree-path do they?

I don't understand the question, but I'll tell you what I know:  JVI's save everything that you put into the view itself:  View type, specifications, rules for included files, settings, etc.  They don't "remember" where they were in the Views tree... perhaps that was the question.

I would want to be able to specify, "put this view into the tree under Video (or Audio, etc)".

Brian.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: Automating Adding a New View
« Reply #8 on: February 17, 2016, 12:10:58 am »

if it helps, here's what I wrote about jvi files back in 2009. It's all applicable today, nothing has changed...
The saved library views system used by MC is too complicated imvho.

I notice from your screenshot that you are only seeing the "Empty View", when I would at least expect you to see the default "Genre, Year, & Rating" view as another option too. Generally, saved views do not show up in the "load a view" options because they've either been saved in a non-default location, or they list different media types than the parent view you're trying to add it to.

Here are some facts that may, or not, help:

  • When saving a view, the dialogue opens with the default "Save" directory already selected. There's also a "Browse" button there. If you use that, and save the view somewhere other than the default location, the view will not be available in the "Load View" options. If you wish to load the view at a later date, you must save it in the default location.
  • When a view is saved, the media types listed in that view are also recorded. The idea behind this is that by doing so, when you choose to add a view to the "Video" branch of the tree, the "Add library view" dialogue will only present you with thumbnails of views saved with videos in them. So, if you save a view from the video branch that contains video files and picture files, you will only be able to load this view as a child view of a view that also contains video and picture files. Similarly, if you save a view that contains audio and cover art, you will not be able to load that saved view as a child of a view that contains purely audio files and no album art. Hopefully, I'm explaining this well enough
  • No default actions are asigned to the .jvi file extension in Windows, so double clicking on one in Explorer will not work

I find all of the above far too tiresome and tend to do exactly as Lasse_Lus described and just drag and drop and copy. Then I open up the customise view dialogue and make any tweaks that are needed. Doing things this way, it's extremely easy to copy a view from one media type node to another, where for sure, initially, it may show zero files, but does not require much adjustment to get it working properly, and if there's not a good 'copy' candidate, I'll just start from scratch.

If anyone needs any help with the "customise view" dialogue, I posted a pretty comprehensive review of all the options on offer earlier this year, so, if you're not sure about anything, have a look at this and see if it helps.

-marko.
Pages: [1]   Go Up