Bug 145656

Summary: Failed attempt to download episode results in wrong URL which may (indirectly) cause the whole podcast directory to be deleted
Product: [Applications] amarok Reporter: Michal Sylwester <msylwester>
Component: PodcastAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: NOR    
Version: 1.4.5   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Michal Sylwester 2007-05-18 22:49:57 UTC
Version:           1.4.5 (using KDE 3.5.6, Gentoo)
Compiler:          Target: i686-pc-linux-gnu
OS:                Linux (i686) release 2.6.19-suspend2-r2

Reproduction:
1. Pick a podcast
2. Trigger Amarok to download episode
3. Interrupt the download (works for me with both cancel and download error)
4. The localurl is set to the _directory_ name where the episode would be normally downloaded.
5. Amarok shows the episode as not downloaded, but after almost any action associated with it changes it's mind and shows it as downloaded, even though it is not playable.
6. If user asks Amarok to delete the "bad" episode, Amarok removes whole podcast directory.

I first encountered it with a pretty large podcast (I had to redownload ~4G of data...). I've later reproduced it as described above with a small one. Just download episode or two, and abort download of the next one.

I took a quick look at sources, by best bet is that the problem is caused by PodcastEpisode::downloadMedia which sets:
m_localUrl = m_localDir;
The filename is later added in PodcastEpisode::downloadResult:
m_localUrl.addPath( m_filename );
but only if download was successful. It is not obvious for me how the dir-only version gets stored in DB though.

One more point: I believe it is also possible to delete whole podcast dir by trying to delete episode that is just beeing downloaded. Just: download episode 1, request download of episode 2. select another episode, select episode 2 (local url will show only directory part), rightclick -> delete downloaded podcast.

My best bet at fix would be to move the " m_localUrl = m_localDir;" to PodcastEpisode::downloadResult: when it was already verified that the podcast was correctly downloaded.
Comment 1 Frederik Himpe 2007-06-02 13:52:26 UTC
Not sure if it is the same problem I experienced, but it's at least similar. I have podcasts set to download automatically when available, and to keep a maximum of 2 episodes. Yesterday, it started downloading a new episode, but I clicked on the Abort button in the status bar (In Belgium we have very fast Internet connections but with prehistoric download quota etc...). Now the two last episodes are correctly shown in the podcast sidebar (one from 25 May and one from 1 June), but if Drag the one from the first of June to the playlist, I get actually the one from 25 May in the playlist window. I tried rechecking the podcast etc, but all to no avail. There does not seem to be a way to restart the download. In the podcast directory on disk, there is only the episode from 25 May.
Comment 2 Myriam Schweingruber 2008-06-16 13:17:38 UTC

*** This bug has been marked as a duplicate of 147351 ***