Bug 57419 - kio_audiocd: enconded ogg files have a wrong date
Summary: kio_audiocd: enconded ogg files have a wrong date
Status: RESOLVED FIXED
Alias: None
Product: kdemultimedia
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Multimedia Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-18 14:25 UTC by Manu Garcia
Modified: 2003-04-18 21:12 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 Manu Garcia 2003-04-18 14:25:44 UTC
Version:            (using KDE KDE 3.1.1)
Installed from:    Debian testing/unstable Packages
OS:          Linux

Hello,

When I drag&drop any file from the "directory" audiocd:/Ogg Vorbis to another directory, the encoded file has a wrong date:

Date: 1900-01-01T00:00:00

Also, when I left the mouse over a icon in such "directory" the field Modified has the value "01/01/70 01:00"

Thanks and I hope this help.
Comment 1 Scott Wheeler 2003-04-18 21:12:59 UTC
Subject: kdemultimedia/kioslave/audiocd

CVS commit by wheeler: 

Don't set fields for which no data was found by CDDB.  Also refactored this
code a bit while I was at it.

CCMAIL:57419-done@bugs.kde.org


  M +24 -38    audiocd.cpp   1.72


--- kdemultimedia/kioslave/audiocd/audiocd.cpp  #1.71:1.72
@@ -872,46 +872,32 @@ AudioCDProtocol::get(const KURL & url)
       trackName = d->titles[d->req_track].mid(3);
 
-    vorbis_comment_add_tag
-      (
-       &d->vc,
-       const_cast<char *>("title"),
-       const_cast<char *>(trackName.utf8().data())
-      );
+    typedef QPair<QCString, QString> CommentField;
+    QValueList<CommentField> commentFields;
 
-    vorbis_comment_add_tag
-      (
-       &d->vc,
-       const_cast<char *>("artist"),
-       const_cast<char *>(d->cd_artist.utf8().data())
-      );
+    commentFields.append(CommentField("title", trackName));
+    commentFields.append(CommentField("artist", d->cd_artist));
+    commentFields.append(CommentField("album", d->cd_title));
+    commentFields.append(CommentField("genre", d->cd_category));
+    commentFields.append(CommentField("tracknumber", QString::number(d->req_track+1)));
 
-    vorbis_comment_add_tag
-      (
-       &d->vc,
-       const_cast<char *>("album"),
-       const_cast<char *>(d->cd_title.utf8().data())
-      );
+    if (d->cd_year > 0) {
+      QDateTime dt = QDate(d->cd_year, 1, 1);
+      commentFields.append(CommentField("date", dt.toString(Qt::ISODate).utf8().data()));
+    }
 
-    vorbis_comment_add_tag
-      (
-       &d->vc,
-       const_cast<char *>("genre"),
-       const_cast<char *>(d->cd_category.utf8().data())
-      );
+    for(QValueListIterator<CommentField> it = commentFields.begin(); it != commentFields.end(); ++it) {
 
-    vorbis_comment_add_tag
-      (
-       &d->vc,
-       const_cast<char *>("tracknumber"),
-       const_cast<char *>(QString::number(d->req_track+1).utf8().data())
-      );
+      // if the value is not empty
+      if(!(*it).second.isEmpty()) {
 
-     QDateTime dt = QDate(d->cd_year, 1, 1);
-     vorbis_comment_add_tag
-      (
-       &d->vc,
-       const_cast<char *>("date"),
-       const_cast<char *>(dt.toString(Qt::ISODate).utf8().data())
-      );
+        char *key = qstrdup((*it).first);
+        char *value = qstrdup((*it).second.utf8().data());
+
+        vorbis_comment_add_tag(&d->vc, key, value);
+        
+        delete [] key;
+        delete [] value;
+      }
+    }
   }
 #endif