Multi-User Plugin??? (1 Viewer)

von

Portal Member
July 30, 2006
10
0
Iowa, USA


:) Man I love MediaPortal!!! It has completely consumed my last three days...


Coders,

Could a plugin perform the following functions?

1) When MP is launched copy a saved MediaPortal.xml(configuration file) from the current user's home directory ( c:\Documents and Settings\%username%\My Documents\ ), and write it to the MediaPortal dir before the configuration file needs to be read.

2) On MP exit, write the MediaPortal.xml file from the MediaPortal directory over the one in the current user's home. ( Saving any changes made during the session. )

I want to have different settings, for different users on my machine. The moving file at login I've been able to figure out through other means, but getting the .xml config file written on exit is beyond me.

I thought this might be done through a plugin, and if the logout part is written, then maybe the login part could work too.

I could see the login function not being possible, especially if the MediaPortal configuration file is read before the plugins are loaded. If that's so I would still really love to get a plugin that would write the user's current config file to their directory on MP exit.

von

 

guytpetj

MP Donator
  • Premium Supporter
  • March 24, 2005
    424
    57
    61
    USA
    Home Country
    United States of America United States of America
    Von,

    I can’t help you with your request, but reading your post I have to say this.

    I’m very pleased to see such an enthusiastic post
    Man I love MediaPortal!!! It has completely consumed my last three days...

    Enjoy your MediaPortal experience.
     

    magnuje2

    Portal Member
    May 11, 2006
    23
    0
    well, you could just use a bat file and drag it into the spesific user´s startup group, using the wait command to write bcak the xml file.

    Then you would do something like this in your bat file.
    ------

    copy c:/users/userX.xml %Mediaportalfolder%/Mediaportal.xml

    //Launch Mediaportal.exe and wait for it to close.

    start /wait %MPFolder%/Mediaportal.exe

    copy %MPFolder%/Mediaportal.xml c:/users/userX.xml

    ------

    You could also have a bat file that is launched on startup for all users and checks if there exists a bat file for this user and if needed automates the creation of the file (fills in the "X" and so on, puts it in the startup group) but this is slighty more compilcated

    there it.. one problem. This code depends on that you close mediaportal before logoff. A workaround would be to use myPrograms and manually save your settings, or use myscript and periodically write the file back.

    hope this helps
     

    von

    Portal Member
    July 30, 2006
    10
    0
    Iowa, USA
    My final Solution...



    So here's what I ended up with... I've written two batch files that I put in the MP directory (so any errors and logs will show up there). I placed a shortcut to the first batch file in the startup folder for "All Users". This one copies the settings for that user and will start MP on login for my dedicated account "MediaPortal".


    Batch file 1: MediaPortalMove.bat
    Code:
    copy "c:\Documents and Settings\%username%\My Documents\MediaPortal.xml" "c:\Program Files\Team MediaPortal\MediaPortal\MediaPortal.xml"
    
    if "%username%"=="MediaPortal" "c:\Program Files\Team MediaPortal\MediaPortal\MediaPortalLaunch.bat"


    The second batch file I use to launch MP. It starts a shell that will run until MP exits and then will copy the current MP settings back to the logged in user's "My Documents". I just use this to manually start MP instead of the .exe itself.


    Batch file 1: MediaPortalLaunch.bat
    Code:
    cd "c:\Program Files\Team MediaPortal\MediaPortal\"
    
    start /wait .\MediaPortal.exe
    
    copy "c:\Program Files\Team MediaPortal\MediaPortal\MediaPortal.xml"  "c:\Documents and Settings\%username%\My Documents\MediaPortal.xml"



    It's not perfect but it works. It's useless when I run setup while MediaPortal is running, as it will respawn itself the normal way, but how often do you do that?

    I still think this is an insanely easy feature to add to the next build. MP could call the settings file %username%-MediaPortal.xml and then just look at who's logging in/launching it? Maybe I'm the only one using it for MP multiusers?

    8) I love MP regardless, nothing can change that!!!

    von

     

    Users who are viewing this thread

    Top Bottom