This integral does not converge but one can make some sense of it anyway as a generalized function of $a$ and $b$. Specifically, the result is a sum of Dirac delta functions. To show this, use the Euler identity to express the sine functions as exponential functions. After a little simplification, you will have several terms and each can be evaluated using the Dirac delta function's Fourier expansion:
\begin{equation}
\delta(p) = {1\over2\pi}\int_{-\infty}^\infty dx e^{i p x}
\end{equation}
Edit: To be clear, this is a somewhat advanced analysis. If this was a homework problem for an elementary class and you've never heard of any of the techniques or formulas I've mentioned, the sought-after answer is probably simply "integral does not exist" which can be demonstrated via the arguments made by other posters.
Here is a solution using real analysis. First, denote the two integrals as
\begin{align*}
J & \equiv\int\limits_0^{\pi}\frac {x\left(\sin\frac x2\color{red}-\cos\frac x2\right)}{\sqrt{\sin x}}\,\mathrm dx\\K & \equiv\int\limits_0^{\pi}\frac {x\left(\sin\frac x2\color{red}+\cos\frac x2\right)}{\sqrt{\sin x}}\,\mathrm dx
\end{align*}
And from your post, recall that $K=\pi^2$. Adding the two integrals together removes the $\cos\frac x2$ factor inside the integrand, leaving only
\begin{align*}
J+K & =2\int\limits_0^{\pi}\frac {x\sin\frac x2}{\sqrt{\sin x}}\,\mathrm dx\\ & =\sqrt 2\int\limits_0^{\pi}x\sqrt{\tan\frac x2}\,\mathrm dx\\ & =4\sqrt{2}\int\limits_0^{+\infty}\frac {\sqrt t}{1+t^2}\arctan t\,\mathrm dt
\end{align*}
Where a double angle identity was utilized in the second equation and the half-angle tangent substitution in the third equation. The last integral has been evaluated here before using Complex Analysis, Feynman's Trick, etc. Here is an alternative approach using double integrals. First, enforce the substitution $x=\sqrt t$ so that the integral becomes
$$\int\limits_0^{+\infty}\frac {\sqrt t}{1+t^2}\arctan t\,\mathrm dt=2\int\limits_0^{+\infty}\frac {x^2}{1+x^4}\arctan x^2\,\mathrm dx$$
Next, use the identity
$$\arctan x^2=\int\limits_0^1\frac {x^2}{1+x^4 y^2}\,\mathrm dy$$
Swapping the order of integration and using partial fraction decomposition, then we get
\begin{align*}
2\int\limits_0^{+\infty}\,\int\limits_0^1\frac {x^4}{(1+x^4)(1+x^4y^2)}\,\mathrm dy\,\mathrm dx & =2\int\limits_0^1\frac 1{y^2-1}\int\limits_0^{+\infty}\frac 1{1+x^4}-\frac 1{1+x^4y^2}\,\mathrm dx\,\mathrm dy\\ & =\frac {\pi}{\sqrt 2}\int\limits_0^1\frac 1{y^2-1}\left(1-\frac 1{\sqrt y}\right)\,\mathrm dy\\ & =\frac {\pi^2}{4\sqrt 2}+\frac {\pi\log 4}{4\sqrt 2}
\end{align*}
To recap, we have the equation
$$J+\pi^2=4\sqrt{2}\int\limits_0^{+\infty}\frac {\sqrt t}{1+t^2}\arctan t\,\mathrm dt=\pi^2+\pi\log 4$$
Subtracting a $\pi^2$ from both sides, then
$$\int\limits_0^{\pi}\frac {x\left(\sin\frac x2-\cos\frac x2\right)}{\sqrt{\sin x}}\,\mathrm dx\color{blue}{=\pi\log 4}$$
Best Answer
Let $t=bx$ and use the given integral,
$$I(b)=\displaystyle\int_0^\infty e^{-ax}\frac{\sin{(bx)}}{x}dx =\displaystyle\int_0^\infty e^{-\frac ab x}\frac{\sin{t}}{t}dt=\frac\pi2 - \arctan\frac ab$$
Alternatively, apply integration-by-parts twice to its derivative,
$$I'(b)=\displaystyle\int_0^\infty e^{-ax}\cos(bx)dx =\frac1a +\frac {b}{a^2}\int_0^\infty \sin(bx)d(e^{-ax}) =\frac1a -\frac {b^2}{a^2} I'(b)$$
which leads to $I'(b) = \frac a{a^2+b^2}$ and
$$I(b) = \int_0^b I'(t)dt= \int_0^b \frac a{a^2+t^2}dt = \arctan\frac ba $$