Code

ncmpc.git
14 years agoscreen: moved code to status_bar.c
Max Kellermann [Wed, 30 Sep 2009 14:32:47 +0000 (16:32 +0200)]
screen: moved code to status_bar.c

14 years agoscreen_utils: don't pass WINDOW to screen_readln()
Max Kellermann [Wed, 30 Sep 2009 14:30:18 +0000 (16:30 +0200)]
screen_utils: don't pass WINDOW to screen_readln()

Callers shouldn't care which window will be used; we're going to use
the global variable screen.status_window.

14 years agoscreen_utils: removed unused function screen_getstr()
Max Kellermann [Wed, 30 Sep 2009 14:30:15 +0000 (16:30 +0200)]
screen_utils: removed unused function screen_getstr()

14 years agoscreen_browser: repair the "mini" version
Max Kellermann [Wed, 30 Sep 2009 14:30:11 +0000 (16:30 +0200)]
screen_browser: repair the "mini" version

Added missing "}".

14 years agompdclient: initialize "retval" in mpdclient_update()
Max Kellermann [Wed, 30 Sep 2009 14:30:08 +0000 (16:30 +0200)]
mpdclient: initialize "retval" in mpdclient_update()

14 years agoscreen: moved code to title_bar.c
Max Kellermann [Wed, 30 Sep 2009 06:22:08 +0000 (08:22 +0200)]
screen: moved code to title_bar.c

14 years agoscreen: moved more (de)initialization code to progress_bar.c
Max Kellermann [Wed, 30 Sep 2009 06:21:57 +0000 (08:21 +0200)]
screen: moved more (de)initialization code to progress_bar.c

14 years agompdclient, screen: don't use MPD_STATUS_NO_VOLUME
Max Kellermann [Wed, 30 Sep 2009 05:58:55 +0000 (07:58 +0200)]
mpdclient, screen: don't use MPD_STATUS_NO_VOLUME

It was removed from libmpdclient.

14 years agoprogress_bar: do first paint manually
Max Kellermann [Wed, 30 Sep 2009 05:47:27 +0000 (07:47 +0200)]
progress_bar: do first paint manually

14 years agoscreen: moved refresh() to ncu_init()
Max Kellermann [Wed, 30 Sep 2009 05:47:26 +0000 (07:47 +0200)]
screen: moved refresh() to ncu_init()

The ncurses initialization code should do the refresh() to clear the
terminal, while screen_init() should reveal the empty controls
(progress bar currently).

14 years agoscreen: moved code to progress_bar.c
Max Kellermann [Tue, 29 Sep 2009 22:35:22 +0000 (00:35 +0200)]
screen: moved code to progress_bar.c

This class repaints only if the bar width has really changed.  It uses
integer division instead of floating point.

14 years agoscreen: moved struct window to window.h
Max Kellermann [Tue, 29 Sep 2009 22:02:47 +0000 (00:02 +0200)]
screen: moved struct window to window.h

14 years agompdclient: handle password errors properly in mpdclient_connect()
Max Kellermann [Tue, 29 Sep 2009 21:18:02 +0000 (23:18 +0200)]
mpdclient: handle password errors properly in mpdclient_connect()

Abort the connection when the configured password fails.

14 years agoscreen_play: repaint on playlist change
Max Kellermann [Tue, 29 Sep 2009 21:17:23 +0000 (23:17 +0200)]
screen_play: repaint on playlist change

When the playlist version changes, repaint the playlist screen.  This
fixes a regression from the patch "repaint hscrolling only if selected
item is wide".

14 years agoscreen_play: simplified function playlist_save()
Max Kellermann [Tue, 29 Sep 2009 20:35:55 +0000 (22:35 +0200)]
screen_play: simplified function playlist_save()

14 years agompdclient: mpdclient_update() returns bool
Max Kellermann [Tue, 29 Sep 2009 20:33:02 +0000 (22:33 +0200)]
mpdclient: mpdclient_update() returns bool

As a side effect, this patch adds the missing
mpdclient_finish_command() call to
mpdclient_playlist_update_changes().

14 years agompdclient: mpdclient_connect() returns bool
Max Kellermann [Tue, 29 Sep 2009 20:26:31 +0000 (22:26 +0200)]
mpdclient: mpdclient_connect() returns bool

.. and disable recovery with mpdclient_handle_error().

14 years agompdclient: mpdclient_disconnect() returns void
Max Kellermann [Tue, 29 Sep 2009 20:24:43 +0000 (22:24 +0200)]
mpdclient: mpdclient_disconnect() returns void

There is no useful return value.

14 years agoscreen_browser: optimize "add+play song" with addid/playid
Max Kellermann [Tue, 29 Sep 2009 20:22:54 +0000 (22:22 +0200)]
screen_browser: optimize "add+play song" with addid/playid

Use the "addid"/"playid" commands in enqueue_and_play().  This
requires MPD 0.12.

14 years agorequire MPD 0.12
Max Kellermann [Tue, 29 Sep 2009 20:14:35 +0000 (22:14 +0200)]
require MPD 0.12

We will take advantage of the "addid" command, which was introduced in
MPD 0.12.  Hey, who's still running 0.11 these days?

14 years agoplaylist: make functions const
Max Kellermann [Tue, 29 Sep 2009 20:14:20 +0000 (22:14 +0200)]
playlist: make functions const

And return const mpd_song objects.

14 years agoplaylist: pass struct mpdclient_playlist to functions
Max Kellermann [Tue, 29 Sep 2009 20:11:23 +0000 (22:11 +0200)]
playlist: pass struct mpdclient_playlist to functions

Passing a mpdclient object doesn't make sense in this library.

14 years agoplaylist: don't check mpd_song_get_uri()!=NULL
Max Kellermann [Tue, 29 Sep 2009 20:01:37 +0000 (22:01 +0200)]
playlist: don't check mpd_song_get_uri()!=NULL

libmpdclient2 guarantees that each mpd_song object has an URI.

14 years agompdclient: reactivate incremental playlist changes
Max Kellermann [Tue, 29 Sep 2009 19:49:53 +0000 (21:49 +0200)]
mpdclient: reactivate incremental playlist changes

A while ago, I broke "plchanges" calls because I forgot to add a "!"
before playlist_is_empty().

14 years agoscreen_client: allow multiple queued database updates
Max Kellermann [Tue, 29 Sep 2009 18:58:02 +0000 (20:58 +0200)]
screen_client: allow multiple queued database updates

MPD supports having multiple update paths in the queue.  Let's just
invoke the "update" command and see what MPD responds.

14 years agoscreen_outputs: finish response in fill_outputs_list()
Max Kellermann [Tue, 29 Sep 2009 18:58:01 +0000 (20:58 +0200)]
screen_outputs: finish response in fill_outputs_list()

14 years agompdclient: don't export mpdclient_finish_command()
Max Kellermann [Tue, 29 Sep 2009 18:57:48 +0000 (20:57 +0200)]
mpdclient: don't export mpdclient_finish_command()

Use plain libmpdclient2 functions plus mpdclient_handle_error()
instead.

14 years agompdclient: export mpdclient_handle_error()
Max Kellermann [Tue, 29 Sep 2009 18:57:29 +0000 (20:57 +0200)]
mpdclient: export mpdclient_handle_error()

This function will allow callers to use libmpdclient2 directly.

14 years agoscreen_file: moved update code to screen_client.c
Max Kellermann [Tue, 29 Sep 2009 18:57:27 +0000 (20:57 +0200)]
screen_file: moved update code to screen_client.c

Moved code from screen_file.c and player_command.c.

14 years agoscreen_client: screen_auth() returns bool
Max Kellermann [Tue, 29 Sep 2009 18:36:07 +0000 (20:36 +0200)]
screen_client: screen_auth() returns bool

true for success, false for error.

14 years agoscreen_client: don't update twice in screen_auth()
Max Kellermann [Tue, 29 Sep 2009 18:36:06 +0000 (20:36 +0200)]
screen_client: don't update twice in screen_auth()

One mpdclient_update() call is in _screen_auth(), and the second is in
screen_auth().  screen_auth() does not check whether _screen_auth()
was successful prior to that.

14 years agoscreen_client: removed curs_set() call from screen_auth()
Max Kellermann [Tue, 29 Sep 2009 18:36:05 +0000 (20:36 +0200)]
screen_client: removed curs_set() call from screen_auth()

screen_read_password() is responsible for hiding the cursor when
finished.

14 years agoscreen_utils: moved screen_auth() to screen_client.c
Max Kellermann [Tue, 29 Sep 2009 18:36:05 +0000 (20:36 +0200)]
screen_utils: moved screen_auth() to screen_client.c

screen_client.c is a new library for MPD specific screen functions.

14 years agompdclient: removed the "need_update" flag
Max Kellermann [Tue, 29 Sep 2009 18:36:04 +0000 (20:36 +0200)]
mpdclient: removed the "need_update" flag

It's set, but never read.

14 years agompdclient: removed the deprecated !ENABLE_PLCHANGES code
Max Kellermann [Tue, 29 Sep 2009 16:37:30 +0000 (18:37 +0200)]
mpdclient: removed the deprecated !ENABLE_PLCHANGES code

The ENABLE_PLCHANGES option has been enabled for ages.

14 years agompdclient: removed the deprecated !ENABLE_SONG_ID code
Max Kellermann [Tue, 29 Sep 2009 16:37:19 +0000 (18:37 +0200)]
mpdclient: removed the deprecated !ENABLE_SONG_ID code

The ENABLE_SONG_ID option has been enabled for ages.

14 years agompdclient: merged error_cb() into mpdclient_handle_error()
Max Kellermann [Tue, 29 Sep 2009 16:21:38 +0000 (18:21 +0200)]
mpdclient: merged error_cb() into mpdclient_handle_error()

Let mpd_connection_clear_error() decide if the error was fatal.

14 years agompdclient: abort ncmpc if out of memory
Max Kellermann [Tue, 29 Sep 2009 16:20:38 +0000 (18:20 +0200)]
mpdclient: abort ncmpc if out of memory

When mpd_connection_new() returns NULL, there's not much we can do.

14 years agomain: don't skip "{}" in server error message
Max Kellermann [Tue, 29 Sep 2009 16:20:33 +0000 (18:20 +0200)]
main: don't skip "{}" in server error message

libmpdclient2 discards the command name from the error message, we
don't need to do it again.

14 years agompdclient: added mpdclient_is_connected()
Max Kellermann [Tue, 29 Sep 2009 16:20:26 +0000 (18:20 +0200)]
mpdclient: added mpdclient_is_connected()

This allows us to remove the global "connected" variable from main.c.

14 years agomain: changed "connected" check to assertion
Max Kellermann [Tue, 29 Sep 2009 16:20:25 +0000 (18:20 +0200)]
main: changed "connected" check to assertion

timer_reconnect() must not be called when ncmpc is already connected.

14 years agoscreen_search: clear return value on error
Max Kellermann [Tue, 29 Sep 2009 16:20:22 +0000 (18:20 +0200)]
screen_search: clear return value on error

search_advanced_query() has a redundant "fl!=NULL" check, and it does
not clear the "fl" variable after freeing the object.

14 years agoscreen_play: repaint hscrolling only if selected item is wide
Max Kellermann [Mon, 28 Sep 2009 16:21:54 +0000 (18:21 +0200)]
screen_play: repaint hscrolling only if selected item is wide

When the "scroll" option is active, ncmpc repainted the whole screen
with each tick, even if the selected item is not wider than the
screen.  This wasted a lot of CPU cycles.

14 years agomoved the idle timer to player_command.c
Max Kellermann [Mon, 28 Sep 2009 16:10:58 +0000 (18:10 +0200)]
moved the idle timer to player_command.c

Create it only on demand, while seeking.

14 years agoplayer_command: handle_player_command() returns bool
Max Kellermann [Mon, 28 Sep 2009 15:48:46 +0000 (17:48 +0200)]
player_command: handle_player_command() returns bool

14 years agoscreen: moved screen_client_cmd() to player_command.c
Max Kellermann [Mon, 28 Sep 2009 15:47:45 +0000 (17:47 +0200)]
screen: moved screen_client_cmd() to player_command.c

14 years agompdclient: removed the mpdclient_t typedef
Max Kellermann [Mon, 28 Sep 2009 15:38:40 +0000 (17:38 +0200)]
mpdclient: removed the mpdclient_t typedef

Use forward-declared struct instead.  This also removes the typedefs
mpdclient_filelist_t, mpdclient_filelist_entry_t,
mpdclient_playlist_t.

14 years agopo: updated Chinese translation
Kyle WANG [Mon, 28 Sep 2009 15:14:16 +0000 (17:14 +0200)]
po: updated Chinese translation

14 years agopo: updated German translation
Samuel Creshal [Mon, 28 Sep 2009 15:13:20 +0000 (17:13 +0200)]
po: updated German translation

14 years agopo: updated French translation
François Blondel [Mon, 28 Sep 2009 15:11:41 +0000 (17:11 +0200)]
po: updated French translation

14 years agouse libmpdclient2
Max Kellermann [Mon, 28 Sep 2009 11:10:27 +0000 (13:10 +0200)]
use libmpdclient2

14 years agoscreen_search: pass const string to search_get_tag_id()
Max Kellermann [Thu, 24 Sep 2009 21:08:07 +0000 (23:08 +0200)]
screen_search: pass const string to search_get_tag_id()

14 years agoModify version string to post-release version 0.16~git
Avuton Olrich [Thu, 24 Sep 2009 14:06:00 +0000 (07:06 -0700)]
Modify version string to post-release version 0.16~git

14 years agoncmpc version 0.15 release-0.15 v0.15
Avuton Olrich [Thu, 24 Sep 2009 14:05:59 +0000 (07:05 -0700)]
ncmpc version 0.15

14 years agopo: updated Danish, Swedish and Norwegian translations
Niels Anker [Thu, 24 Sep 2009 08:28:03 +0000 (10:28 +0200)]
po: updated Danish, Swedish and Norwegian translations

14 years agopo: updated Ukrainian translation
Oleksandr Kovalenko [Tue, 22 Sep 2009 17:51:19 +0000 (19:51 +0200)]
po: updated Ukrainian translation

14 years agopo: regenerated ncmpc.pot and *.po
Max Kellermann [Mon, 21 Sep 2009 18:11:42 +0000 (20:11 +0200)]
po: regenerated ncmpc.pot and *.po

Only line number changes.

14 years agotest.sh: fix the ncmpc-tiny target path
Max Kellermann [Mon, 21 Sep 2009 18:02:56 +0000 (20:02 +0200)]
test.sh: fix the ncmpc-tiny target path

14 years agoscreen_play: fix "unused" warning on NCMPC_MINI
Max Kellermann [Mon, 21 Sep 2009 17:58:05 +0000 (19:58 +0200)]
screen_play: fix "unused" warning on NCMPC_MINI

format_duration() is not used.

14 years agoscreen_lyrics, screen_song: duplicate "next_song"
Max Kellermann [Fri, 18 Sep 2009 09:30:49 +0000 (11:30 +0200)]
screen_lyrics, screen_song: duplicate "next_song"

The screen_X_switch() function calls screen_switch.  As a side effect
of the previous screen being closed, the next_song pointer may become
invalid, which causes memory corruption.  Let's duplicate the song
when assigning it to next_song.

14 years agoscreen_play: another missing second_column NULL check
Max Kellermann [Mon, 14 Sep 2009 09:43:00 +0000 (11:43 +0200)]
screen_play: another missing second_column NULL check

screen_play's list_callback could segfault, when second_column pointed
to a NULL pointer.

14 years agoscreen_file: splitted file_change_directory()
Max Kellermann [Sun, 13 Sep 2009 10:44:47 +0000 (12:44 +0200)]
screen_file: splitted file_change_directory()

Split it into three operations: change to a specific absolute
directory, change to parent directory, and change to directory
referred by a filelist_entry_t.

14 years agoscreen_browser: browser_get_selected_X() returns const object
Max Kellermann [Sun, 13 Sep 2009 10:25:17 +0000 (12:25 +0200)]
screen_browser: browser_get_selected_X() returns const object

No caller modifies these objects.  It's safe to return const.

14 years agompdclient: clear the "connection" variable on error
Max Kellermann [Sun, 13 Sep 2009 10:07:54 +0000 (12:07 +0200)]
mpdclient: clear the "connection" variable on error

This also adds several "connection==NULL" checks, and thus fixes a
NULL pointer dereference, which could occur when you pressed "tab" too
early, before the connection was established (Debian bug #540415).

14 years agoscreen_search, screen_outputs: added connection==NULL checks
Max Kellermann [Sun, 13 Sep 2009 10:07:22 +0000 (12:07 +0200)]
screen_search, screen_outputs: added connection==NULL checks

Don't attempt to call MPD when there is no connection.

14 years agoscreen_browser: added filelist==NULL checks
Max Kellermann [Sun, 13 Sep 2009 09:56:42 +0000 (11:56 +0200)]
screen_browser: added filelist==NULL checks

If ncmpc could not get a list of files, browser->filelist may be
NULL.  This patch adds two missing checks.

14 years agoscreen_play: fix segfault during search
Thomas Jansen [Sun, 13 Sep 2009 09:47:25 +0000 (11:47 +0200)]
screen_play: fix segfault during search

second_column may be NULL (e.g. during search), check before dereferencing it.

14 years agofilelist: removed "path" attribute
Max Kellermann [Sun, 13 Sep 2009 09:06:07 +0000 (11:06 +0200)]
filelist: removed "path" attribute

Callers should track their current path manually, instead of relying
on an the filelist object.

14 years agoscreen_browser: browser_change_directory() to screen_file.c
Max Kellermann [Sun, 13 Sep 2009 09:06:05 +0000 (11:06 +0200)]
screen_browser: browser_change_directory() to screen_file.c

This is completely specific to screen_file, and should live there.

14 years agoscreen_browser: export browser_get_selected_entry()
Max Kellermann [Sun, 13 Sep 2009 09:05:45 +0000 (11:05 +0200)]
screen_browser: export browser_get_selected_entry()

Rename browser_get_selected() to browser_get_selected_entry() first.

14 years agoscreen_browser: added function browser_get_selected_song()
Max Kellermann [Sun, 13 Sep 2009 09:05:44 +0000 (11:05 +0200)]
screen_browser: added function browser_get_selected_song()

Shortcut for several command handlers.

14 years agoscreen_browser: pass mpd_PlaylistFile object to load_playlist()
Max Kellermann [Sun, 13 Sep 2009 09:05:23 +0000 (11:05 +0200)]
screen_browser: pass mpd_PlaylistFile object to load_playlist()

14 years agoscreen_browser: moved range selection check to browser_get_selected()
Max Kellermann [Sun, 13 Sep 2009 07:58:33 +0000 (09:58 +0200)]
screen_browser: moved range selection check to browser_get_selected()

browser_get_selected() should not return an item when multiple items
are selected (range selection).

14 years agoplugin: show plugin error messages on the screen
Max Kellermann [Sun, 13 Sep 2009 06:37:26 +0000 (08:37 +0200)]
plugin: show plugin error messages on the screen

Due to a typo, stdout was redirected twice to the pipe, and stderr was
forgotten.

14 years agoupdate lyricwiki plugin to lyric.wikia.com
Thomas Jansen [Sat, 12 Sep 2009 22:29:28 +0000 (00:29 +0200)]
update lyricwiki plugin to lyric.wikia.com

Lyricwiki was integrated into wikia.com. This changed the URL and once
again the API.

14 years agoupdate lyrics screen when a new song starts
Thomas Jansen [Fri, 11 Sep 2009 14:11:30 +0000 (16:11 +0200)]
update lyrics screen when a new song starts

When a new song starts and the lyrics screen is displayed, fetch the lyrics
for the new song and display them. Don't switch to the new song's lyrics if
the lyrics screen was opened for a specific song.

14 years agompdclient: moved code to mpdclient_handle_error()
Max Kellermann [Thu, 10 Sep 2009 15:52:32 +0000 (17:52 +0200)]
mpdclient: moved code to mpdclient_handle_error()

14 years agoMerge branch 'master' of git://git.musicpd.org/patrick/ncmpc
Max Kellermann [Thu, 10 Sep 2009 15:50:32 +0000 (17:50 +0200)]
Merge branch 'master' of git://git.musicpd.org/patrick/ncmpc

14 years agoautomatically save lyrics
Thomas Jansen [Wed, 9 Sep 2009 07:51:35 +0000 (09:51 +0200)]
automatically save lyrics

Added the option "lyrics-autosave" to save lyrics automatically after
receiving them. By default, the option is off. If the option is enabled,
lyrics are only saved if no such file exists, so we don't accidentally
overwrite lyrics.

14 years agoupdated lyricwiki plugin
Thomas Jansen [Wed, 9 Sep 2009 07:19:33 +0000 (09:19 +0200)]
updated lyricwiki plugin

Lyricwiki doesn't provide lyrics directly through it's API anymore. Instead, a
link to the lyrics is returned if they were found. Follow that link to get the
real thing.

14 years agoscreen_play: Fixed the scrolling in the playlist screen.
Patrick Hallen [Fri, 4 Sep 2009 21:00:54 +0000 (23:00 +0200)]
screen_play: Fixed the scrolling in the playlist screen.

Since commit 850ad87b588dd6cbb96e5558ee671f2c95cc839d, which introduced
a second column with the length of the song in the playlist screen, scrolling
of the entries would sometimes not work, if the entry was smaller than the
screen, but bigger than the first column.
This easy patch fixes this by using the real size of the first column to decide
whether to start scrolling.

14 years agoscreen_song: Added the length of the song to the song screen.
Patrick Hallen [Fri, 4 Sep 2009 11:12:57 +0000 (13:12 +0200)]
screen_song: Added the length of the song to the song screen.

14 years agopo: removed superfluous "<" character from Hebrew
Max Kellermann [Fri, 4 Sep 2009 10:59:09 +0000 (12:59 +0200)]
po: removed superfluous "<" character from Hebrew

Broken by the previous commit :(

14 years agopo: added missing %s in Hebrew format string
Max Kellermann [Fri, 4 Sep 2009 10:54:36 +0000 (12:54 +0200)]
po: added missing %s in Hebrew format string

14 years agopo: added Hebrew translation
Itai Kloog [Fri, 4 Sep 2009 10:16:04 +0000 (12:16 +0200)]
po: added Hebrew translation

14 years agompdclient: pass const song object to mpdclient_cmd_add()
Max Kellermann [Mon, 24 Aug 2009 22:43:48 +0000 (00:43 +0200)]
mpdclient: pass const song object to mpdclient_cmd_add()

14 years agoFixed rogue character after volume change
Thomas Jansen [Mon, 17 Aug 2009 10:19:37 +0000 (12:19 +0200)]
Fixed rogue character after volume change

Volume changes that result in a shorter string length did not clean up the
now unused characters. We check the expected (relative) string length before
updating the screen and do a full repaint in that case.

14 years agompdclient: pass const strings
Max Kellermann [Sat, 15 Aug 2009 21:40:55 +0000 (23:40 +0200)]
mpdclient: pass const strings

The mpdclient library doesn't modify the parameter strings, let's make
them const.

14 years agoadded valgrind.suppressions
Max Kellermann [Fri, 14 Aug 2009 21:50:25 +0000 (23:50 +0200)]
added valgrind.suppressions

14 years agoscreen_song: free mpd_stats object
Max Kellermann [Fri, 14 Aug 2009 21:50:25 +0000 (23:50 +0200)]
screen_song: free mpd_stats object

Fix a memory leak.

14 years agomain: free timers on exit
Max Kellermann [Fri, 14 Aug 2009 21:50:17 +0000 (23:50 +0200)]
main: free timers on exit

Make valgrind happier.

14 years agoncu: free the SCREEN on exit
Max Kellermann [Fri, 14 Aug 2009 21:45:17 +0000 (23:45 +0200)]
ncu: free the SCREEN on exit

Make valgrind happier.

14 years agooptions: added options_deinit()
Max Kellermann [Fri, 14 Aug 2009 21:44:06 +0000 (23:44 +0200)]
options: added options_deinit()

Clean up before exiting, make valgrind happy.

14 years agooptions: removed NULL checks before g_free()
Max Kellermann [Fri, 14 Aug 2009 21:44:06 +0000 (23:44 +0200)]
options: removed NULL checks before g_free()

g_free() handles NULL parameters well.

14 years agoscreen: free ncurses windows with delwin()
Max Kellermann [Fri, 14 Aug 2009 21:44:06 +0000 (23:44 +0200)]
screen: free ncurses windows with delwin()

Clean up before exiting, make valgrind happy.

14 years agoplaylist: addded playlist_get_index_from_same_song()
Max Kellermann [Thu, 9 Jul 2009 17:21:38 +0000 (19:21 +0200)]
playlist: addded playlist_get_index_from_same_song()

14 years agoplaylist: pass const pointers when possible
Max Kellermann [Thu, 9 Jul 2009 17:20:25 +0000 (19:20 +0200)]
playlist: pass const pointers when possible

14 years agoscreen_play: use "idx" instead of "song->pos"
Max Kellermann [Wed, 8 Jul 2009 21:11:40 +0000 (23:11 +0200)]
screen_play: use "idx" instead of "song->pos"

The attribute song->pos may be unreliable.  Since the list_window.c
code already passed the current position to us (parameter "idx"),
let's use it instead.

14 years agoscreen_play: fix duration "0:-1"
Max Kellermann [Wed, 8 Jul 2009 21:09:30 +0000 (23:09 +0200)]
screen_play: fix duration "0:-1"

If the song duration is not known (MPD_SONG_NO_TIME), don't attempt to
print -1 in the second column.

14 years agoscreen_play: moved g_strdup_printf() call to format_duration()
Max Kellermann [Wed, 8 Jul 2009 21:07:22 +0000 (23:07 +0200)]
screen_play: moved g_strdup_printf() call to format_duration()