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

Remove the 'playmode' and 'repeat' settings, replacing them by MPD's repeat, random, consume, and single modes.
Author: Kim Tore Jensen
Author date (UTC): 2015-08-22 16:26
Committer name: Kim Tore Jensen
Committer date (UTC): 2015-08-22 16:26
Parent(s): be83c4ab68e5c6ada8b082c26aef5a1a9466b3d4
Signing key:
Tree: a7727f915b8797a2f91d4f4d545a6159b7899530
File Lines added Lines deleted
src/action.cpp 32 85
src/action.h 1 1
src/color.cpp 8 4
src/color.h 4 2
src/command.cpp 30 56
src/command.h 3 0
src/config.cpp 8 0
src/field.cpp 44 70
src/field.h 4 2
src/list.cpp 11 6
src/options.cpp 1 2
src/options.h 0 2
src/pms.cpp 109 112
src/settings.cpp 1 35
src/settings.h 1 3
src/types.h 5 24
File src/action.cpp changed (mode: 100644) (index 6bf1816..f1e9cdd)
... ... long Interface::add(string param)
712 712 /* /*
713 713 * Skip to the next song in line. * Skip to the next song in line.
714 714 */ */
715 long Interface::next(bool ignore_playmode = false)
715 long
716 Interface::next(bool ignore_playmode = false)
716 717 { {
717 if (playnext(ignore_playmode ? PLAYMODE_LINEAR : pms->options->get_long("playmode"), true) == MPD_SONG_NO_ID)
718 {
718 if (playnext(true) == MPD_SONG_NO_ID) {
719 719 pms->log(MSG_STATUS, STERR, _("You have reached the end of the list.")); pms->log(MSG_STATUS, STERR, _("You have reached the end of the list."));
720 720 return STERR; return STERR;
721 721 } }
 
... ... long Interface::next(bool ignore_playmode = false)
725 725
726 726 /* /*
727 727 * Skip to the previous song in playlist. * Skip to the previous song in playlist.
728 * If repeat is set to REPEAT_LIST, wrap around.
728 * If repeat mode is set, wrap around to the last song.
729 729 */ */
730 long Interface::prev()
730 long
731 Interface::prev()
731 732 { {
732 733 Song * cs; Song * cs;
733 734 song_t i; song_t i;
 
... ... long Interface::prev()
735 736 cs = pms->cursong(); cs = pms->cursong();
736 737 if (cs == NULL) if (cs == NULL)
737 738 { {
738 if (pms->comm->playlist()->size() == 0)
739 {
740 pms->log(MSG_STATUS, STERR, _("Can't skip backwards - there are no songs in the playlist."));
739 if (pms->comm->playlist()->size() == 0) {
740 pms->log(MSG_STATUS, STERR, _("Can't skip backwards because the playlist is empty."));
741 741 return STERR; return STERR;
742 742 } }
743 743 i = pms->comm->activelist()->size(); i = pms->comm->activelist()->size();
 
... ... long Interface::prev()
746 746 { {
747 747 if (cs->pos <= 0) if (cs->pos <= 0)
748 748 { {
749 if (pms->options->get_long("repeat") == REPEAT_LIST)
750 {
749 if (pms->comm->status()->repeat) {
751 750 i = pms->comm->playlist()->size(); i = pms->comm->playlist()->size();
752 751 } }
753 752 else else
 
... ... long Interface::seek(int seconds)
902 901 /* Overflow handling */ /* Overflow handling */
903 902 if (pms->comm->status()->time_elapsed + seconds >= pms->comm->status()->time_total) if (pms->comm->status()->time_elapsed + seconds >= pms->comm->status()->time_total)
904 903 /* Skip forwards */ /* Skip forwards */
905 playnext(pms->options->get_long("playmode"), true);
904 playnext(true);
906 905 else if (pms->comm->status()->time_elapsed + seconds < 0) else if (pms->comm->status()->time_elapsed + seconds < 0)
907 906 { {
908 907 /* Skip backwards */ /* Skip backwards */
 
... ... handle_command(pms_pending_keys action)
1340 1339 break; break;
1341 1340
1342 1341 case PEND_REPEAT: case PEND_REPEAT:
1343 switch(pms->options->get_long("repeat"))
1344 {
1345 case REPEAT_NONE:
1346 pms->options->set("repeat", "single");
1347 break;
1348 case REPEAT_ONE:
1349 pms->options->set("repeat", "yes");
1350 break;
1351 case REPEAT_LIST:
1352 default:
1353 pms->options->set("repeat", "no");
1354 break;
1355 }
1356
1357 pms->log(MSG_DEBUG, 0, "Repeatmode set to %d\n", pms->options->get_long("repeat"));
1358
1359 /* Have MPD manage repeat inside playlist and repeat
1360 * single song
1361 * Beware: value of the repeat option may change after
1362 * either of these commands runs, hence not a single
1363 * line each for repeat and single with checks for
1364 * repeat mode within each */
1365 if (pms->comm->activelist() == pms->comm->playlist())
1366 {
1367 switch (pms->options->get_long("repeat"))
1368 {
1369 case REPEAT_NONE:
1370 pms->comm->repeat(false);
1371 pms->comm->single(false);
1372 break;
1373 case REPEAT_ONE:
1374 pms->comm->repeat(true);
1375 pms->comm->single(true);
1376 break;
1377 case REPEAT_LIST:
1378 default:
1379 pms->comm->repeat(true);
1380 pms->comm->single(false);
1381 break;
1382 }
1383 }
1384
1385 //pms->drawstatus();
1342 pms->comm->repeat(!pms->comm->status()->repeat);
1386 1343 break; break;
1387 1344
1345 case PEND_RANDOM:
1346 pms->comm->random(!pms->comm->status()->random);
1347 break;
1388 1348
1349 case PEND_SINGLE:
1350 pms->comm->single(!pms->comm->status()->single);
1351 break;
1389 1352
1353 case PEND_CONSUME:
1354 pms->comm->consume(!pms->comm->status()->consume);
1355 break;
1390 1356
1391 1357 case PEND_TEXT_UPDATED: case PEND_TEXT_UPDATED:
1392 1358 pms->drawstatus(); pms->drawstatus();
 
... ... handle_command(pms_pending_keys action)
1785 1751
1786 1752 break; break;
1787 1753
1788 /* Cycle through between linear play, random and play single song */
1789 case PEND_CYCLE_PLAYMODE:
1790 switch(pms->options->get_long("playmode"))
1791 {
1792 default:
1793 case PLAYMODE_MANUAL:
1794 pms->options->set_long("playmode", PLAYMODE_LINEAR);
1795 break;
1796 case PLAYMODE_LINEAR:
1797 pms->options->set_long("playmode", PLAYMODE_RANDOM);
1798 break;
1799 case PLAYMODE_RANDOM:
1800 pms->options->set_long("playmode", PLAYMODE_MANUAL);
1801 break;
1802 }
1803
1804 /* Have MPD manage random inside playlist */
1805 pms->comm->random(pms->options->get_long("playmode") == PLAYMODE_RANDOM && pms->comm->activelist() == pms->comm->playlist());
1806
1807 //pms->drawstatus();
1808 break;
1809
1810 1754 case PEND_RESIZE: case PEND_RESIZE:
1811 1755 pms->disp->resized(); pms->disp->resized();
1812 1756 pms->disp->forcedraw(); pms->disp->forcedraw();
 
... ... void generr()
1830 1774
1831 1775 /* /*
1832 1776 * Adds or enqueues the next song based on play mode * Adds or enqueues the next song based on play mode
1777 *
1778 * FIXME: misleading function name, too many responsibilities
1779 *
1780 * Returns the id of the song that was added.
1833 1781 */ */
1834 int playnext(long mode, int playnow)
1782 int playnext(int playnow)
1835 1783 { {
1836 1784 Song * song; Song * song;
1837 1785 int i; int i;
1838 1786
1839 if (mode == PLAYMODE_LINEAR)
1840 {
1787 if (!pms->comm->status()->random) {
1841 1788 if (!pms->cursong() || (int)pms->comm->playlist()->end() != pms->cursong()->pos) if (!pms->cursong() || (int)pms->comm->playlist()->end() != pms->cursong()->pos)
1842 1789 song = pms->comm->playlist()->nextsong(); song = pms->comm->playlist()->nextsong();
1843 1790 else else
 
... ... int playnext(long mode, int playnow)
1849 1796 i = pms->comm->add(pms->comm->playlist(), song); i = pms->comm->add(pms->comm->playlist(), song);
1850 1797 else else
1851 1798 i = song->id; i = song->id;
1852 }
1853 else if (mode == PLAYMODE_RANDOM)
1854 {
1799 } else {
1855 1800 if (pms->cursong() && static_cast<int>(pms->comm->playlist()->end()) != pms->cursong()->pos) if (pms->cursong() && static_cast<int>(pms->comm->playlist()->end()) != pms->cursong()->pos)
1856 1801 { {
1857 1802 song = pms->comm->playlist()->nextsong(); song = pms->comm->playlist()->nextsong();
 
... ... int playnext(long mode, int playnow)
1865 1810 i = pms->comm->add(pms->comm->playlist(), song); i = pms->comm->add(pms->comm->playlist(), song);
1866 1811 } }
1867 1812 } }
1868 else return MPD_SONG_NO_ID;
1869 1813
1870 1814 if (i == MPD_SONG_NO_NUM) if (i == MPD_SONG_NO_NUM)
1871 1815 return MPD_SONG_NO_ID; return MPD_SONG_NO_ID;
1872 1816
1817 /* FIXME: error handling */
1873 1818 if (playnow == true) if (playnow == true)
1874 1819 pms->comm->playid(i); pms->comm->playid(i);
1875 1820
 
... ... bool init_commandmap()
2112 2057 pms->commands->add("clear", "Clear the list", PEND_CLEAR); pms->commands->add("clear", "Clear the list", PEND_CLEAR);
2113 2058 pms->commands->add("crop", "Crops list to currently playing song", PEND_CROP); pms->commands->add("crop", "Crops list to currently playing song", PEND_CROP);
2114 2059 pms->commands->add("cropsel", "Crops list to selected songs", PEND_CROPSELECTION); pms->commands->add("cropsel", "Crops list to selected songs", PEND_CROPSELECTION);
2115 pms->commands->add("repeat", "Toggle repeat mode", PEND_REPEAT);
2060 pms->commands->add("repeat", "Toggle repeat on/off", PEND_REPEAT);
2061 pms->commands->add("random", "Toggle random on/off", PEND_RANDOM);
2062 pms->commands->add("single", "Toggle single on/off", PEND_SINGLE);
2063 pms->commands->add("consume", "Toggle consume on/off", PEND_CONSUME);
2116 2064 pms->commands->add("volume", "Increase or decrease volume", PEND_VOLUME); pms->commands->add("volume", "Increase or decrease volume", PEND_VOLUME);
2117 2065 pms->commands->add("mute", "Toggle mute", PEND_MUTE); pms->commands->add("mute", "Toggle mute", PEND_MUTE);
2118 2066 pms->commands->add("crossfade", "Set crossfade time", PEND_CROSSFADE); pms->commands->add("crossfade", "Set crossfade time", PEND_CROSSFADE);
2119 2067 pms->commands->add("seek", "Seek in stream", PEND_SEEK); pms->commands->add("seek", "Seek in stream", PEND_SEEK);
2120 pms->commands->add("playmode", "Cycle play mode", PEND_CYCLE_PLAYMODE);
2121 2068
2122 2069 /* Movement */ /* Movement */
2123 2070 pms->commands->add("next-window", "Go to next playlist", PEND_NEXTWIN); pms->commands->add("next-window", "Go to next playlist", PEND_NEXTWIN);
File src/action.h changed (mode: 100644) (index dd784e0..a56b8e2)
... ... bool handle_command(pms_pending_keys);
128 128 bool init_commandmap(); bool init_commandmap();
129 129
130 130 void generr(); void generr();
131 int playnext(long, int);
131 int playnext(int);
132 132 song_t gotonextentry(string, bool); song_t gotonextentry(string, bool);
133 133 int multiplay(long, int); int multiplay(long, int);
134 134 bool setwin(pms_window *); bool setwin(pms_window *);
File src/color.cpp changed (mode: 100644) (index 8000e50..b8d8561)
... ... void Colortable::clear()
75 75
76 76 delete topbar.repeat; delete topbar.repeat;
77 77 delete topbar.random; delete topbar.random;
78 delete topbar.manualprogression;
78 delete topbar.single;
79 delete topbar.consume;
79 80 delete topbar.mute; delete topbar.mute;
80 81 delete topbar.repeatshort; delete topbar.repeatshort;
81 82 delete topbar.randomshort; delete topbar.randomshort;
82 delete topbar.manualprogressionshort;
83 delete topbar.singleshort;
84 delete topbar.consumeshort;
83 85 delete topbar.muteshort; delete topbar.muteshort;
84 86
85 87 /* field types */ /* field types */
 
... ... void Colortable::defaults()
167 169
168 170 topbar.repeat = new color(COLOR_BLACK, -1, A_BOLD); topbar.repeat = new color(COLOR_BLACK, -1, A_BOLD);
169 171 topbar.random = new color(COLOR_BLACK, -1, A_BOLD); topbar.random = new color(COLOR_BLACK, -1, A_BOLD);
170 topbar.manualprogression = new color(COLOR_BLACK, -1, A_BOLD);
172 topbar.single = new color(COLOR_BLACK, -1, A_BOLD);
173 topbar.consume = new color(COLOR_BLACK, -1, A_BOLD);
171 174 topbar.mute = new color(COLOR_BLACK, -1, A_BOLD); topbar.mute = new color(COLOR_BLACK, -1, A_BOLD);
172 175 topbar.repeatshort = new color(COLOR_CYAN, -1, 0); topbar.repeatshort = new color(COLOR_CYAN, -1, 0);
173 176 topbar.randomshort = new color(COLOR_CYAN, -1, 0); topbar.randomshort = new color(COLOR_CYAN, -1, 0);
174 topbar.manualprogressionshort = new color(COLOR_CYAN, -1, 0);
177 topbar.singleshort = new color(COLOR_CYAN, -1, 0);
178 topbar.consumeshort = new color(COLOR_CYAN, -1, 0);
175 179 topbar.muteshort = new color(COLOR_CYAN, -1, 0); topbar.muteshort = new color(COLOR_CYAN, -1, 0);
176 180
177 181 /* field types */ /* field types */
File src/color.h changed (mode: 100644) (index c7a45c0..62b81ca)
... ... typedef struct
97 97
98 98 color * repeat; color * repeat;
99 99 color * random; color * random;
100 color * manualprogression;
100 color * single;
101 color * consume;
101 102 color * mute; color * mute;
102 103 color * repeatshort; color * repeatshort;
103 104 color * randomshort; color * randomshort;
104 color * manualprogressionshort;
105 color * singleshort;
106 color * consumeshort;
105 107 color * muteshort; color * muteshort;
106 108
107 109
File src/command.cpp changed (mode: 100644) (index 18eab10..73c39dd)
... ... Mpd_status::Mpd_status()
45 45 repeat = false; repeat = false;
46 46 single = false; single = false;
47 47 random = false; random = false;
48 consume = false;
48 49 playlist_length = 0; playlist_length = 0;
49 50 playlist = -1; playlist = -1;
50 51 state = MPD_STATE_UNKNOWN; state = MPD_STATE_UNKNOWN;
 
... ... Mpd_status::assign_status(struct mpd_status * status)
89 90 repeat = mpd_status_get_repeat(status); repeat = mpd_status_get_repeat(status);
90 91 single = mpd_status_get_single(status); single = mpd_status_get_single(status);
91 92 random = mpd_status_get_random(status); random = mpd_status_get_random(status);
93 consume = mpd_status_get_consume(status);
92 94 playlist_length = mpd_status_get_queue_length(status); playlist_length = mpd_status_get_queue_length(status);
93 95 playlist = mpd_status_get_queue_version(status); playlist = mpd_status_get_queue_version(status);
94 96 state = mpd_status_get_state(status); state = mpd_status_get_state(status);
 
... ... Control::get_available_commands()
430 432 commands.close = true; commands.close = true;
431 433 } else if (!strcmp(pair->value, "commands")) { } else if (!strcmp(pair->value, "commands")) {
432 434 commands.commands = true; commands.commands = true;
435 } else if (!strcmp(pair->value, "consume")) {
436 commands.commands = true;
433 437 } else if (!strcmp(pair->value, "count")) { } else if (!strcmp(pair->value, "count")) {
434 438 commands.count = true; commands.count = true;
435 439 } else if (!strcmp(pair->value, "crossfade")) { } else if (!strcmp(pair->value, "crossfade")) {
 
... ... Control::single(bool on)
654 658 return mpd_run_single(conn->h(), on); return mpd_run_single(conn->h(), on);
655 659 } }
656 660
661 /*
662 * Sets consume mode
663 */
664 bool
665 Control::consume(bool on)
666 {
667 EXIT_IDLE;
668
669 pms->log(MSG_DEBUG, 0, "Set consume to %d\n", on);
670
671 return mpd_run_consume(conn->h(), on);
672 }
673
657 674 /* /*
658 675 * Set the volume to an integer between 0 and 100. * Set the volume to an integer between 0 and 100.
659 676 * *
 
... ... Control::get_status()
1209 1226 st->assign_stats(stats); st->assign_stats(stats);
1210 1227 mpd_stats_free(stats); mpd_stats_free(stats);
1211 1228
1212 /* Override local settings if MPD mode changed */
1213 if (st->random) {
1214 pms->options->set_long("playmode", PLAYMODE_RANDOM);
1215 }
1216
1217 if (st->repeat) {
1218 if (st->single) {
1219 pms->options->set_long("repeat", REPEAT_ONE);
1220 } else {
1221 pms->options->set_long("repeat", REPEAT_LIST);
1222 }
1223 }
1224
1225 1229 return true; return true;
1226 1230 } }
1227 1231
 
... ... Control::activelist()
1589 1593
1590 1594 /* /*
1591 1595 * Sets the active playlist * Sets the active playlist
1596 *
1597 * FIXME: why all the logic below?
1592 1598 */ */
1593 bool Control::activatelist(Songlist * list)
1599 bool
1600 Control::activatelist(Songlist * list)
1594 1601 { {
1595 1602 vector<Songlist *>::iterator i; vector<Songlist *>::iterator i;
1596 bool changed = false;
1597 1603
1598 if (list == _playlist || list == _library)
1599 {
1604 if (list == _playlist || list == _library) {
1600 1605 _active = list; _active = list;
1601 changed = true;
1602 }
1603 else
1604 {
1605 i = playlists.begin();
1606 while (i != playlists.end())
1607 {
1608 if (*i == list)
1609 {
1610 _active = list;
1611 changed = true;
1612 break;
1613 }
1614 ++i;
1615 }
1606 return true;
1616 1607 } }
1617 1608
1618 /* Have MPD manage random inside playlist */
1619 /* FIXME: custom function */
1620 /* FIXME: not our responsibility! */
1621 /* FIXME: wrong return codes */
1622 bool set_repeat;
1623 bool set_single;
1624 bool set_random;
1625
1626 if (changed)
1609 i = playlists.begin();
1610 while (i != playlists.end())
1627 1611 { {
1628 set_repeat = ((pms->options->get_long("repeat") == REPEAT_LIST || pms->options->get_long("repeat") == REPEAT_ONE) && activelist() == playlist());
1629 set_single = (pms->options->get_long("repeat") == REPEAT_ONE && activelist() == playlist());
1630 set_random = (pms->options->get_long("playmode") == PLAYMODE_RANDOM && activelist() == playlist());
1631
1632 if (set_repeat != st->repeat && !repeat(set_repeat)) {
1633 return false;
1634 }
1635
1636 if (set_single != st->single && !single(set_single)) {
1637 return false;
1638 }
1639
1640 if (set_random != st->random && !random(set_random)) {
1641 return false;
1612 if (*i == list) {
1613 _active = list;
1614 return true;
1642 1615 } }
1616 ++i;
1643 1617 } }
1644 1618
1645 return changed;
1619 assert(false);
1646 1620 } }
1647 1621
1648 1622 /* /*
File src/command.h changed (mode: 100644) (index 35fb924..3c3c185)
... ... typedef struct
56 56 bool clearerror; bool clearerror;
57 57 bool close; bool close;
58 58 bool commands; bool commands;
59 bool consume;
59 60 bool count; bool count;
60 61 bool crossfade; bool crossfade;
61 62 bool currentsong; bool currentsong;
 
... ... public:
140 141 bool repeat; bool repeat;
141 142 bool single; bool single;
142 143 bool random; bool random;
144 bool consume;
143 145 int playlist_length; int playlist_length;
144 146 long long playlist; long long playlist;
145 147 int state; int state;
 
... ... public:
283 285 bool random(int); bool random(int);
284 286 bool repeat(bool); bool repeat(bool);
285 287 bool single(bool); bool single(bool);
288 bool consume(bool);
286 289 bool setvolume(int); bool setvolume(int);
287 290 bool volume(int); bool volume(int);
288 291 bool mute(); bool mute();
File src/config.cpp changed (mode: 100644) (index 9dd1e49..670b357)
... ... bool Configurator::set_color(string name, string pairs)
824 824 dest = (c->topbar.repeat); dest = (c->topbar.repeat);
825 825 else if (name == "topbar.random") else if (name == "topbar.random")
826 826 dest = (c->topbar.random); dest = (c->topbar.random);
827 else if (name == "topbar.single")
828 dest = (c->topbar.single);
829 else if (name == "topbar.consume")
830 dest = (c->topbar.consume);
827 831 else if (name == "topbar.mute") else if (name == "topbar.mute")
828 832 dest = (c->topbar.mute); dest = (c->topbar.mute);
829 833 else if (name == "topbar.randomshort") else if (name == "topbar.randomshort")
830 834 dest = (c->topbar.randomshort); dest = (c->topbar.randomshort);
831 835 else if (name == "topbar.repeatshort") else if (name == "topbar.repeatshort")
832 836 dest = (c->topbar.repeatshort); dest = (c->topbar.repeatshort);
837 else if (name == "topbar.singleshort")
838 dest = (c->topbar.singleshort);
839 else if (name == "topbar.consumeshort")
840 dest = (c->topbar.consumeshort);
833 841 else if (name == "topbar.muteshort") else if (name == "topbar.muteshort")
834 842 dest = (c->topbar.randomshort); dest = (c->topbar.randomshort);
835 843
File src/field.cpp changed (mode: 100644) (index d8c988c..4401f24)
1 /* vi:set ts=8 sts=8 sw=8:
1 /* vi:set ts=8 sts=8 sw=8 noet:
2 2 * *
3 3 * PMS <<Practical Music Search>> * PMS <<Practical Music Search>>
4 * Copyright (C) 2006-2010 Kim Tore Jensen
4 * Copyright (C) 2006-2015 Kim Tore Jensen
5 5 * *
6 6 * This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
7 7 * it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
 
... ... Item Formatter::field_to_item(string f)
177 177 return REPEAT; return REPEAT;
178 178 else if (f == "random") else if (f == "random")
179 179 return RANDOM; return RANDOM;
180 else if (f == "manual")
181 return MANUALPROGRESSION;
180 else if (f == "single")
181 return SINGLE;
182 else if (f == "consume")
183 return CONSUME;
182 184 else if (f == "mute") else if (f == "mute")
183 185 return MUTE; return MUTE;
184 186 else if (f == "repeatshort") else if (f == "repeatshort")
185 187 return REPEATSHORT; return REPEATSHORT;
186 188 else if (f == "randomshort") else if (f == "randomshort")
187 189 return RANDOMSHORT; return RANDOMSHORT;
188 else if (f == "manualshort")
189 return MANUALPROGRESSIONSHORT;
190 else if (f == "singleshort")
191 return SINGLESHORT;
192 else if (f == "consumeshort")
193 return CONSUMESHORT;
190 194 else if (f == "muteshort") else if (f == "muteshort")
191 195 return MUTESHORT; return MUTESHORT;
192 196
 
... ... string Formatter::format(Song * song, Item keyword, unsigned int & printlen, c
569 573 /* Status items */ /* Status items */
570 574
571 575 case REPEAT: case REPEAT:
572 switch(repeatmode)
573 {
574 case REPEAT_NONE:
575 retstr = "no";
576 break;
577 case REPEAT_ONE:
578 retstr = "one";
579 break;
580 case REPEAT_LIST:
581 retstr = "yes";
582 break;
583 default:
584 retstr = "unknown";
585 break;
576 if (!pms->comm->status()->repeat) {
577 retstr = "no";
578 } else if (pms->comm->status()->single) {
579 retstr = "one";
580 } else {
581 retstr = "yes";
586 582 } }
587 583 break; break;
588 584
589 585 case RANDOM: case RANDOM:
590 switch(playmode)
591 {
592 case PLAYMODE_LINEAR:
593 retstr = "no";
594 break;
595 case PLAYMODE_RANDOM:
596 retstr = "yes";
597 break;
598 default:
599 retstr = "unknown";
600 break;
601 }
586 retstr = pms->comm->status()->random ? "yes" : "no";
602 587 break; break;
603 588
604 case MANUALPROGRESSION:
605 if (playmode == PLAYMODE_MANUAL)
606 retstr = "yes";
607 else
608 retstr = "no";
589 case SINGLE:
590 retstr = pms->comm->status()->single ? "yes" : "no";
591 break;
592
593 case CONSUME:
594 retstr = pms->comm->status()->consume ? "yes" : "no";
609 595 break; break;
610 596
611 597 case MUTE: case MUTE:
612 if (!pms->comm) return "";
598 assert(pms->comm != NULL);
613 599 if (pms->comm->muted()) if (pms->comm->muted())
614 600 retstr = "yes"; retstr = "yes";
615 601 else else
 
... ... string Formatter::format(Song * song, Item keyword, unsigned int & printlen, c
617 603 break; break;
618 604
619 605 case REPEATSHORT: case REPEATSHORT:
620 switch(repeatmode)
621 {
622 default:
623 case REPEAT_NONE:
624 retstr = "-";
625 break;
626 case REPEAT_ONE:
627 retstr = "r";
628 break;
629 case REPEAT_LIST:
630 retstr = "R";
631 break;
632 }
606 retstr = pms->comm->status()->repeat ? "r" : "-";
633 607 break; break;
634 608
635 609 case RANDOMSHORT: case RANDOMSHORT:
636 switch(playmode)
637 {
638 default:
639 case PLAYMODE_LINEAR:
640 retstr = "-";
641 break;
642 case PLAYMODE_RANDOM:
643 retstr = "S";
644 break;
645 }
610 retstr = pms->comm->status()->random ? "z" : "-";
646 611 break; break;
647 612
648 case MANUALPROGRESSIONSHORT:
649 if (playmode == PLAYMODE_MANUAL)
650 retstr = "1";
651 else
652 retstr = "-";
613 case SINGLESHORT:
614 retstr = pms->comm->status()->single ? "s" : "-";
615 break;
616
617 case CONSUMESHORT:
618 retstr = pms->comm->status()->consume ? "c" : "-";
653 619 break; break;
654 620
655 621 case MUTESHORT: case MUTESHORT:
 
... ... color * Formatter::getcolor(Item i, colortable_fields * f)
941 907 c = pms->options->colors->topbar.random; c = pms->options->colors->topbar.random;
942 908 break; break;
943 909
944 case MANUALPROGRESSION:
945 c = pms->options->colors->topbar.manualprogression;
910 case SINGLE:
911 c = pms->options->colors->topbar.single;
912 break;
913
914 case CONSUME:
915 c = pms->options->colors->topbar.consume;
946 916 break; break;
947 917
948 918 case MUTE: case MUTE:
 
... ... color * Formatter::getcolor(Item i, colortable_fields * f)
957 927 c = pms->options->colors->topbar.randomshort; c = pms->options->colors->topbar.randomshort;
958 928 break; break;
959 929
960 case MANUALPROGRESSIONSHORT:
961 c = pms->options->colors->topbar.manualprogressionshort;
930 case SINGLESHORT:
931 c = pms->options->colors->topbar.singleshort;
932 break;
933
934 case CONSUMESHORT:
935 c = pms->options->colors->topbar.consumeshort;
962 936 break; break;
963 937
964 938 case MUTESHORT: case MUTESHORT:
File src/field.h changed (mode: 100644) (index 51e22a3..6e584fa)
... ... typedef enum
68 68 /* These types are only available to the topbar */ /* These types are only available to the topbar */
69 69 REPEAT, REPEAT,
70 70 RANDOM, RANDOM,
71 MANUALPROGRESSION,
71 SINGLE,
72 CONSUME,
72 73 MUTE, MUTE,
73 74 REPEATSHORT, REPEATSHORT,
74 75 RANDOMSHORT, RANDOMSHORT,
75 MANUALPROGRESSIONSHORT,
76 SINGLESHORT,
77 CONSUMESHORT,
76 78 MUTESHORT, MUTESHORT,
77 79 TIME_ELAPSED, TIME_ELAPSED,
78 80 TIME_REMAINING, TIME_REMAINING,
File src/list.cpp changed (mode: 100644) (index 887f695..8249240)
1 1 /* vi:set ts=8 sts=8 sw=8 noet: /* vi:set ts=8 sts=8 sw=8 noet:
2 2 * *
3 3 * PMS <<Practical Music Search>> * PMS <<Practical Music Search>>
4 * Copyright (C) 2006-2010 Kim Tore Jensen
4 * Copyright (C) 2006-2015 Kim Tore Jensen
5 5 * *
6 6 * This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
7 7 * it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
 
... ... Song * Songlist::song(song_t n)
76 76 /* /*
77 77 * Returns the next song in line, starting from current song * Returns the next song in line, starting from current song
78 78 */ */
79 Song * Songlist::nextsong(song_t * id)
79 Song *
80 Songlist::nextsong(song_t * id)
80 81 { {
81 82 song_t i = MATCH_FAILED; song_t i = MATCH_FAILED;
82 83 Song * s; Song * s;
 
... ... Song * Songlist::nextsong(song_t * id)
104 105 } }
105 106
106 107 /* Wrap around */ /* Wrap around */
108 /* FIXME: not our responsibility */
107 109 if (++i >= static_cast<song_t>(size())) if (++i >= static_cast<song_t>(size()))
108 110 { {
109 if (pms->options->get_long("repeat") == REPEAT_LIST)
111 if (pms->comm->status()->repeat) {
110 112 i = 0; i = 0;
111 else
113 } else {
112 114 return NULL; return NULL;
115 }
113 116 } }
114 117
115 118 if (id != NULL) if (id != NULL)
 
... ... Song * Songlist::prevsong(song_t * id)
149 152 } }
150 153
151 154 /* Wrap around */ /* Wrap around */
155 /* FIXME: not our responsibility */
152 156 if (--i < 0) if (--i < 0)
153 157 { {
154 if (pms->options->get_long("repeat") == REPEAT_LIST)
158 if (pms->comm->status()->repeat) {
155 159 i = end(); i = end();
156 else
160 } else {
157 161 return NULL; return NULL;
162 }
158 163 } }
159 164
160 165 if (id != NULL) if (id != NULL)
File src/options.cpp changed (mode: 100644) (index 7ee50bb..0c0dd5e)
... ... void Options::reset()
51 51 directoryminlen = 30; directoryminlen = 30;
52 52 directoryformat = "%artist% – %title%"; directoryformat = "%artist% – %title%";
53 53 xtermtitle = "PMS: %playstate%%ifcursong% %artist% – %title%%endif%"; xtermtitle = "PMS: %playstate%%ifcursong% %artist% – %title%%endif%";
54 playmode = PLAYMODE_LINEAR;
55 54 repeatmode = REPEAT_NONE; repeatmode = REPEAT_NONE;
56 55 ignorecase = true; ignorecase = true;
57 56 regexsearch = false; regexsearch = false;
 
... ... void Options::reset()
90 89
91 90 topbar[0]->strings[0] = _("%time_elapsed% %playstate% %time%%ifcursong% (%progresspercentage%%%)%endif%"); topbar[0]->strings[0] = _("%time_elapsed% %playstate% %time%%ifcursong% (%progresspercentage%%%)%endif%");
92 91 topbar[0]->strings[1] = _("%ifcursong%%artist%%endif%"); topbar[0]->strings[1] = _("%ifcursong%%artist%%endif%");
93 topbar[0]->strings[2] = _("Vol: %volume%%% Mode: %muteshort%%repeatshort%%randomshort%%manualshort%");
92 topbar[0]->strings[2] = _("Vol: %volume%%% Mode: %muteshort%%consumeshort%%repeatshort%%randomshort%%singleshort%");
94 93 topbar[1]->strings[1] = _("%ifcursong%==> %title% <==%else%No current song%endif%"); topbar[1]->strings[1] = _("%ifcursong%==> %title% <==%else%No current song%endif%");
95 94 topbar[2]->strings[0] = _("%listsize%"); topbar[2]->strings[0] = _("%listsize%");
96 95 topbar[2]->strings[1] = _("%ifcursong%%album% (%year%)%endif%"); topbar[2]->strings[1] = _("%ifcursong%%album% (%year%)%endif%");
File src/options.h changed (mode: 100644) (index ba4dc48..bd48750)
... ... public:
90 90 string librarysort; // How to sort the library string librarysort; // How to sort the library
91 91 string columns; // Which columns to show in main view string columns; // Which columns to show in main view
92 92 string xtermtitle; // Title to set in graphical terminals string xtermtitle; // Title to set in graphical terminals
93 pms_play_mode playmode;
94 pms_repeat_mode repeatmode;
95 93 pms_scroll_mode scroll_mode; pms_scroll_mode scroll_mode;
96 94 string libraryroot; // Path to the library root, for prepending to filenames when they are being used in shell commands string libraryroot; // Path to the library root, for prepending to filenames when they are being used in shell commands
97 95 int scrolloff; // Number of items to keep in view above and below cursor in normal scroll mode int scrolloff; // Number of items to keep in view above and below cursor in normal scroll mode
File src/pms.cpp changed (mode: 100644) (index cd2e424..dcaec63)
... ... Pms::needs_statusbar_reset()
1049 1049 } }
1050 1050
1051 1051 /* /*
1052 * Return a textual description on how song progression works
1052 * Return a textual description on how song progression works.
1053 *
1054 * FIXME: this function is a mess. De-duplicate and use common code for this
1055 * function and progress_nextsong().
1053 1056 */ */
1054 string Pms::playstring()
1057 string
1058 Pms::playstring()
1055 1059 { {
1056 1060 string s; string s;
1057 string list = "<unknown>";
1058 bool is_last;
1061 string list_name = "<unknown>";
1062 bool is_last_in_playlist;
1063 bool playlist_is_active;
1064 bool library_is_active;
1065 Mpd_status * status;
1059 1066
1060 long playmode = options->get_long("playmode");
1061 long repeatmode = options->get_long("repeat");
1067 status = comm->status();
1062 1068
1063 if (!comm->status() || !conn->connected())
1064 {
1069 assert(status != NULL);
1070
1071 if (!conn->connected()) {
1065 1072 s = "Not connected."; s = "Not connected.";
1066 1073 return s; return s;
1067 1074 } }
1068 1075
1069 if (comm->status()->state == MPD_STATE_STOP || !cursong())
1070 {
1076 if (status->state == MPD_STATE_STOP || !cursong()) {
1071 1077 s = "Stopped."; s = "Stopped.";
1072 1078 return s; return s;
1073 1079 } }
1074 else if (comm->status()->state == MPD_STATE_PAUSE)
1075 {
1080
1081 if (status->state == MPD_STATE_PAUSE) {
1076 1082 s = "Paused..."; s = "Paused...";
1077 1083 return s; return s;
1078 1084 } }
1079 1085
1080 if (comm->activelist())
1081 list = comm->activelist()->filename;
1086 if (comm->activelist()) {
1087 list_name = comm->activelist()->filename;
1088 }
1082 1089
1083 if (list.size() == 0)
1084 {
1085 if (comm->activelist() == comm->library())
1086 list = "library";
1087 else if (comm->activelist() == comm->playlist())
1088 list = "playlist";
1090 playlist_is_active = (comm->activelist() == comm->playlist());
1091 library_is_active = (comm->activelist() == comm->library());
1092
1093 /* FIXME: playlist should give the correct name in a name() function */
1094 if (list_name.size() == 0) {
1095 if (playlist_is_active) {
1096 list_name = "playlist";
1097 } else if (library_is_active) {
1098 list_name = "library";
1099 }
1089 1100 } }
1090 1101
1091 1102 s = "Playing "; s = "Playing ";
1092 1103
1093 if (playmode == PLAYMODE_MANUAL)
1094 {
1095 s += "this song, then stopping.";
1096 return s;
1104 if (status->consume) {
1105 s += "and consuming ";
1097 1106 } }
1098 1107
1099 if (repeatmode == REPEAT_ONE)
1100 {
1101 s += "the same song indefinitely.";
1108 if (status->random) {
1109 s += "random songs from playlist.";
1102 1110 return s; return s;
1103 1111 } }
1104 1112
1105 is_last = (cursong()->pos == static_cast<int>(comm->playlist()->end()));
1106
1107 if (!is_last && !(comm->activelist() == comm->playlist() && repeatmode == REPEAT_LIST))
1108 {
1109 s += "through playlist, then ";
1113 if (status->single) {
1114 if (status->repeat && !status->consume) {
1115 s += "the current song repeatedly.";
1116 } else {
1117 s += "this song, then stopping.";
1118 }
1119 return s;
1110 1120 } }
1111 1121
1112 if (playmode == PLAYMODE_RANDOM)
1113 {
1114 s += "random songs from " + list + ".";
1122 /* FIXME: separate function? */
1123 is_last_in_playlist = (cursong()->pos == static_cast<song_t>(comm->playlist()->end()));
1124
1125 if (status->repeat) {
1126 s += "songs from playlist repeatedly.";
1115 1127 return s; return s;
1116 1128 } }
1117 1129
1118 if (repeatmode == REPEAT_LIST)
1119 {
1120 s += "songs from " + list + " repeatedly.";
1130 if (playlist_is_active) {
1131 if (is_last_in_playlist) {
1132 s += "this song, then stopping.";
1133 } else {
1134 s += "songs from playlist.";
1135 }
1121 1136 return s; return s;
1122 1137 } }
1123 1138
1124 if (repeatmode == REPEAT_NONE)
1125 {
1126 if (comm->activelist() == comm->playlist())
1127 {
1128 if (options->get_bool("followcursor"))
1129 {
1130 if (is_last)
1131 s += "this song, then ";
1132
1133 s += "following cursor.";
1134 return s;
1135 }
1136
1137 if (is_last)
1138 s += "this song, then stopping.";
1139 else
1140 s += "stopping.";
1141
1139 if (is_last_in_playlist) {
1140 s += "this song, then ";
1141 if (!status->repeat && playlist_is_active) {
1142 s += "stopping.";
1142 1143 return s; return s;
1143 1144 } }
1144 else
1145 {
1146 s += "songs from " + list + ".";
1147 return s;
1145 }
1146
1147 if (!is_last_in_playlist) {
1148 if (!status->consume) {
1149 s += "through ";
1148 1150 } }
1151 s += "playlist, then ";
1149 1152 } }
1150 1153
1154 if (!playlist_is_active && options->get_bool("followcursor")) {
1155 s += "following cursor.";
1156 return s;
1157 }
1158
1159 s += "songs from " + list_name + ".";
1160
1151 1161 return s; return s;
1152 1162 } }
1153 1163
 
... ... Pms::log(int verbosity, long code, const char * format, ...)
1235 1245 } }
1236 1246
1237 1247 /* /*
1238 * Checks if time is right for song progression, and takes necessary action
1248 * Checks if time is right for song progression, and takes necessary action.
1249 *
1250 * FIXME: split into two functions
1251 * FIXME: dubious return value
1239 1252 */ */
1240 1253 bool Pms::progress_nextsong() bool Pms::progress_nextsong()
1241 1254 { {
1242 static song_t lastid = MPD_SONG_NO_ID;
1255 static song_t last_song_id = MPD_SONG_NO_ID;
1243 1256 static Song * lastcursor = NULL; static Song * lastcursor = NULL;
1244 1257 Songlist * list = NULL; Songlist * list = NULL;
1245 unsigned int remaining;
1246
1247 long repeatmode;
1248 long playmode;
1258 unsigned int song_time_remaining;
1259 Mpd_status * status = comm->status();
1249 1260
1250 if (!cursong()) return false;
1251
1252 if (comm->status()->state != MPD_STATE_PLAY)
1261 /* No song progression without an active song, probably meaning that
1262 * the player is stopped or something is wrong. */
1263 if (!cursong()) {
1253 1264 return false; return false;
1265 }
1254 1266
1255 remaining = (comm->status()->time_total - comm->status()->time_elapsed - comm->status()->crossfade);
1267 /* No song progression if not playing. */
1268 if (status->state != MPD_STATE_PLAY) {
1269 return false;
1270 }
1256 1271
1257 repeatmode = options->get_long("repeat");
1258 playmode = options->get_long("playmode");
1272 /* If the active list is the playlist, PMS doesn't need to do anything,
1273 * because MPD handles the rest. */
1274 list = comm->activelist();
1275 assert(list != NULL);
1276 if (list == comm->playlist()) {
1277 return false;
1278 }
1259 1279
1260 /* Too early */
1261 if (remaining > options->get_long("nextinterval") || lastid == cursong()->id)
1280 /* Only add songs when there the currently playing song is near the end. */
1281 song_time_remaining = status->time_total - status->time_elapsed - status->crossfade;
1282 if (song_time_remaining > options->get_long("nextinterval")) {
1262 1283 return false; return false;
1284 }
1263 1285
1264 /* No auto-progression, even when in the middle of playlist */
1265 if (playmode == PLAYMODE_MANUAL)
1266 {
1267 if (remaining <= options->get_long("stopdelay"))
1268 {
1269 pms->log(MSG_DEBUG, 0, "Manual playmode, stopping playback.\n");
1270 comm->stop();
1271 lastid = cursong()->id;
1272 return true;
1273 }
1274 else
1275 {
1276 return false;
1277 }
1286 /* No auto-progression in single mode */
1287 if (status->single) {
1288 return false;
1278 1289 } }
1290
1279 1291 /* Defeat desync with server */ /* Defeat desync with server */
1280 lastid = cursong()->id;
1292 last_song_id = cursong()->id;
1281 1293
1282 1294 /* Normal progression: reached end of playlist */ /* Normal progression: reached end of playlist */
1283 if (comm->status()->song == static_cast<int>(playlist->list->end()))
1284 {
1285 /* List to play from */
1286 list = comm->activelist();
1287 if (!list) return false;
1288
1289 if (list == comm->playlist())
1290 {
1291 /* Let MPD handle repeating of the playlist itself */
1292 if (repeatmode == REPEAT_LIST)
1293 return false;
1294
1295 /* Let MPD handle random songs from playlist */
1296 if (playmode == PLAYMODE_RANDOM)
1297 return false;
1298 }
1295 if (cursong()->pos == static_cast<int>(playlist->list->end())) {
1299 1296
1300 1297 pms->log(MSG_DEBUG, 0, "Auto-progressing to next song.\n"); pms->log(MSG_DEBUG, 0, "Auto-progressing to next song.\n");
1301 1298
 
... ... bool Pms::progress_nextsong()
1304 1301 { {
1305 1302 pms->log(MSG_DEBUG, 0, "Playback follows cursor: last cursor=%p, now cursor=%p.\n", lastcursor, disp->cursorsong()); pms->log(MSG_DEBUG, 0, "Playback follows cursor: last cursor=%p, now cursor=%p.\n", lastcursor, disp->cursorsong());
1306 1303 lastcursor = disp->cursorsong(); lastcursor = disp->cursorsong();
1307 lastid = comm->add(comm->playlist(), lastcursor);
1304 last_song_id = comm->add(comm->playlist(), lastcursor);
1308 1305 } }
1309 1306
1310 1307 /* Normal song progression */ /* Normal song progression */
1311 lastid = playnext(playmode, false);
1308 last_song_id = playnext(false);
1312 1309 } }
1313 1310
1314 if (lastcursor == NULL)
1315 {
1311 if (lastcursor == NULL) {
1316 1312 lastcursor = disp->cursorsong(); lastcursor = disp->cursorsong();
1317 1313 } }
1318 1314
1319 return (lastid != MPD_SONG_NO_ID);
1315 return (last_song_id != MPD_SONG_NO_ID);
1320 1316 } }
1321 1317
1322 1318 /* /*
 
... ... void Pms::init_default_keymap()
1394 1390 bindings->add("b", "add-album"); bindings->add("b", "add-album");
1395 1391 bindings->add("B", "play-album"); bindings->add("B", "play-album");
1396 1392 bindings->add("delete", "remove"); bindings->add("delete", "remove");
1397 bindings->add("c", "cropsel");
1398 1393 bindings->add("C", "crop"); bindings->add("C", "crop");
1399 1394 bindings->add("insert", "toggle-select"); bindings->add("insert", "toggle-select");
1400 1395 bindings->add("F12", "activate-list"); bindings->add("F12", "activate-list");
 
... ... void Pms::init_default_keymap()
1411 1406 bindings->add("l", "next"); bindings->add("l", "next");
1412 1407 bindings->add("h", "prev"); bindings->add("h", "prev");
1413 1408 bindings->add("M", "mute"); bindings->add("M", "mute");
1414 bindings->add("m", "playmode");
1415 1409 bindings->add("r", "repeat"); bindings->add("r", "repeat");
1410 bindings->add("z", "random");
1411 bindings->add("c", "consume");
1412 bindings->add("s", "single");
1416 1413 bindings->add("+", "volume +5"); bindings->add("+", "volume +5");
1417 1414 bindings->add("-", "volume -5"); bindings->add("-", "volume -5");
1418 1415 bindings->add("left", "seek -5"); bindings->add("left", "seek -5");
File src/settings.cpp changed (mode: 100644) (index fdcb0ec..e4153d3)
... ... void Options::reset()
87 87 set_string("password", ""); set_string("password", "");
88 88
89 89 set("scroll", SETTING_TYPE_SCROLL, "normal"); set("scroll", SETTING_TYPE_SCROLL, "normal");
90 set("playmode", SETTING_TYPE_PLAYMODE, "linear");
91 set("repeat", SETTING_TYPE_REPEATMODE, "none");
92 90 set("columns", SETTING_TYPE_FIELDLIST, "artist track title album length"); set("columns", SETTING_TYPE_FIELDLIST, "artist track title album length");
93 91 set("sort", SETTING_TYPE_FIELDLIST, "track disc album date albumartistsort"); set("sort", SETTING_TYPE_FIELDLIST, "track disc album date albumartistsort");
94 92
 
... ... void Options::reset()
143 141
144 142 topbar[0]->strings[0] = _("%time_elapsed% %playstate% %time%%ifcursong% (%progresspercentage%%%)%endif%"); topbar[0]->strings[0] = _("%time_elapsed% %playstate% %time%%ifcursong% (%progresspercentage%%%)%endif%");
145 143 topbar[0]->strings[1] = _("%ifcursong%%artist%%endif%"); topbar[0]->strings[1] = _("%ifcursong%%artist%%endif%");
146 topbar[0]->strings[2] = _("Vol: %volume%%% Mode: %muteshort%%repeatshort%%randomshort%%manualshort%");
144 topbar[0]->strings[2] = _("Vol: %volume%%% Mode: %muteshort%%consumeshort%%repeatshort%%randomshort%%singleshort%");
147 145 topbar[1]->strings[1] = _("%ifcursong%==> %title% <==%else%No current song%endif%"); topbar[1]->strings[1] = _("%ifcursong%==> %title% <==%else%No current song%endif%");
148 146 topbar[2]->strings[0] = _("%listsize%"); topbar[2]->strings[0] = _("%listsize%");
149 147 topbar[2]->strings[1] = _("%ifcursong%%album% (%year%)%endif%"); topbar[2]->strings[1] = _("%ifcursong%%album% (%year%)%endif%");
 
... ... Setting * Options::set(string key, SettingType t, string val)
307 305 return NULL; return NULL;
308 306 break; break;
309 307
310 case SETTING_TYPE_REPEATMODE:
311 if (val == "single")
312 {
313 s->v_long = REPEAT_ONE;
314 }
315 else
316 {
317 if (Configurator::strtobool(val))
318 s->v_long = REPEAT_LIST;
319 else
320 s->v_long = REPEAT_NONE;
321 }
322 s->v_string = val;
323 break;
324
325 case SETTING_TYPE_PLAYMODE:
326 if (val == "manual")
327 set_long(key, PLAYMODE_MANUAL);
328 else if (val == "linear")
329 set_long(key, PLAYMODE_LINEAR);
330 else if (val == "random")
331 set_long(key, PLAYMODE_RANDOM);
332 else
333 {
334 pms->msg->clear();
335 pms->msg->code = CERR_INVALID_VALUE;
336 pms->msg->str = _("invalid play mode, expected 'manual', 'linear' or 'random'");
337 return NULL;
338 }
339 s->v_string = val;
340 break;
341
342 308 case SETTING_TYPE_SCROLL: case SETTING_TYPE_SCROLL:
343 309 if (val == "centered" || val == "centred") if (val == "centered" || val == "centred")
344 310 set_long(key, SCROLL_CENTERED); set_long(key, SCROLL_CENTERED);
File src/settings.h changed (mode: 100644) (index 0b30c4d..35838c0)
... ... typedef enum
46 46 SETTING_TYPE_LONG, SETTING_TYPE_LONG,
47 47 SETTING_TYPE_BOOLEAN, SETTING_TYPE_BOOLEAN,
48 48 SETTING_TYPE_FIELDLIST, SETTING_TYPE_FIELDLIST,
49 SETTING_TYPE_SCROLL,
50 SETTING_TYPE_PLAYMODE,
51 SETTING_TYPE_REPEATMODE
49 SETTING_TYPE_SCROLL
52 50 } }
53 51 SettingType; SettingType;
54 52
File src/types.h changed (mode: 100644) (index 91c7b26..ae3ab18)
1 /* vi:set ts=8 sts=8 sw=8:
1 /* vi:set ts=8 sts=8 sw=8 noet:
2 2 * *
3 3 * PMS <<Practical Music Search>> * PMS <<Practical Music Search>>
4 * Copyright (C) 2006-2010 Kim Tore Jensen
4 * Copyright (C) 2006-2015 Kim Tore Jensen
5 5 * *
6 6 * This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
7 7 * it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
 
... ... typedef enum
54 54 PEND_VOLUME, PEND_VOLUME,
55 55 PEND_MUTE, PEND_MUTE,
56 56 PEND_CROSSFADE, PEND_CROSSFADE,
57 PEND_CYCLE_PLAYMODE,
58 57 PEND_REPEAT, PEND_REPEAT,
58 PEND_RANDOM,
59 PEND_SINGLE,
60 PEND_CONSUME,
59 61
60 62 PEND_DELETE, PEND_DELETE,
61 63 PEND_SEEK, PEND_SEEK,
 
... ... typedef enum
128 130 } }
129 131 pms_pending_keys; pms_pending_keys;
130 132
131 /*
132 * Player state/mode
133 */
134 enum
135 {
136 PLAYMODE_MANUAL = 0,
137 PLAYMODE_LINEAR,
138 PLAYMODE_RANDOM
139 };
140
141
142 /*
143 * Repeat state
144 */
145 enum
146 {
147 REPEAT_NONE = 0,
148 REPEAT_ONE,
149 REPEAT_LIST
150 };
151
152 133
153 134 /* /*
154 135 * Scroll mode * Scroll mode
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