fixed: cdda/dvd playdisk (attempt 4)
authorelupus <elupus@xbmc.org>
Wed, 28 Dec 2011 21:34:33 +0000 (22:34 +0100)
committerelupus <elupus@xbmc.org>
Wed, 28 Dec 2011 21:34:33 +0000 (22:34 +0100)
It still needs more work..

xbmc/Autorun.cpp
xbmc/Autorun.h

index 8eef37e..4f49ff0 100644 (file)
@@ -42,6 +42,7 @@
 #include "video/VideoDatabase.h"
 #include "dialogs/GUIDialogYesNo.h"
 #include "utils/URIUtils.h"
+#include "utils/log.h"
 
 using namespace std;
 using namespace XFILE;
@@ -72,24 +73,6 @@ void CAutorun::ExecuteAutorun( bool bypassSettings, bool ignoreplaying, bool sta
   PlayDisc("", bypassSettings, startFromBeginning);
 }
 
-bool CAutorun::RunCdda()
-{
-  CFileItemList vecItems;
-
-  auto_ptr<IDirectory> pDir ( CFactoryDirectory::Create( "cdda://local/" ) );
-  if ( !pDir->GetDirectory( "cdda://local/", vecItems ) )
-    return false;
-
-  if ( vecItems.Size() <= 0 )
-    return false;
-
-  g_playlistPlayer.ClearPlaylist(PLAYLIST_MUSIC);
-  g_playlistPlayer.Add(PLAYLIST_MUSIC, vecItems);
-  g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_MUSIC);
-  g_playlistPlayer.Play();
-  return true;
-}
-
 bool CAutorun::PlayDisc(const CStdString& path, bool bypassSettings, bool startFromBeginning)
 {
   if ( !bypassSettings && !g_guiSettings.GetBool("audiocds.autorun") && !g_guiSettings.GetBool("dvds.autorun"))
@@ -98,24 +81,24 @@ bool CAutorun::PlayDisc(const CStdString& path, bool bypassSettings, bool startF
   int nSize = g_playlistPlayer.GetPlaylist( PLAYLIST_MUSIC ).size();
   int nAddedToPlaylist = 0;
 
-  CStdString mediaPath = path;
+  CStdString mediaPath;
+
+  CCdInfo* pInfo = g_mediaManager.GetCdInfo(path);
+  if (pInfo == NULL)
+    return false;
+
+  if (mediaPath.IsEmpty() && pInfo->IsAudio(1))
+    mediaPath = "cdda://local/";
+
+  if (mediaPath.IsEmpty() && (pInfo->IsISOUDF(1) || pInfo->IsISOHFS(1) || pInfo->IsIso9660(1) || pInfo->IsIso9660Interactive(1)))
+    mediaPath = "iso9660://";
 
-#ifdef _WIN32
   if (mediaPath.IsEmpty())
-    mediaPath = g_mediaManager.TranslateDevicePath("");
+    mediaPath = path;
 
-#else
+#ifdef _WIN32
   if (mediaPath.IsEmpty())
-  {
-    CCdInfo* pInfo = g_mediaManager.GetCdInfo();
-    if ( pInfo == NULL )
-      return false;
-
-    if (pInfo->IsISOUDF(1) || pInfo->IsISOHFS(1) || pInfo->IsIso9660(1) || pInfo->IsIso9660Interactive(1))
-      mediaPath = "iso9660://";
-    else
-      mediaPath = "D:\\"; // Is this XBOX remnant??
-  }
+    mediaPath = g_mediaManager.TranslateDevicePath("");
 #endif
 
   auto_ptr<IDirectory> pDir ( CFactoryDirectory::Create( mediaPath ));
@@ -159,21 +142,6 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
   // is this a root folder we have to check the content to determine a disc type
   if( bRoot )
   {
-    // check for audio cd first
-    CCdInfo* pInfo = g_mediaManager.GetCdInfo();
-
-    if ( pInfo->IsAudio( 1 ) )
-    {
-      if( !bypassSettings && !g_guiSettings.GetBool("audiocds.autorun") )
-        return false;
-
-      if (!g_passwordManager.IsMasterLockUnlocked(false))
-        if (g_settings.GetCurrentProfile().musicLocked())
-          return false;
-      bPlaying = RunCdda();
-         return bPlaying;
-    }
-
     // check root folders next, for normal structured dvd's
     for (int i = 0; i < vecItems.Size(); i++)
     {
index 693476e..4461b74 100644 (file)
@@ -56,7 +56,6 @@ public:
   void HandleAutorun();
   static void ExecuteAutorun(bool bypassSettings = false, bool ignoreplaying = false, bool startFromBeginning = false);
 protected:
-  static bool RunCdda();
   static bool RunDisc(XFILE::IDirectory* pDir, const CStdString& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings, bool startFromBeginning);
   bool m_bEnable;
 };