| Summary: | 'synchronize' with amarok statistics for iPod actually WIPES all iPod ratings | ||
|---|---|---|---|
| Product: | [Applications] amarok | Reporter: | Michiel <acidzebra> |
| Component: | general | Assignee: | Amarok Bugs <amarok-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Michiel
2006-11-30 13:34:07 UTC
SVN commit 609407 by aumuell:
only synchronize already set values to media devices
BUG: 138150
M +1 -0 ChangeLog
M +20 -11 src/mediabrowser.cpp
M +1 -0 src/mediabrowser.h
--- trunk/extragear/multimedia/amarok/ChangeLog #609406:609407
@@ -47,6 +47,7 @@
* Amarok now saves playlists with relative paths by default.
BUGFIXES:
+ * Only synchronize already set values to media devices. (BR 138150)
* Correctly update total playlist play time when removing last.fm
streams. Patch by Modestas Vainius <geromanas@mailas.com>. (BR 134333)
* File organization jobs could not be canceled. Patch by Wenli Liu
--- trunk/extragear/multimedia/amarok/src/mediabrowser.cpp #609406:609407
@@ -2803,6 +2803,24 @@
}
void
+MediaItem::syncStatsFromPath( const QString &url )
+{
+ if( url.isEmpty() )
+ return;
+
+ // copy Amarok rating, play count and last played time to device
+ int rating = CollectionDB::instance()->getSongRating( url )*10;
+ if( rating )
+ setRating( rating );
+ int playcount = CollectionDB::instance()->getPlayCount( url );
+ if( playcount > played() )
+ setPlayCount( playcount );
+ QDateTime lastplay = CollectionDB::instance()->getLastPlay( url );
+ if( lastplay > playTime() )
+ setLastPlayed( lastplay.toTime_t() );
+}
+
+void
MediaDevice::syncStatsToDevice( MediaItem *root )
{
MediaItem *it = static_cast<MediaItem *>( m_view->firstChild() );
@@ -2820,15 +2838,7 @@
{
const MetaBundle *bundle = it->bundle();
QString url = CollectionDB::instance()->getURL( *bundle );
-
- if( url != QString::null )
- {
- // copy Amarok rating, play count and last played time to device
- int rating = CollectionDB::instance()->getSongRating( url )*10;
- it->setRating( rating );
- it->setPlayCount( CollectionDB::instance()->getPlayCount( url ) );
- it->setLastPlayed( CollectionDB::instance()->getLastPlay( url ).toTime_t() );
- }
+ it->syncStatsFromPath( url );
}
break;
@@ -3015,8 +3025,7 @@
if( !item )
continue;
- int rating = CollectionDB::instance()->getSongRating( (*it).url().path() ) * 10;
- item->setRating( rating );
+ item->syncStatsFromPath( (*it).url().path() );
if( m_playlistItem && !playlist.isEmpty() )
{
--- trunk/extragear/multimedia/amarok/src/mediabrowser.h #609406:609407
@@ -81,6 +81,7 @@
virtual void setRating( int /*rating*/ ) {}
virtual bool ratingChanged() const { return false; }
virtual void setLastPlayed( uint ) {}
+ virtual void syncStatsFromPath( const QString &path );
virtual long size() const;
virtual MediaDevice *device() const { return m_device; }
virtual bool listened() const { return m_listened; }
wow, that was fast! |