Bug 342261

Summary: JJ: Don't replace spaces in path of collection folder when transcoding (do it only in the part relative to collection)
Product: [Applications] amarok Reporter: Nicolas G. <nicolas>
Component: TranscodingAssignee: Amarok Developers <amarok-bugs-dist>
Status: CONFIRMED ---    
Severity: normal CC: exhora.tat, jonathan.monteiro, matej, nftx-adr, teo, wosamrub
Priority: NOR Keywords: junior-jobs
Version: 2.8.0   
Target Milestone: 2.9   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: I hope this is usefull ;-)
Fix bug 342261 - JJ: Don't replace spaces in path of collection folder when transcoding (do it only in the part relative to collection)
I changed the regexp replace to only occur on the transcoded path and left the collection directory unconverted

Description Nicolas G. 2014-12-27 21:49:24 UTC
When mount point of music folder have spaces and the "replace spaces with underscores" option is checked, the transcoding crashed without message.

I think replacing spaces with underscores in mount point is a bug. I suggest replacing spaces only in files names.

Reproducible: Always
Comment 1 Myriam Schweingruber 2014-12-28 01:02:34 UTC
Could you please provide a backtrace for the crash? Please also see https://techbase.kde.org/Development/Tutorials/Debugging/How_to_create_useful_crash_reports
Comment 2 Nicolas G. 2014-12-28 17:40:19 UTC
Backtrace is  inconclusive  but amarok --debug is better :

nicolas@radon:~$ amarok: BEGIN: virtual void Collections::CollectionLocation::getKIOCopyableUrls(const TrackList&) 
amarok:   [CollectionLocation] adding url  KUrl("file:///home/nicolas/musique/La_Mine_de_rien/Avec_des_si/01-La_vie_est_brève.flac") 
amarok:   BEGIN: void Collections::CollectionLocation::slotStartCopy(const QMap<KSharedPtr<Meta::Track>, KUrl>&, const Transcoding::Configuration&) 
amarok:     destination is  "/media/nicolas/SPEEDO_MP3/Avec_des_si/110001_La_vie_est_brève.mp3"    <==== HERE the right name of path is : /media/nicolas/SPEEDO MP3/... (without space)
amarok:     [ERROR__] could not create directory to copy into. 
amarok:     BEGIN: virtual void UmsTransferJob::start() 
amarok:       BEGIN: virtual void Transcoding::Job::start() 
amarok:         Calling 'ffmpeg' '-y' '-i' '/home/nicolas/musique/La_Mine_de_rien/Avec_des_si/01-La_vie_est_brève.flac' '-acodec' 'libmp3lame' '-aq' '1' '/media/nicolas/SPEEDO_MP3/Avec_des_si/110001_La_vie_est_brève.mp3' 
amarok:       END__: virtual void Transcoding::Job::start() [Took: 0.002s] 
amarok:     END__: virtual void UmsTransferJob::start() [Took: 0.002s] 
amarok:   END__: void Collections::CollectionLocation::slotStartCopy(const QMap<KSharedPtr<Meta::Track>, KUrl>&, const Transcoding::Configuration&) [Took: 0.003s] 
amarok: END__: virtual void Collections::CollectionLocation::getKIOCopyableUrls(const TrackList&) [Took: 0.003s] 
QProcess: Destroyed while process is still running.
X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 20 (X_GetProperty)
  Resource id:  0x4c00245

I hope it's usefull.
Comment 3 Myriam Schweingruber 2014-12-29 12:11:46 UTC
Erm, we still need a backtrace, really :)
Comment 4 Nicolas G. 2014-12-30 20:40:47 UTC
Created attachment 90170 [details]
I hope this is usefull ;-)

I've tried generate backtraces with gdb and tutorial described in techbase.kde.org.
Comment 5 Matěj Laitl 2015-01-01 10:47:58 UTC
(In reply to Nicolas G. from comment #2)
> "/media/nicolas/SPEEDO_MP3/Avec_des_si/110001_La_vie_est_brève.mp3"    <====
> HERE the right name of path is : /media/nicolas/SPEEDO MP3/... (without
> space)

Yeah, this looks like a bug. No need for a backtrace, supplied info looks sufficient.

This is a junior job. As Nicolas G. already said, Amarok is probably replacing spaces to underscores when transcoding (if the option is activated) in the *whole* path, but it should replace them only in the part *after* the collection path.
Comment 6 Max B 2015-03-01 01:38:09 UTC
Created attachment 91356 [details]
Fix bug 342261 - JJ: Don't replace spaces in path of collection folder when transcoding (do it only in the part relative to collection)
Comment 7 Myriam Schweingruber 2015-03-02 00:36:06 UTC
(In reply to Max B from comment #6)
> Created attachment 91356 [details]
> Fix bug 342261 - JJ: Don't replace spaces in path of collection folder when
> transcoding (do it only in the part relative to collection)

Thank you for the patch, Max, please submit it to http://reviewboard.kde.org, and subscribe the group "amarok" to it
Comment 8 Adriano R. Lopes 2015-05-29 12:09:15 UTC
I have tested that feature and my Amarok didn't crash, but the musics has desappeared from the collection because the new folder created was out of my collection's folder.
I apply the patch and the problem persists when my collection is in a subfolder (like /home/nftx/Amarok/My test collection).
Comment 9 Taiane Ramos 2015-05-29 17:49:29 UTC
The previously proposed patch didn't work properly. It would work only for collection paths of the format /home/user/collectionName so we are proposing another fix for this bug. I've just added Adriano's patch on review board. https://git.reviewboard.kde.org/r/123937/
Comment 10 Jonathan Monteiro 2016-01-18 14:06:33 UTC
Created attachment 96711 [details]
I changed the regexp replace to only occur on the transcoded path and left the collection directory unconverted

Should I post this to the current review board for the previous patch or create a new one?

Cheers!
Comment 11 Myriam Schweingruber 2016-01-18 18:40:25 UTC
(In reply to Jonathan Monteiro from comment #10)
> Created attachment 96711 [details]
> I changed the regexp replace to only occur on the transcoded path and left
> the collection directory unconverted
> 
> Should I post this to the current review board for the previous patch or
> create a new one?
> 
> Cheers!

Hi Jonathan, please submit it to the current reviewboard for this, as the change is not that big
Comment 12 Jonathan Monteiro 2016-01-24 16:59:22 UTC
(In reply to Myriam Schweingruber from comment #11)
> (In reply to Jonathan Monteiro from comment #10)
> > Created attachment 96711 [details]
> > I changed the regexp replace to only occur on the transcoded path and left
> > the collection directory unconverted
> > 
> > Should I post this to the current review board for the previous patch or
> > create a new one?
> > 
> > Cheers!
> 
> Hi Jonathan, please submit it to the current reviewboard for this, as the
> change is not that big

Thanks for the direction.  I have added it to the review board.