Commit d5287682 authored by Max Kellermann's avatar Max Kellermann

ArgParser: allow fractional seconds in ParseCommandArg(SongTime)

parent 7c567e3c
...@@ -8,6 +8,7 @@ ver 0.19 (not yet released) ...@@ -8,6 +8,7 @@ ver 0.19 (not yet released)
- "list" on album artist falls back to the artist tag - "list" on album artist falls back to the artist tag
- "list" and "count" allow grouping - "list" and "count" allow grouping
- new "search"/"find" filter "modified-since" - new "search"/"find" filter "modified-since"
- "seek*" allows fractional position
- close connection after syntax error - close connection after syntax error
* database * database
- proxy: forward "idle" events - proxy: forward "idle" events
......
...@@ -877,8 +877,8 @@ ...@@ -877,8 +877,8 @@
<listitem> <listitem>
<para> <para>
Seeks to the position <varname>TIME</varname> (in Seeks to the position <varname>TIME</varname> (in
seconds) of entry <varname>SONGPOS</varname> in the seconds; fractions allowed) of entry
playlist. <varname>SONGPOS</varname> in the playlist.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -893,7 +893,8 @@ ...@@ -893,7 +893,8 @@
<listitem> <listitem>
<para> <para>
Seeks to the position <varname>TIME</varname> (in Seeks to the position <varname>TIME</varname> (in
seconds) of song <varname>SONGID</varname>. seconds; fractions allowed) of song
<varname>SONGID</varname>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -907,9 +908,10 @@ ...@@ -907,9 +908,10 @@
</term> </term>
<listitem> <listitem>
<para> <para>
Seeks to the position <varname>TIME</varname> within the Seeks to the position <varname>TIME</varname> (in
current song. If prefixed by '+' or '-', then the time seconds; fractions allowed) within the current song. If
is relative to the current playing position. prefixed by '+' or '-', then the time is relative to the
current playing position.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
...@@ -191,8 +191,8 @@ check_float(Client &client, float *value_r, const char *s) ...@@ -191,8 +191,8 @@ check_float(Client &client, float *value_r, const char *s)
bool bool
ParseCommandArg(Client &client, SongTime &value_r, const char *s) ParseCommandArg(Client &client, SongTime &value_r, const char *s)
{ {
unsigned value; float value;
bool success = check_unsigned(client, &value, s); bool success = check_float(client, &value, s) && value >= 0;
if (success) if (success)
value_r = SongTime::FromS(value); value_r = SongTime::FromS(value);
...@@ -202,8 +202,8 @@ ParseCommandArg(Client &client, SongTime &value_r, const char *s) ...@@ -202,8 +202,8 @@ ParseCommandArg(Client &client, SongTime &value_r, const char *s)
bool bool
ParseCommandArg(Client &client, SignedSongTime &value_r, const char *s) ParseCommandArg(Client &client, SignedSongTime &value_r, const char *s)
{ {
int value; float value;
bool success = check_int(client, &value, s); bool success = check_float(client, &value, s);
if (success) if (success)
value_r = SignedSongTime::FromS(value); value_r = SignedSongTime::FromS(value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment