Bug 263301 - "Organize files" function doesn't move file, but delete it with disc number tag not define.
Summary: "Organize files" function doesn't move file, but delete it with disc number t...
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Local (show other bugs)
Version: 2.4.0
Platform: Arch Linux Linux
: NOR critical
Target Milestone: 2.4.1
Assignee: Amarok Developers
URL:
Keywords: regression, release_blocker
Depends on:
Blocks:
 
Reported: 2011-01-16 11:25 UTC by tisseron.joffrey
Modified: 2012-08-19 16:53 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.4.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tisseron.joffrey 2011-01-16 11:25:45 UTC
Version:           2.4.0 (using KDE 4.5.5) 
OS:                Linux

When I want to use the "organize files" function, my file is deleted.

Reproducible: Always

Steps to Reproduce:
Right click on a file, a album, an artist, etc. in the collection, then choose "organize file". When the organize files dialog appears, choose your destination and confirm.

Actual Results:  
Your file(s) is (are) deleted.

Expected Results:  
"Organize files" function should move file(s) to the right destination.
Comment 1 tisseron.joffrey 2011-01-16 12:55:59 UTC
Edit : In "organize files" dialog, insert "disc number". The function deletes the file if "disc number" tag (in the file) is not define.
Comment 2 Myriam Schweingruber 2011-01-16 17:28:09 UTC
ouch :(
Comment 3 Sergey Ivanov 2011-01-16 18:02:38 UTC
Everything works Ok in my case. Can't reproduce It. What was I doing:
1. Selected album in collection.
2. Clicked "Organize files"
3. Chose destination to copy files.
4. Amarok asked to remove successfully copied files. Agreed.
5. Copying process finished smooth. Tracks copied to their new places. Old files removed. (only successfully copied)
What am I doing wrong?
Could you show exact steps what did you do. What scheme was used. Any strange messages during the process? Is anything interesting in debug log (amarok -d --nofork)?
Comment 4 tisseron.joffrey 2011-01-16 19:43:22 UTC
Yes you're right. To reproduce the bug, you have to insert "%discnumber" in the path, but, in your file, the "discnumber" tag shouldn't be set.

In Amarok 2.3.2, the tag "discnumber" was ignored and no folder was created. The file was moved correctly. (Something like this : "Collection/%artist/%disc/%discnumber/%title.ogg" -> "Collection/Artist/Disc/Title.ogg" if %discnumber is not define.)

In Amarok 2.4, the file is deleted in the same case. But if I don't insert "%discnumber" in the path, all is right.
Comment 5 Sergey Ivanov 2011-01-16 19:50:52 UTC
Yep, files really gone.
Comment 6 Sergey Ivanov 2011-01-16 21:46:03 UTC
commit 6b12b4198514ea6f459714b85d9bf47ba3a2c2ad
branch master
Author: Sergey Ivanov <123kash@gmail.com>
Date:   Sun Jan 16 23:45:19 2011 +0300

    Fixed issue with Organize collection, which prevent to removeing newly copied tracks.
    BUG: 263301

diff --git a/ChangeLog b/ChangeLog
index 7736b92..a40b3f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,8 @@ VERSION 2.4.1
       <bhargav.1191@gmail.com>. (BR 248690)
 
   BUGFIXES:
+    * Fixed issue with Organize collection, which prevent to removeing newly copied tracks.
+      (BR 263301)
     * Fixed wrong "Configure amarok" action position in tray icon popup menu. (BR 263330)
     * Fixed minor inconsistency in the Collection view. Patch by 
       Bhargav Mangipudi <bhargav.1191@gmail.com>. (BR 260973)
diff --git a/src/dialogs/TrackOrganizer.cpp b/src/dialogs/TrackOrganizer.cpp
index 349e7de..b73a7fc 100644
--- a/src/dialogs/TrackOrganizer.cpp
+++ b/src/dialogs/TrackOrganizer.cpp
@@ -104,7 +104,8 @@ QString TrackOrganizer::buildDestination(const QString& format, const Meta::Trac
     if( !result.startsWith( '/' ) )
         result.prepend( "/" );
 
-   return result.replace( QRegExp( "/\\.*" ), "/" );
+    QFileInfo path( result );           // Used to polish path string. (e.g. remove '//')
+    return path.absoluteFilePath();
 }
 
 QString TrackOrganizer::cleanPath( const QString& component ) const