Bug 130739 - Add track length to now listening track info
Summary: Add track length to now listening track info
Status: RESOLVED WAITINGFORINFO
Alias: None
Product: kopete
Classification: Applications
Component: Now Listening Plugin (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-13 07:10 UTC by Matthew Peterson
Modified: 2011-04-07 01:46 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 Matthew Peterson 2006-07-13 07:10:45 UTC
Version:           0.12.x (using KDE Devel)
Installed from:    Compiled sources
Compiler:          GCC 4.1.1 
OS:                Linux

This is a patch/feature request for Kopete to have the track length in it's output.

E.g. for a /media , 
Now listening to: Code Monkey by Jonathan Coulton [3:06]
vs.
Now listening to: Code Monkey by Jonathan Coulton

It's quite a simple enhancement and most of the media players support getting the track length.

When logged into a MSN account it will only display 'Track - Artist', but that seems to be because it doesn't honor the config data.

Below is the patch for the general and xmms plugins :

---
diff SVN_2006_7_13/nlmediaplayer.h Patched/nlmediaplayer.h
32c32
<               NLMediaPlayer() { m_playing = false; m_artist = ""; m_album = ""; m_track = ""; m_newTrack = false; }
---
>               NLMediaPlayer() { m_playing = false; m_artist = ""; m_album = ""; m_length = ""; m_track = ""; m_newTrack = false; }
44a45
>               QString length() const { return m_length; }
54c55,61
<               NLMediaType m_type;
---
>               QString m_length;
>               /**
>                * m_length has should be in the format of minutes:seconds,
>                * seconds is zero padded.
>                * E.g.,  :40 , 1:34 , :09 , 70:05
>                */
>                NLMediaType m_type;
diff SVN_2006_7_13/nlxmms.cpp Patched/nlxmms.cpp
54a55,58
>
>                       int length = xmms_remote_get_playlist_time(0, xmms_remote_get_playlist_pos( 0 ) );
>                       m_length = QString("%1:%2").arg(length/60000).arg((length/1000) % 60, 2);
>                       m_length.replace(' ', '0');
diff SVN_2006_7_13/nowlisteningconfig.kcfg Patched/nowlisteningconfig.kcfg
17c17
<                       <default code="true">i18n("%track( by %artist)( on %album)")</default>
---
>                       <default code="true">i18n("%track( by %artist)( on %album)( [%length])")</default>
diff SVN_2006_7_13/nowlisteningplugin.cpp Patched/nowlisteningplugin.cpp
258c258
<               bool isPlaying=false;
---
>               bool isPlaying = false;
399a400
>       QString length = player->length();
467a469,475
>       if ( in.contains ( "%length" )  && !length.isEmpty() )
>       {
>               if ( length.isEmpty() )
>                       length = i18n("Unknown length");
>               in.replace( "%length", length );
>               done = true;
>       }
diff SVN_2006_7_13/nowlisteningprefs.ui Patched/nowlisteningprefs.ui
76c76
<             <string>%track, %artist, %album, %player will be substituted if known.
---
>             <string>%track, %artist, %album, %player, %length will be substituted if known.
----
Comment 1 Matt Rogers 2006-12-17 21:24:19 UTC
can you create the patch using "diff -u" instead of just normal "diff" and attach it to this bug report? Thanks.