Bug 100423 - "View/Edit Meta Information" should show ID3 when selecting a group of songs
Summary: "View/Edit Meta Information" should show ID3 when selecting a group of songs
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 1.2
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
: 95919 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-02-28 09:59 UTC by Iñaki Baz Castillo
Modified: 2006-06-11 12:32 UTC (History)
1 user (show)

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 Iñaki Baz Castillo 2005-02-28 09:59:34 UTC
Version:           1.2 (using KDE 3.3.2,  (3.1))
Compiler:          gcc version 3.3.5 (Debian 1:3.3.5-8)
OS:                Linux (i686) release 2.6.7-ck6

When I select all the songs of an album in the playlist, and I go to "View/Edit Meta Information" there don't appear the ID3 tags of the album, like Artist, Album name, Genre or Year.
If all the selected songs have the ID3 tags artist, album, genre and year correctly set, I think it would be good to appear these tags when selecting all these tracks, and not only when selecting a only song.
Comment 1 Alexandre Oliveira 2005-03-09 02:01:08 UTC
CVS commit by aoliveira: 

When selecting multiple files, the "View/Edit Meta Information" dialog will show the tags that are common to all of them.
BUG: 100423
CCMAIL: amarok-devel@lists.sf.net


  M +56 -3     tagdialog.cpp   1.53
  M +1 -0      tagdialog.h   1.29


--- kdeextragear-1/amarok/src/tagdialog.cpp  #1.52:1.53
@@ -279,6 +279,8 @@ void TagDialog::init()
 #endif
 
-    if( m_urlList.count() )    //editing multiple tracks
+    if( m_urlList.count() ) {   //editing multiple tracks
         setMultipleTracksMode();
+        readMultipleTracks();
+    }
     else
         readTags();
@@ -368,4 +370,53 @@ TagDialog::setMultipleTracksMode()
 
 
+void
+TagDialog::readMultipleTracks()
+{
+    //Check which fields are the same for all selected tracks
+    const KURL::List::ConstIterator end = m_urlList.end();
+    KURL::List::ConstIterator it = m_urlList.begin();
+    MetaBundle first( *it );
+    bool artist=true, album=true, genre=true, comment=true, year=true;
+    
+    for ( ; it != end; ++it ) {
+        if( !(*it).isLocalFile() ) {
+            // If we have a non local file, don't even lose more time comparing, just leave
+            artist=false; album=false; genre=false; comment=false, year=false;
+            break; 
+        }
+        MetaBundle mb( *it );
+        if ( artist && mb.artist()!=first.artist() ) { artist=false; };
+        if ( album && mb.album()!=first.album() ) { album=false; };
+        if ( genre && mb.genre()!=first.genre() ) { genre=false; };
+        if ( comment && mb.comment()!=first.comment() ) { comment=false; };
+        if ( year && mb.year()!=first.year() ) { year=false; };
+        
+        if (!artist && !album && !genre && !comment && !year)
+            break;
+    }
+    // Set them in the dialog and in m_bundle ( so we don't break hasChanged() )
+    if (artist) {
+        kComboBox_artist->setCurrentText( first.artist() );
+        m_bundle.setArtist( first.artist() );
+    }
+    if (album) {
+        kComboBox_album->setCurrentText( first.album() );
+        m_bundle.setAlbum( first.album() );
+    }
+    if (genre) {
+        kComboBox_genre->setCurrentText( first.genre() );
+        m_bundle.setGenre( first.genre() );
+    }
+    if (comment) {
+        kLineEdit_comment->setText( first.comment() );
+        m_bundle.setComment( first.comment() );
+    }
+    if (year) {
+        kIntSpinBox_year->setValue( first.year().toInt() );
+        m_bundle.setYear( first.year() );
+    }
+    checkModified();
+}
+
 inline bool
 equalString( const QString &a, const QString &b )
@@ -378,11 +429,13 @@ TagDialog::hasChanged()
 {
     bool modified = false;
-    modified |= !equalString( kLineEdit_title->text(), m_bundle.title() );
     modified |= !equalString( kComboBox_artist->lineEdit()->text(), m_bundle.artist() );
     modified |= !equalString( kComboBox_album->lineEdit()->text(), m_bundle.album() );
     modified |= !equalString( kComboBox_genre->lineEdit()->text(), m_bundle.genre() );
-    modified |= kIntSpinBox_track->value() != m_bundle.track().toInt();
     modified |= kIntSpinBox_year->value()  != m_bundle.year().toInt();
     modified |= !equalString( kLineEdit_comment->text(), m_bundle.comment() );
+    if (!m_urlList.count()) { //ignore these on MultipleTracksMode
+        modified |= !equalString( kLineEdit_title->text(), m_bundle.title() );
+        modified |= kIntSpinBox_track->value() != m_bundle.track().toInt();
+    }
 
     return modified;

--- kdeextragear-1/amarok/src/tagdialog.h  #1.28:1.29
@@ -43,4 +43,5 @@ class TagDialog : public TagDialogBase
         void init();
         void readTags();
+        void readMultipleTracks();
         void setMultipleTracksMode();
         bool hasChanged();


Comment 2 Alexandre Oliveira 2005-03-09 20:48:40 UTC
*** Bug 95919 has been marked as a duplicate of this bug. ***