Skip to content

Commit

Permalink
Merge branch 'release/2018.10.30'
Browse files Browse the repository at this point in the history
  • Loading branch information
thedmd committed Oct 30, 2018
2 parents cd5c650 + 82a13ad commit cb6789b
Show file tree
Hide file tree
Showing 20 changed files with 212 additions and 62 deletions.
19 changes: 19 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Subject of the issue
Briefly describe your issue here.

### Your environment
* version of pianobar
* your Linux distribution and release version
* ffmpeg/libav version and the flags it was compiled with (if you compiled yourself)
* your config file

### Steps to reproduce
Tell us how to reproduce this issue.

### Expected behaviour
Tell us what should happen.

### Actual behaviour
Tell us what happens instead, including a copy of all error messages.


35 changes: 35 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Release 2018.10.30
- Sync with 2018.10.15 pianobar state

Release 2015.12.10
- Fix: Fix I/O on Windows 8.x and Windows 10
- Fix: Improve Windows Media Foundation backend
Expand All @@ -24,6 +27,38 @@ Initial port

Pre-port changelog:

Release 2018.06.22

- Happy 10th birthday pianobar!
- Add network timeouts and retries
- Fix cross-thread memory access
- Misc UI and documentation improvements

Release 2017.08.30

- Support binding to specific network interface, see config option bind_to
- New config option gain_mul softens effect of replay gain
- Replaced deprecated ffmpeg and json-c functions, bumps ffmpeg/libav version
requirement
- Fix use-after-free
- Minor improvements to code and documentation

Release 2016.06.02

- Quit pianobar upon reception of two SIGINT
- Minor bugfixes

Release 2015.11.22

- Switch back to libcurl. tls_fingerprint setting has been replaced by
ca_bundle
- Interruptible network transactions (press ^C). Timeouts removed
- Config file parser fixes and improvements
- Player respects proxy, replaced deprecated api calls
- Added ability to change Pandora settings (username, password, explicit
content filter)
- The usual minor bugfixes/improvements here and there

Release 2014.09.28
- Fix segfault when retrieving station’s feedback list
- Refactored audio player
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pianobar is a console client for the personalized web radio [Pandora]
([http://www.pandora.com](http://www.pandora.com)) ported to Windows.
pianobar is a console client for the personalized web radio [Pandora](http://www.pandora.com) ported to Windows.

![pianobar](https://github.com/thedmd/pianobar-windows/blob/feature/appveyor/screenshots/pianobar.png)

Expand Down
10 changes: 5 additions & 5 deletions contrib/config-example
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@
#event_command = /home/user/.config/pianobar/eventcmd
#fifo = /tmp/pianobar
#sort = quickmix_10_name_az
#love_icon = [+]
#ban_icon = [-]
#volume = 0
#ca_bundle = /etc/ssl/certs/ca-certificates.crt
#gain_mul = 1.0

# Format strings
#format_nowplaying_song = %t by %a on %l%r%@%s
#format_nowplaying_song = %t by %a on %l%r%@%s
#ban_icon = </3
#love_icon = <3
#tired_icon = zZ
#format_nowplaying_station = Station %n
#format_list_song = %i) %a - %t%r
#format_list_song = %i) %a - %t%r (%d)%@%s

# high-quality audio (192k mp3, for Pandora One subscribers only!)
#audio_quality = high
#rpc_host = internal-tuner.pandora.com
#partner_user = pandora one
#partner_password = TVCKIBGS9AO9TSYLNNFUML0743LH82D
Expand Down
14 changes: 12 additions & 2 deletions contrib/eventcmd-examples/multi.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#!/bin/bash
#
# Executes all scripts located in ~/.config/pianobar/eventcmd.d/ as if they
# were called by pianobar directly
# Usage
# =====
#
# Set
#
# event_command = /path/to/multi.sh
#
# in pianobar’s config file. Then create the directory
# ~/.config/pianobar/eventcmd.d/, move your eventcmd scripts there and make
# them executable (chmod +x). They will be run in an unspecified order the same
# way the would have been run if pianobar called them directly (i.e. using
# event_command).

STDIN=`mktemp ${TMPDIR:-/tmp}/pianobar.XXXXXX`
cat >> $STDIN
Expand Down
29 changes: 24 additions & 5 deletions contrib/pianobar.1
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ or the key you defined in
.B act_songinfo.

.TP
.B ban_icon = </3
.B ban_icon = </3
Icon for banned songs.

.TP
Expand Down Expand Up @@ -255,6 +255,17 @@ Song title
.B %r
Rating icon

.B %d
Song duration

.B %@

The at_icon

.B %s

Song’s station, if not the current station.

.TP
.B format_msg_none = %s
.TQ
Expand Down Expand Up @@ -287,7 +298,7 @@ Song artist
Album name

.B %r
Rating icon (only love icon)
Rating icon

.B %@
.B at_icon
Expand Down Expand Up @@ -320,12 +331,12 @@ of gain adjustment.
Keep a history of the last n songs (5, by default). You can rate these songs.

.TP
.B love_icon = <3
.B love_icon = <3
Icon for loved songs.

.TP
.B max_player_errors = 5
Amount of song download errors in a row after pianobar stops playback.
.B max_retry = 3
Max failures for several actions before giving up.

.TP
.B partner_password = AC7IBG09A3DTSYM4R41UJWL07VLN8JI7
Expand Down Expand Up @@ -360,6 +371,14 @@ Sort station list by name or type (is quickmix) and name. name_az for example
sorts by name from a to z, quickmix_01_name_za by type (quickmix at the
bottom) and name from z to a.

.TP
.B timeout = 30
Network operation timeout.

.TP
.B tired_icon = zZ
Icon for temporarily suspended songs.

.TP
.B user = your@user.name
Your pandora.com username.
Expand Down
2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* package name */
#define PACKAGE "pianobar"

#define VERSION "2017.05.18"
#define VERSION "2018.10.30"

#define TITLE "Pianobar"

Expand Down
16 changes: 8 additions & 8 deletions src/http/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct _http_t {

static char* HttpToString(const wchar_t* wideString, int size);
static wchar_t* HttpToWideString(const char* string, int size);
static bool HttpCreateConnection (http_t http);
static bool HttpCreateConnection (http_t http, unsigned int timeOut);
static void HttpCloseConnection (http_t http);
static void HttpSetLastError (http_t http, const char* message);
static void HttpSetLastErrorW (http_t http, const wchar_t* message);
Expand Down Expand Up @@ -75,7 +75,7 @@ static wchar_t* HttpToWideString(const char* string, int size) {
}


static bool HttpCreateConnection (http_t http) {
static bool HttpCreateConnection (http_t http, unsigned int timeOut) {
INTERNET_PORT defaultPort = INTERNET_DEFAULT_PORT;

HttpCloseConnection (http);
Expand All @@ -89,10 +89,10 @@ static bool HttpCreateConnection (http_t http) {
WINHTTP_SAFE(http->session != NULL);

WinHttpSetTimeouts(http->session,
60 * 1000, // DNS time-out
60 * 1000, // connect time-out
30 * 1000, // send time-out
30 * 1000); // receive time-out
timeOut * 1000, // DNS time-out
timeOut * 1000, // connect time-out
timeOut * 1000, // send time-out
timeOut * 1000); // receive time-out

http->connection = WinHttpConnect(
http->session,
Expand Down Expand Up @@ -187,7 +187,7 @@ static char* HttpFormatWinHttpError (DWORD errorCode) {
return HttpFormatWinApiError(errorCode, NULL);
}

bool HttpInit(http_t* http, const char* endpoint, const char* securePort) {
bool HttpInit(http_t* http, const char* endpoint, const char* securePort, unsigned int timeOut) {
http_t out = malloc(sizeof(struct _http_t));
if (!out)
return false;
Expand All @@ -196,7 +196,7 @@ bool HttpInit(http_t* http, const char* endpoint, const char* securePort) {
out->endpoint = HttpToWideString(endpoint, -1);
out->securePort = HttpToWideString(securePort, -1);

if (!HttpCreateConnection (out)) {
if (!HttpCreateConnection (out, timeOut)) {
HttpDestroy (out);
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/http/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ THE SOFTWARE.

typedef struct _http_t *http_t;

bool HttpInit (http_t*, const char*, const char*);
bool HttpInit (http_t*, const char*, const char*, unsigned int);
void HttpDestroy (http_t);

bool HttpSetAutoProxy (http_t, const char*);
Expand Down
6 changes: 5 additions & 1 deletion src/libpiano/piano.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ void PianoDestroyRequest (PianoRequest_t *req) {
*/
PianoStation_t *PianoFindStationById (PianoStation_t * const stations,
const char * const searchStation) {
assert (searchStation != NULL);
assert (stations != NULL);

if (searchStation == NULL) {
return NULL;
}

PianoStation_t *currStation = stations;
PianoListForeachP (currStation) {
Expand Down
3 changes: 2 additions & 1 deletion src/libpiano/piano.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ typedef struct PianoStation {
typedef enum {
PIANO_RATE_NONE = 0,
PIANO_RATE_LOVE = 1,
PIANO_RATE_BAN = 2
PIANO_RATE_BAN = 2,
PIANO_RATE_TIRED = 3,
} PianoSongRating_t;

/* UNKNOWN should be 0, because memset sets audio format to 0 */
Expand Down
6 changes: 5 additions & 1 deletion src/libpiano/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
case PIANO_REQUEST_GET_STATIONS: {
/* get stations, user must be authenticated */
assert (ph->user.listenerId != NULL);

method = "user.getStationList";
break;
}
Expand Down Expand Up @@ -186,7 +187,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
assert (reqData != NULL);
assert (reqData->trackToken != NULL);
assert (reqData->stationId != NULL);
assert (reqData->rating != PIANO_RATE_NONE);
assert (reqData->rating != PIANO_RATE_NONE &&
reqData->rating != PIANO_RATE_TIRED);

json_object_object_add (j, "stationToken",
json_object_new_string (reqData->stationId));
Expand Down Expand Up @@ -397,6 +399,8 @@ PianoReturn_t PianoRequest (PianoHandle_t *ph, PianoRequest_t *req,
json_object_new_string (reqData->station->id));
json_object_object_add (j, "includeExtendedAttributes",
json_object_new_boolean (true));
json_object_object_add (j, "includeExtraParams",
json_object_new_boolean (true));

method = "station.getStation";
break;
Expand Down
12 changes: 11 additions & 1 deletion src/libpiano/response.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,13 @@ PianoReturn_t PianoResponse (PianoHandle_t *ph, PianoRequest_t *req) {
break;
}

case PIANO_REQUEST_ADD_TIRED_SONG: {
PianoSong_t * const song = req->data;
song->rating = PIANO_RATE_TIRED;
break;
}

case PIANO_REQUEST_ADD_SEED:
case PIANO_REQUEST_ADD_TIRED_SONG:
case PIANO_REQUEST_SET_QUICKMIX:
case PIANO_REQUEST_BOOKMARK_SONG:
case PIANO_REQUEST_BOOKMARK_ARTIST:
Expand Down Expand Up @@ -634,6 +639,11 @@ PianoReturn_t PianoResponse (PianoHandle_t *ph, PianoRequest_t *req) {
feedbackSong->rating = getBoolDefault (s, "isPositive",
false) ? PIANO_RATE_LOVE : PIANO_RATE_BAN;

json_object *v;
feedbackSong->length =
json_object_object_get_ex (s, "trackLength", &v) ?
json_object_get_int (v) : 0;

info->feedback = PianoListAppendP (info->feedback,
feedbackSong);
}
Expand Down
11 changes: 6 additions & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ static void BarMainStartPlayback(BarApp_t *app)
PIANO_RET_OK);

if (!BarPlayer2Play(app->player))
++app->playerErrors;
++app->retries;
else
app->playerErrors = 0;
app->retries = 0;
}
}

Expand All @@ -265,11 +265,11 @@ static void BarMainPlayerCleanup(BarApp_t *app)

BarConsoleSetTitle(TITLE);

if (app->playerErrors >= app->settings.maxPlayerErrors)
if (app->retries >= app->settings.maxRetry)
{
/* don't continue playback if thread reports too many error */
app->nextStation = NULL;
app->playerErrors = 0;
app->retries = 0;
}
}

Expand Down Expand Up @@ -411,7 +411,8 @@ int main(int argc, char **argv)
app.settings.keys[BAR_KS_HELP]);
}

HttpInit(&app.http2, app.settings.rpcHost, app.settings.rpcTlsPort);
HttpInit(&app.http2, app.settings.rpcHost, app.settings.rpcTlsPort,
app.settings.timeout);
if (app.settings.controlProxy)
HttpSetProxy(app.http2, app.settings.controlProxy);

Expand Down
2 changes: 1 addition & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ typedef struct {
PianoStation_t *curStation, *nextStation;
char doQuit;
BarReadline_t rl;
unsigned int playerErrors;
unsigned int retries;
} BarApp_t;

Loading

0 comments on commit cb6789b

Please sign in to comment.