Bug 78665 - Features & Bugfixes to filerenamer
Summary: Features & Bugfixes to filerenamer
Status: REPORTED
Alias: None
Product: juk
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-29 14:09 UTC by Lilltiger
Modified: 2007-12-11 20:22 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lilltiger 2004-03-29 14:09:37 UTC
Version:            (using KDE KDE 3.2.1)
Installed from:    Compiled From Sources
OS:          Linux

I have added some functionality to the filerenamer in Juk and also fixed some non-listed bugs.
The whole patchfile is over 1000 lines so I wont paste it here. Insted I'll provide an link to it..

URL: http://www.ida.his.se/~b02petbe/kde/filerenamer.patch

Bug(unlisted bug):
Renaming an file with insufficient space on the target drive an un-compleat file will be created and the original file will be removed resulting in an faulty copy and no way to restore it.

Fix:
Added an comparing of the filesizes between the new file and the old before deleting the old file. If filesize dont match the copy will be deleted and the original wont be removed.

Added features:

§1. Extended the renaming scheme with:
	Genre
	Year
	Length
	Bitrate
§2. Added an "Keep the original file" checkbox.
	Speaks for it self..
§3. Added an "Use an trailing '0'" checkbox.
	This adds an trailing 0 to the tracknumber if it is < 10.
	ex. track 5 becomes 05 and track 12 becomes track 12.
	Is there ever any need for more then one trailing 0?
	For thoe's who use naming like 001 an scheme of "[0%s]" 						 
	and with this option enable will generate what they want or??

Unfortunally these fixes arent all gold and glory.. Well I think i have worked out all the bugs, but the spelling is another story...
So if you find an spelling error just report it here and i will fix it when i have time. Or just send me an patch with the fixes.

Also report any and all bugs that might be my fault :)

TODO(except for spellfixes):
Adding an renaming theme saver/loader that can handle multiple different renaming schemes.
Changing the layout to be "integrated" with JuK (like the tagrenamer).

The problem with the TODO-list is that I donsent posses enough knowledge of QT/KDE to implement it yet.. And no time to learn :)

Hope someone finds this stuff usefull..
Comment 1 Scott Wheeler 2004-03-29 14:40:58 UTC
Can you please split this up into separate patches (incremental if needed) for the different parts?  Generally speaking in the OSS world people are only going to apply patches if they're atomic and easy to understand -- this is not the case here.  (As this requires either "all or nothing" rather than potentially accepting only certain parts.)

Also you ignored the coding conventions in the file -- please pay attention to the indentation and spacing scheme...
Comment 2 Frerich Raabe 2004-04-01 13:57:43 UTC
I think the two fixes are void as of a few moments ago since the code now depends on KIO for moving a file, and I think KIO cares about stuff like whether there is enough space available at the destination.
Comment 3 Scott Wheeler 2004-04-13 01:24:54 UTC
CVS commit by wheeler: 

Add a bitrate column (hidden by default).

CCMAIL:78665-done@bugs.kde.org


  M +2 -0      playlist.cpp   1.182
  M +17 -5     playlistitem.cpp   1.83
  M +3 -2      playlistitem.h   1.54


--- kdemultimedia/juk/playlist.cpp  #1.181:1.182
@@ -170,4 +170,5 @@ Playlist::SharedSettings::SharedSettings
             for(int i = 0; i <= PlaylistItem::lastColumn(); i++) {
                 switch(i) {
+                case PlaylistItem::BitrateColumn:
                 case PlaylistItem::CommentColumn:
                 case PlaylistItem::FileNameColumn:
@@ -868,4 +869,5 @@ void Playlist::polish()
     addColumn(i18n("Year"));
     addColumn(i18n("Length"));
+    addColumn(i18n("Bitrate"));
     addColumn(i18n("Comment"));
     addColumn(i18n("File Name"));

--- kdemultimedia/juk/playlistitem.cpp  #1.82:1.83
@@ -78,4 +78,6 @@ QString PlaylistItem::text(int column) c
     case LengthColumn:
         return d->fileHandle.tag()->lengthString();
+    case BitrateColumn:
+        return QString::number(d->fileHandle.tag()->bitrate());
     case CommentColumn:
         return d->fileHandle.tag()->comment();
@@ -260,5 +262,6 @@ int PlaylistItem::compare(const Playlist
     }
 
-    if(column == TrackNumberColumn + offset) {
+    switch(column - offset) {
+    case TrackNumberColumn:
         if(firstItem->d->fileHandle.tag()->track() > secondItem->d->fileHandle.tag()->track())
             return 1;
@@ -267,6 +270,6 @@ int PlaylistItem::compare(const Playlist
         else
             return 0;
-    }
-    else if(column == LengthColumn + offset) {
+        break;
+    case LengthColumn:
         if(firstItem->d->fileHandle.tag()->seconds() > secondItem->d->fileHandle.tag()->seconds())
             return 1;
@@ -275,8 +278,17 @@ int PlaylistItem::compare(const Playlist
         else
             return 0;
-    }
+        break;
+    case BitrateColumn:
+        if(firstItem->d->fileHandle.tag()->bitrate() > secondItem->d->fileHandle.tag()->bitrate())
+            return 1;
+        else if(firstItem->d->fileHandle.tag()->bitrate() < secondItem->d->fileHandle.tag()->bitrate())
+            return -1;
     else
+            return 0;
+        break;
+    default:
         return strcoll(firstItem->d->local8Bit[column - offset],
                        secondItem->d->local8Bit[column - offset]);
+    }
 }
 

--- kdemultimedia/juk/playlistitem.h  #1.53:1.54
@@ -58,6 +58,7 @@ public:
                       YearColumn        = 5,
                       LengthColumn      = 6,
-                      CommentColumn     = 7,
-                      FileNameColumn    = 8 };
+                      BitrateColumn     = 7,
+                      CommentColumn     = 8,
+                      FileNameColumn    = 9 };
 
     static int lastColumn() { return FileNameColumn; }


Comment 4 Scott Wheeler 2004-04-13 01:26:03 UTC
Dah, wrong CCMAIL again...
Comment 5 Tobias Koenig 2004-08-07 13:51:19 UTC
*** Bug 78996 has been marked as a duplicate of this bug. ***