Bug 137748

Summary: dynamic playlist history conflicts with dynamic collection
Product: [Applications] amarok Reporter: bonne
Component: PlaylistAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.4-SVN   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description bonne 2006-11-23 00:06:20 UTC
Version:           1.4-SVN (using KDE 3.5.5, Gentoo)
Compiler:          Target: i686-pc-linux-gnu
OS:                Linux (i686) release 2.6.17-gentoo-r7

Both dynamic mode and dynamic collection toggle the 'isEnabled' flag on playlist items. Dynamic playlist uses it to mark history and dynamic collection to mark items that are currently unavailable. 

This causes a conflict. If there are songs on a dynamic playlist that become unavailable (USB drive is taken out) they are disabled (greyed), which is correct. But when it is plugged back in they are not reenabled. If it was a normal playlist they would be. 

I suggest that dynamic playlist items use a flag other than 'isEnabled' to denote history items. 
I suggest isHistory. Also unaviable items should be found by 'isAvailable'. Then a separate function decides to disable the item if item.isHistory() || !item.isAvailable(). 

That way the two can play nicely together.
Comment 1 Seb Ruiz 2006-11-23 14:28:56 UTC
infact, we do have two separate flags, isEnabled() and isDynamicEnabled(). more than likely this has been overlooked somewhere :)
Comment 2 Alexandre Oliveira 2006-12-31 12:09:02 UTC
It seems to work okay. Reopen if yu still can reproduce this in current svn versions.
Comment 3 bonne 2007-01-21 08:52:32 UTC
This problem still definitely exists. 
To reproduce: 
1. Have some files in the collection from a removable device. 
2. Create a dynamic playlist that includes some of these files. 
3. Exit Amarok
4. Unplug the device
5. Start Amarok - As expected there are history items in grey and non-history items from the removable device also in grey
6. Plug the removable device back in - At this point we expect the non-history items to come back to life in the playlist. 
7. Watch as they remain in grey. 

I shall take a look and see if I can find where its coming from. 
Comment 4 richlv 2007-01-22 08:56:28 UTC
confirmed. mounting a removable device does not reenable items that have been disabled and are located on this device. svn revision around 623546 :)
Comment 5 Jeff Mitchell 2007-01-23 19:09:25 UTC
SVN commit 626564 by mitchell:

Possible fix for dynamic playlist not playing well with dynamic collections

Can someone on this bug report test this out?  This code should stay regardless, as it should be a bugfix of some sort, but it'd be nice to know if this 
closes the bug.

CCBUG: 137748


 M  +3 -0      playlist.cpp  
 M  +1 -0      playlistitem.cpp  


--- trunk/extragear/multimedia/amarok/src/playlist.cpp #626563:626564
@@ -434,7 +434,10 @@
         {
             bool exist = p->exists();
             if( exist != p->checkExists() )
+            {
+                p->setFilestatusEnabled( exist );
                 p->update();
+            }
         }
     }
 }
--- trunk/extragear/multimedia/amarok/src/playlistitem.cpp #626563:626564
@@ -227,6 +227,7 @@
 {
     m_filestatusEnabled = enabled;
     m_dynamicEnabled = enabled;
+    checkExists();
     setEnabled();
 }
 
Comment 6 richlv 2007-01-24 08:07:40 UTC
the problem still here with revision 626647.
Comment 7 Maximilian Kossick 2007-01-26 18:45:01 UTC
SVN commit 627467 by mkossick:

BUG: 137748
Jeff, you almost fixed it:)

 M  +1 -1      playlist.cpp  


--- trunk/extragear/multimedia/amarok/src/playlist.cpp #627466:627467
@@ -435,7 +435,7 @@
             bool exist = p->exists();
             if( exist != p->checkExists() )
             {
-                p->setFilestatusEnabled( exist );
+                p->setFilestatusEnabled( p->checkExists() );
                 p->update();
             }
         }