Skip to content
This repository

Background CD ripper jobs #1530

Merged
2 commits merged into from almost 2 years ago

2 participants

Cory Fields jmarshallnz
Deleted user

Let the churn happen in the background while you browse through a stuttery library ;)

Deleted user

i assume this is gonna get as much attention as cd rip stuff does normally, so;

@jmarshallnz please at least look at the first commit

Cory Fields
Owner

I looked through this yesterday and nothing jumped out, but i'm not familiar enough with ripping or jobs to be of much use on reviewing the logic of the change.

Deleted user

there's really no logic change other than replace proggy dialog with ext proggy dialog. it's the same job. only other change is i had to add an option to cancel shit since that disappeared with the non-modal dialog, and that required the JobQueue change.

this will be followed by a pr backgrounding filemanager operations. it's done, i just have to polish it.

xbmc/utils/JobManager.h
... ... @@ -135,6 +135,10 @@ class CJobQueue: public IJobCallback
135 135 */
136 136 virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job);
137 137
  138 + /*!
  139 + \brief Returns whether or not the queue has any jobs
  140 + */
  141 + bool HasJobs();
2
jmarshallnz Owner

const? (I guess not due to the crit section?)

Deleted user
ghost added a note

yup..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
jmarshallnz
Owner

Assigned to Oct

spiff added some commits
spiff changed: background cd ripper jobs
use the new CGUIDialogExtendedProgressBar (looks like java eh?)
to display progress
3f38605
spiff added: possibility to cancel backgrounded cd ripping jobs 47096e9
Deleted user

now using isprocessing. pulling

Deleted user ghost merged commit 91d656a into from
Deleted user ghost closed this
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Oct 04, 2012
spiff changed: background cd ripper jobs
use the new CGUIDialogExtendedProgressBar (looks like java eh?)
to display progress
3f38605
spiff added: possibility to cancel backgrounded cd ripping jobs 47096e9
This page is out of date. Refresh to see the latest.
6 language/English/strings.po
@@ -5315,7 +5315,11 @@ msgctxt "#14099"
5315 5315 msgid "Eject disc when CD ripping is complete"
5316 5316 msgstr ""
5317 5317
5318   -#empty strings from id 14100 to 15014
  5318 +msgctxt "#14100"
  5319 +msgid "Stop ripping CD"
  5320 +msgstr ""
  5321 +
  5322 +#empty strings from id 14101 to 15014
5319 5323
5320 5324 msgctxt "#15015"
5321 5325 msgid "Remove"
32 xbmc/cdrip/CDDARipJob.cpp
@@ -31,7 +31,7 @@
31 31 #include "FileItem.h"
32 32 #include "utils/log.h"
33 33 #include "Util.h"
34   -#include "dialogs/GUIDialogProgress.h"
  34 +#include "dialogs/GUIDialogExtendedProgressBar.h"
35 35 #include "filesystem/File.h"
36 36 #include "filesystem/SpecialProtocol.h"
37 37 #include "guilib/GUIWindowManager.h"
@@ -87,20 +87,16 @@ bool CCDDARipJob::DoWork()
87 87 }
88 88
89 89 // setup the progress dialog
90   - CGUIDialogProgress* pDlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
91   - CStdString strLine0, strLine1;
  90 + CGUIDialogExtendedProgressBar* pDlgProgress =
  91 + (CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS);
  92 + CGUIDialogProgressBarHandle* handle = pDlgProgress->GetHandle(g_localizeStrings.Get(605));
  93 + CStdString strLine0;
92 94 int iTrack = atoi(m_input.substr(13, m_input.size() - 13 - 5).c_str());
93   - strLine0.Format("%s %i", g_localizeStrings.Get(606).c_str(), iTrack); // Track Number: %i
94   - strLine1.Format("%s %s", g_localizeStrings.Get(607).c_str(), m_output.c_str()); // To: %s
95   - pDlgProgress->SetHeading(605); // Ripping
96   - pDlgProgress->SetLine(0, strLine0);
97   - pDlgProgress->SetLine(1, strLine1);
98   - pDlgProgress->SetLine(2, "");
99   - pDlgProgress->StartModal();
100   - pDlgProgress->ShowProgressBar(true);
101   -
102   - // show progress dialog
103   - pDlgProgress->Progress();
  95 + strLine0.Format("%02i. %s - %s", iTrack,
  96 + StringUtils::Join(m_tag.GetArtist(),
  97 + g_advancedSettings.m_musicItemSeparator).c_str(),
  98 + m_tag.GetTitle().c_str());
  99 + handle->SetText(strLine0);
104 100
105 101 // start ripping
106 102 int percent=0;
@@ -110,17 +106,13 @@ bool CCDDARipJob::DoWork()
110 106 while (!cancelled && (result=RipChunk(reader, encoder, percent)) == 0)
111 107 {
112 108 cancelled = ShouldCancel(percent,100);
113   - cancelled |= pDlgProgress->IsCanceled();
114 109 if (percent > oldpercent)
115 110 {
116 111 oldpercent = percent;
117   - pDlgProgress->SetPercentage(percent);
118   - pDlgProgress->Progress();
  112 + handle->SetPercentage(percent);
119 113 }
120 114 }
121 115
122   - pDlgProgress->Close();
123   -
124 116 // close encoder ripper
125 117 encoder->Close();
126 118 delete encoder;
@@ -159,6 +151,8 @@ bool CCDDARipJob::DoWork()
159 151 }
160 152 }
161 153
  154 + handle->MarkFinished();
  155 +
162 156 return !cancelled && result == 2;
163 157 }
164 158
1  xbmc/dialogs/GUIDialogContextMenu.h
@@ -36,6 +36,7 @@ enum CONTEXT_BUTTON { CONTEXT_BUTTON_CANCELLED = 0,
36 36 CONTEXT_BUTTON_PLAY_DISC,
37 37 CONTEXT_BUTTON_RESUME_DISC,
38 38 CONTEXT_BUTTON_RIP_CD,
  39 + CONTEXT_BUTTON_CANCEL_RIP_CD,
39 40 CONTEXT_BUTTON_RIP_TRACK,
40 41 CONTEXT_BUTTON_EJECT_DISC,
41 42 CONTEXT_BUTTON_EJECT_DRIVE,
12 xbmc/music/windows/GUIWindowMusicSongs.cpp
@@ -36,6 +36,7 @@
36 36 #include "utils/log.h"
37 37 #include "utils/URIUtils.h"
38 38 #include "Autorun.h"
  39 +#include "cdrip/CDDARipper.h"
39 40
40 41 #define CONTROL_BTNVIEWASICONS 2
41 42 #define CONTROL_BTNSORTBY 3
@@ -302,7 +303,12 @@ void CGUIWindowMusicSongs::GetContextButtons(int itemNumber, CContextButtons &bu
302 303 // those cds can also include Audio Tracks: CDExtra and MixedMode!
303 304 CCdInfo *pCdInfo = g_mediaManager.GetCdInfo();
304 305 if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
305   - buttons.Add(CONTEXT_BUTTON_RIP_CD, 600);
  306 + {
  307 + if (CJobManager::GetInstance().IsProcessing("cdrip"))
  308 + buttons.Add(CONTEXT_BUTTON_CANCEL_RIP_CD, 14100);
  309 + else
  310 + buttons.Add(CONTEXT_BUTTON_RIP_CD, 600);
  311 + }
306 312 }
307 313 #endif
308 314 CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
@@ -405,6 +411,10 @@ bool CGUIWindowMusicSongs::OnContextButton(int itemNumber, CONTEXT_BUTTON button
405 411 OnRipCD();
406 412 return true;
407 413
  414 + case CONTEXT_BUTTON_CANCEL_RIP_CD:
  415 + CCDDARipper::GetInstance().CancelJobs();
  416 + return true;
  417 +
408 418 case CONTEXT_BUTTON_CDDB:
409 419 if (m_musicdatabase.LookupCDDBInfo(true))
410 420 Update(m_vecItems->GetPath());

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.