Permalink
Browse files

added: option to automatically rip an audio cd on insertion

credit giftie
  • Loading branch information...
1 parent ac897dc commit af46070895c102aa46ca9e54e05d78dbbb01be04 spiff committed Apr 4, 2012
@@ -1346,7 +1346,7 @@
<string id="14082">Show EXIF picture information</string>
<string id="14083">Use a fullscreen window rather than true fullscreen</string>
<string id="14084">Queue songs on selection</string>
- <string id="14085">Play audio CDs automatically</string>
+ <string id="14085"></string>
<string id="14086">Playback</string>
<string id="14087">DVDs</string>
<string id="14088">Play DVDs automatically</string>
@@ -1357,8 +1357,10 @@
<string id="14093">Security</string>
<string id="14094">Input devices</string>
<string id="14095">Power saving</string>
+ <string id="14096">Rip</string>
+ <string id="14097">Audio CD Insert Action</string>
+ <string id="14098">Play</string>
<string id="14099">Eject disc when CD ripping is complete</string>
-
<string id="15015">Remove</string>
<string id="15016">Games</string>
View
@@ -43,6 +43,9 @@
#include "dialogs/GUIDialogYesNo.h"
#include "utils/URIUtils.h"
#include "utils/log.h"
+#ifdef HAS_CDDA_RIPPER
+#include "cdrip/CDDARipper.h"
+#endif
using namespace std;
using namespace XFILE;
@@ -69,13 +72,21 @@ void CAutorun::ExecuteAutorun(const CStdString& path, bool bypassSettings, bool
g_application.ResetScreenSaver();
g_application.WakeUpScreenSaverAndDPMS(); // turn off the screensaver if it's active
-
+#ifdef HAS_CDDA_RIPPER
+ if (g_guiSettings.GetInt("audiocds.autoaction") == AUTOCD_RIP &&
+ pInfo->IsAudio(1) && !g_settings.GetCurrentProfile().musicLocked())
+ {
+ CCDDARipper ripper;
+ ripper.RipCD();
+ }
+ else
+#endif
PlayDisc(path, bypassSettings, startFromBeginning);
}
bool CAutorun::PlayDisc(const CStdString& path, bool bypassSettings, bool startFromBeginning)
{
- if ( !bypassSettings && !g_guiSettings.GetBool("audiocds.autorun") && !g_guiSettings.GetBool("dvds.autorun"))
+ if ( !bypassSettings && !g_guiSettings.GetInt("audiocds.autoaction") == AUTOCD_PLAY && !g_guiSettings.GetBool("dvds.autorun"))
return false;
int nSize = g_playlistPlayer.GetPlaylist( PLAYLIST_MUSIC ).size();
@@ -276,7 +287,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
}
}
// then music
- if (!bPlaying && (bypassSettings || g_guiSettings.GetBool("audiocds.autorun")) && bAllowMusic)
+ if (!bPlaying && (bypassSettings || g_guiSettings.GetInt("audiocds.autoaction") == AUTOCD_PLAY) && bAllowMusic)
{
for (int i = 0; i < vecItems.Size(); i++)
{
@@ -318,7 +318,13 @@ void CGUISettings::Initialize()
AddString(scr, "scrobbler.librefmpass", 15219, "", EDIT_CONTROL_MD5_INPUT, false, 15219);
CSettingsCategory* acd = AddCategory(3, "audiocds", 620);
- AddBool(acd, "audiocds.autorun", 14085, false);
+ map<int,int> autocd;
+ autocd.insert(make_pair(16018, AUTOCD_NONE));
+ autocd.insert(make_pair(14098, AUTOCD_PLAY));
+#ifdef HAS_CDDA_RIPPER
+ autocd.insert(make_pair(14096, AUTOCD_RIP));
+#endif
+ AddInt(acd,"audiocds.autoaction",14097,AUTOCD_NONE, autocd, SPIN_CONTROL_TEXT);
AddBool(acd, "audiocds.usecddb", 227, true);
AddSeparator(acd, "audiocds.sep1");
AddPath(acd,"audiocds.recordingpath",20000,"select writable folder",BUTTON_CONTROL_PATH_INPUT,false,657);
@@ -64,6 +64,11 @@ class TiXmlElement;
#define KARAOKE_COLOR_START 0
#define KARAOKE_COLOR_END 4
+// CDDA Autoaction defines
+#define AUTOCD_NONE 0
+#define AUTOCD_PLAY 1
+#define AUTOCD_RIP 2
+
// CDDA ripper defines
#define CDDARIP_ENCODER_LAME 0
#define CDDARIP_ENCODER_VORBIS 1
@@ -630,8 +630,11 @@ std::vector<CStdString> CMediaManager::GetDiskUsage()
void CMediaManager::OnStorageAdded(const CStdString &label, const CStdString &path)
{
- if (g_guiSettings.GetBool("audiocds.autorun") || g_guiSettings.GetBool("dvds.autorun"))
- CJobManager::GetInstance().AddJob(new CAutorunMediaJob(label, path), this, CJob::PRIORITY_HIGH);
+ if (g_guiSettings.GetInt("audiocds.autoaction") != AUTOCD_NONE || g_guiSettings.GetBool("dvds.autorun"))
+ if (g_guiSettings.GetInt("audiocds.autoaction") == AUTOCD_RIP)
+ CJobManager::GetInstance().AddJob(new CAutorunMediaJob(label, path), this, CJob::PRIORITY_LOW);
+ else
+ CJobManager::GetInstance().AddJob(new CAutorunMediaJob(label, path), this, CJob::PRIORITY_HIGH);
else
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(13021), label, TOAST_DISPLAY_TIME, false);
}

0 comments on commit af46070

Please sign in to comment.