xaizek / pms (License: GPLv3+) (since 2018-12-07)
Older version of Practical Music Search written in C++.
Commit 61b2485c84b5b061644f50159dc65340100588f0

Close #19, adding numeric parameter to add-random and play-random.
Author: Kim Tore Jensen
Author date (UTC): 2010-05-14 11:04
Committer name: Kim Tore Jensen
Committer date (UTC): 2010-05-14 11:04
Parent(s): d37f261eda420fcf5c1f92b5aec27ed51201d0ba
Signing key:
Tree: f688c5e19e1766f1e1b52b216fad3606ff84b94f
File Lines added Lines deleted
ChangeLog 1 0
pms.1 4 4
src/action.cpp 40 4
File ChangeLog changed (mode: 100644) (index 9a08b81..bc0198c)
... ... Changes in 0.42~git
3 3 --- ---
4 4
5 5 Kim Tore Jensen: Kim Tore Jensen:
6 2010-05-14: changed: the 'add-random' and 'play-random' commands now accepts a numeric parameter of how many songs to add.
6 7 2010-01-03: changed: the 'save' command now saves the current list view (with any filters applied) instead of the playlist. 2010-01-03: changed: the 'save' command now saves the current list view (with any filters applied) instead of the playlist.
7 8 2010-01-03: added: 'filter' command which adds a list filter, and the 'clear-filters' command. 2010-01-03: added: 'filter' command which adds a list filter, and the 'clear-filters' command.
8 9 2009-10-11: fixed: the 'volume' command now correctly sets absolute values. 2009-10-11: fixed: the 'volume' command now correctly sets absolute values.
File pms.1 changed (mode: 100644) (index c5ec5cc..ab4fa3c)
... ... Play all songs from the album of the song under the cursor
455 455 .B play-artist .B play-artist
456 456 Play all songs from the selected artist Play all songs from the selected artist
457 457 .TP .TP
458 .B play-random
459 Play a random song from the library
458 .BI "play-random " "[n]"
459 .BI "Play one or " "n" " random songs from the library or visible list."
460 460 .TP .TP
461 461 .B add-album .B add-album
462 462 Add all songs from the selected album to playlist Add all songs from the selected album to playlist
 
... ... If part of the album already is at the bottom of the playlist the remainder is a
471 471 .B add-artist .B add-artist
472 472 Add all songs from the selected artist to the playlist Add all songs from the selected artist to the playlist
473 473 .TP .TP
474 .B add-random
475 Add a random song from the library to playlist
474 .BI "add-random " "[n]"
475 .BI "Add one or " "n" " random songs from the visible list to the playlist."
476 476 .TP .TP
477 477 .B remove .B remove
478 478 Remove selected song from playlist Remove selected song from playlist
File src/action.cpp changed (mode: 100644) (index 38d78f2..7fff9d5)
... ... bool handle_command(pms_pending_keys action)
1266 1266 case PEND_PLAYRANDOM: case PEND_PLAYRANDOM:
1267 1267 case PEND_ADDRANDOM: case PEND_ADDRANDOM:
1268 1268 if (!list) list = pms->comm->library(); if (!list) list = pms->comm->library();
1269 song = list->randsong();
1270 i = pms->comm->add(pms->comm->playlist(), song);
1271 if (i == MPD_SONG_NO_NUM)
1269
1270 /* Don't re-add songs from playlist, but rather play them again. */
1271 if (list->role == LIST_ROLE_MAIN)
1272 {
1273 if (action == PEND_PLAYRANDOM)
1274 {
1275 song = list->randsong();
1276 pms->comm->playid(song->id);
1277 if (win) win->wantdraw = true;
1278 break;
1279 }
1280 /* Don't add songs from playlist, use library instead */
1281 else
1282 {
1283 list = pms->comm->library();
1284 }
1285 }
1286
1287 /* Accept numeric parameter */
1288 if (pms->input->param.size())
1289 {
1290 i = atoi(pms->input->param.c_str());
1291 sn = MPD_SONG_NO_NUM;
1292 for (l = 0; l < i; l++)
1293 {
1294 song = list->randsong();
1295 if (sn == MPD_SONG_NO_NUM)
1296 sn = pms->comm->add(pms->comm->playlist(), song);
1297 else
1298 pms->comm->add(pms->comm->playlist(), song);
1299 }
1300 }
1301 else
1302 {
1303 song = list->randsong();
1304 sn = pms->comm->add(pms->comm->playlist(), song);
1305 }
1306
1307 if (sn == MPD_SONG_NO_NUM)
1272 1308 break; break;
1273 1309 if (action == PEND_PLAYRANDOM) if (action == PEND_PLAYRANDOM)
1274 pms->comm->playid(i);
1310 pms->comm->playid(sn);
1275 1311 if (win) if (win)
1276 1312 win->wantdraw = true; win->wantdraw = true;
1277 1313 pms->drawstatus(); pms->drawstatus();
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/pms

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/pms

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master