Fix downloading of podcasts when url is redirected.

BUG: 537
This commit is contained in:
craig.p.drummond
2014-09-12 19:54:06 +00:00
committed by craig.p.drummond
parent 7e58a82c93
commit 64a864380f
2 changed files with 12 additions and 11 deletions

View File

@@ -53,6 +53,7 @@
7. Resize cover in grouped view if it is too wide.
8. In context view, when creating links to similar artists compare artists
names case-insensitively.
9. Fix downloading of podcasts when url is redirected.
1.4.1
-----

View File

@@ -177,8 +177,8 @@ void PodcastService::rssJobFinished()
bool isNew=j->property(constNewFeedProperty).toBool();
if (j->ok()) {
if (updateUrls.contains(j->url())){
updateUrls.remove(j->url());
if (updateUrls.contains(j->origUrl())){
updateUrls.remove(j->origUrl());
if (updateUrls.isEmpty()) {
lastRssUpdate=QDateTime::currentDateTime();
Settings::self()->saveLastRssUpdate(lastRssUpdate);
@@ -205,7 +205,7 @@ void PodcastService::rssJobFinished()
endInsertRows();
// emitNeedToSort();
} else {
MusicLibraryItemPodcast *orig = getPodcast(j->url());
MusicLibraryItemPodcast *orig = getPodcast(j->origUrl());
if (!orig) {
delete podcast;
return;
@@ -266,13 +266,13 @@ void PodcastService::rssJobFinished()
} else if (isNew) {
delete podcast;
if (MusicLibraryItemPodcast::VideoPodcast==loadStatus) {
emitError(i18n("Cantata only supports audio podcasts! %1 contains only video podcasts.", j->url().toString()), isNew);
emitError(i18n("Cantata only supports audio podcasts! %1 contains only video podcasts.", j->origUrl().toString()), isNew);
} else {
emitError(i18n("Failed to parse %1", j->url().toString()), isNew);
emitError(i18n("Failed to parse %1", j->origUrl().toString()), isNew);
}
}
} else {
emitError(i18n("Failed to download %1", j->url().toString()), isNew);
emitError(i18n("Failed to download %1", j->origUrl().toString()), isNew);
}
setBusy(!rssJobs.isEmpty() || !downloadJobs.isEmpty());
}
@@ -352,7 +352,7 @@ void PodcastService::refreshSubscription(MusicLibraryItem *item)
bool PodcastService::processingUrl(const QUrl &url) const
{
foreach (NetworkJob *j, rssJobs) {
if (j->url()==url) {
if (j->origUrl()==url) {
return true;
}
}
@@ -371,7 +371,7 @@ void PodcastService::addUrl(const QUrl &url, bool isNew)
bool PodcastService::downloadingEpisode(const QUrl &url) const
{
foreach (NetworkJob *j, downloadJobs) {
if (j->url()==url) {
if (j->origUrl()==url) {
return true;
}
}
@@ -462,7 +462,7 @@ void PodcastService::downloadEpisode(const MusicLibraryItemPodcast *podcast, con
void PodcastService::cancelDownload(const QUrl &url)
{
foreach (NetworkJob *j, downloadJobs) {
if (j->url()==url) {
if (j->origUrl()==url) {
cancelDownload(j);
downloadJobs.removeAll(j);
break;
@@ -507,7 +507,7 @@ void PodcastService::downloadJobFinished()
if (QFile::rename(partial, dest)) {
MusicLibraryItemPodcast *pod=getPodcast(job->property(constRssUrlProperty).toUrl());
if (pod) {
MusicLibraryItemPodcastEpisode *song=getEpisode(pod, job->url());
MusicLibraryItemPodcastEpisode *song=getEpisode(pod, job->origUrl());
if (song) {
song->setLocalPath(dest);
song->setDownloadProgress(-1);
@@ -565,7 +565,7 @@ void PodcastService::downloadPercent(int pc)
}
MusicLibraryItemPodcast *pod=getPodcast(job->property(constRssUrlProperty).toUrl());
if (pod) {
MusicLibraryItemPodcastEpisode *song=getEpisode(pod, job->url());
MusicLibraryItemPodcastEpisode *song=getEpisode(pod, job->origUrl());
if (song) {
song->setDownloadProgress(pc);
emitDataChanged(createIndex(song));