TVDatabase.GetRecordedTV question (3 Viewers)

pilehave

Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #21
    Well, the first time I run my code I now have no errors in either error.log or MediaPortal.log. But...the second time I try to play a file, I get a lot of errors:

    Code:
    2009-06-16 15:58:01.215600 [ERROR][MPMain]: Exception   :System.NotSupportedException: Den angivne stis format understøttes ikke.
       ved System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
       ved System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
       ved System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
       ved System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
       ved System.IO.FileInfo..ctor(String fileName)
       ved TvPlugin.TvRecorded.OnPlayRecordingBackStopped(MediaType type, Int32 stoptime, String filename)
       ved MediaPortal.Player.g_Player.StoppedHandler.Invoke(MediaType type, Int32 stoptime, String filename)
       ved MediaPortal.Player.g_Player.OnStopped()
       ved MediaPortal.Player.g_Player.doStop(Boolean keepTimeShifting, Boolean keepExclusiveModeOn)
       ved MediaPortal.Player.g_Player.Stop(Boolean keepExclusiveModeOn)
       ved ProcessPlugins.PowerPlay.PowerPlay.StopPlayback(Int32 p1, Int32 p2, Object d)
       ved MediaPortal.GUI.Library.GUIWindowManager.CallbackMsg(GUIMessage msg)
       ved MediaPortal.GUI.Library.GUIWindowManager.SendMessage(GUIMessage message)
       ved MediaPortal.GUI.Library.GUIWindowManager.DispatchThreadMessages()
       ved MediaPortalApp.FrameMove()
    2009-06-16 15:58:01.216600 [ERROR][MPMain]: Exception   :Den angivne stis format understøttes ikke.
    2009-06-16 15:58:01.216600 [ERROR][MPMain]:   site      :System.String CanonicalizePath(System.String, Boolean)
    2009-06-16 15:58:01.217600 [ERROR][MPMain]:   source    :mscorlib
    2009-06-16 15:58:01.217600 [ERROR][MPMain]:   stacktrace:   ved System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
       ved System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
       ved System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
       ved System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
       ved System.IO.FileInfo..ctor(String fileName)
       ved TvPlugin.TvRecorded.OnPlayRecordingBackStopped(MediaType type, Int32 stoptime, String filename)
       ved MediaPortal.Player.g_Player.StoppedHandler.Invoke(MediaType type, Int32 stoptime, String filename)
       ved MediaPortal.Player.g_Player.OnStopped()
       ved MediaPortal.Player.g_Player.doStop(Boolean keepTimeShifting, Boolean keepExclusiveModeOn)
       ved MediaPortal.Player.g_Player.Stop(Boolean keepExclusiveModeOn)
       ved ProcessPlugins.PowerPlay.PowerPlay.StopPlayback(Int32 p1, Int32 p2, Object d)
       ved MediaPortal.GUI.Library.GUIWindowManager.CallbackMsg(GUIMessage msg)
       ved MediaPortal.GUI.Library.GUIWindowManager.SendMessage(GUIMessage message)
       ved MediaPortal.GUI.Library.GUIWindowManager.DispatchThreadMessages()
       ved MediaPortalApp.FrameMove()

    Am I failing to release some window, dialog or?

    MediaPortal becomes unresponsive and can only be closed by killing the process (second playback only, first is fine)

    I would appreciate any help!
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #22
    Still need help!

    It's me again ;)

    Still haven't got it working, I'll drop some code to see if anyone knows where it needs a fix.

    The first function is fired when a user presses "play" in fullscreen-tv. This works. Now, this function calls the main thread (right?) and tells it to run a function, stop playback (this works) and start playback of the file.

    So...go full screen, press play, select file, press enter, current playback stops, play file. This all works the FIRST time. When I'm done watching my new file and wants to press stop I get no response. Using escape a few times gets me back to windowed tv but controls are "jammed".

    I keep getting this error now, and MP freezes and must be killed by terminating the process:

    2009-06-28 22:37:53.147800 [Info.][MPMain]: Exception :Den angivne stis format understøttes ikke.
    2009-06-28 22:37:53.148800 [Info.][MPMain]: site :confused:ystem.String CanonicalizePath(System.String, Boolean)
    2009-06-28 22:37:53.148800 [Info.][MPMain]: source :mscorlib
    2009-06-28 22:37:53.149800 [Info.][MPMain]: stacktrace: ved System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
    ved System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
    ved System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
    ved System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
    ved System.IO.FileInfo..ctor(String fileName)
    ved TvPlugin.TvRecorded.OnPlayRecordingBackStopped(MediaType type, Int32 stoptime, String filename)
    ved MediaPortal.Player.g_Player.StoppedHandler.Invoke(MediaType type, Int32 stoptime, String filename)
    ved MediaPortal.Player.g_Player.OnStopped()
    ved MediaPortal.Player.g_Player.doStop(Boolean keepTimeShifting, Boolean keepExclusiveModeOn)
    ved MediaPortal.Player.g_Player.Stop()
    ved MediaPortal.D3DApp.D3DApp_Closing(Object sender, CancelEventArgs e)
    ved System.Windows.Forms.Form.OnClosing(CancelEventArgs e)
    ved MediaPortal.D3DApp.OnClosing(CancelEventArgs e)
    ved System.Windows.Forms.Form.WmClose(Message& m)
    ved System.Windows.Forms.Form.WndProc(Message& m)
    ved MediaPortalApp.WndProc(Message& msg)

    Here's a cookdown of the code:

    Code:
            private void oneClickPlayRecordings()
            {
                try
                {
                    GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                    if (dlg == null) return;
                    dlg.Reset();
                    dlg.SetHeading("Recorded TV");
                    int counter = 0;
    
                    IList<Recording> recordings = Recording.ListAll();
                    foreach (Recording rec in recordings)
                    {
                        counter++;
                        GUIListItem item = new GUIListItem();
                        item.Label = rec.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat);
                        item.Label2 = rec.Title;
                        item.PinImage = "";
                        dlg.Add(item);
                    }        
           
                    dlg.DoModal(GUIWindowManager.ActiveWindow);
                    if (dlg.SelectedId > 0)
                    {
                        recordedFileName = recordings[dlg.SelectedId-1].FileName.ToString();
                        GUIWindowManager.SendThreadCallbackAndWait(RecordingPlayback, 0, 0, recordings[dlg.SelectedId-1].FileName);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("PowerPlay - Error(4): " + ex.Message + "( " + ex.StackTrace + " )");
                }
    
            }
    
    
            private int RecordingPlayback(int p1, int p2, object d)
            {
                if (g_Player.Playing)
                {
                    g_Player.Stop();
                    GUIWindowManager.SendThreadCallbackAndWait(StartPlayback, 0, 0, d);
                    GUIWindowManager.ResetAllControls();
                }
                return 0;
            }
    
    
    
            private int StartPlayback(int p1, int p2, object d)
            {
                string fileName = d.ToString();
                TvBusinessLayer layer = new TvBusinessLayer();
                Recording rec = layer.GetRecordingByFileName(fileName);
                Log.Info("PowerPlay - fil: " + rec.Title.ToString());
                string fileRTSP = RemoteControl.Instance.GetUrlForFile(fileName);
                Log.Info("PowerPlay - try to fetch stream " + fileRTSP);
                if (g_Player.Play(fileRTSP, g_Player.MediaType.Recording))
                {
                    g_Player.ShowFullScreenWindow();
                    OnPlayBackStarted(rec);
                    return 0;
                }
                else
                {
                    return 0;
                }
    
                
            }
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #23
    Meh...I just think that MediaPortal can't handle starting playback of files in fullscreen-window. Really a pain in the a** since I got everything working like a charm.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Meh...I just think that MediaPortal can't handle starting playback of files in fullscreen-window. Really a pain in the a** since I got everything working like a charm.

    If that is really the case you can always go to the previous window and then start the playback from there :) A little bit kludge solution, but at least you can test and make sure if it is about that.
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #25
    Meh...I just think that MediaPortal can't handle starting playback of files in fullscreen-window. Really a pain in the a** since I got everything working like a charm.

    If that is really the case you can always go to the previous window and then start the playback from there :) A little bit kludge solution, but at least you can test and make sure if it is about that.

    Yeah, I'll try that tonight. I actually took the long road and went on modifying the TVPlugin, but I would rather have my process-plugin working so that I don't have to compile against every new version that is released.

    The TVPlugin mod went pretty well, but I still have some minor things to iron out. I found out how easy it is to let the user decide whether to use stacking of recordings (where two recordings with same name are put in a virtual folder).
    I really hope this will be a config-option in the future, to have the option of not using virtual folders, at least in our household, a flat structure would be optimal.

    One thing I DID manage to get running is the ability to use one-click-scheduling in the EPG, something I have missed since our normal STB was replaced with MediaPortal. Now I can schedule recordings of the entire day in a few seconds :)
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #26
    One small question... should I put GUIWindowManager.ShowPreviousWindow(); before GUIWindowManager.SendThreadCallbackAndWait(StartPlayback, 0, 0, d); or inside that function? Can't really figure out which will run and which will dispose.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    One small question... should I put GUIWindowManager.ShowPreviousWindow(); before GUIWindowManager.SendThreadCallbackAndWait(StartPlayback, 0, 0, d); or inside that function? Can't really figure out which will run and which will dispose.

    I'm afraid that you need to use similar callback for the previous window call as well (as it should be running from the main thread as well).

    So, you could try putting that GUIWindowManager.ShowPreviousWindow(); inside the StartPlayback() method.
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #28
    Hi again. I tried going to the previous window before starting playback and it didn't do any change...but :D:D:D

    I changed
    Code:
    string fileRTSP = RemoteControl.Instance.GetUrlForFile(fileName);

    to

    Code:
    TvServer server = new TvServer();
    string url = server.GetRtspUrlForFile(fileName);

    and...IT WORKS!!!

    I have NO idea why this is a key point to getting it to work, since both methods returns the RTSP url for the file, and playback actually works in both cases...perhaps I missed releasing something..I dunno :confused:

    Well, gotta code the details and release to the exited public, erh wife ;)
     

    Users who are viewing this thread

    Top Bottom