Permalink
Browse files

* 2008-04-02, jkramer

	- printing non-printable characters in readline now
	- fixed pause timer
	- added patch by Lars-Dominik Braun that allows to change the time after
	  which a track may be scrobbled
	- fixed radio history so the last station comes up first on arrow-up on the
	  prompt
	- extended manual


git-svn-id: svn://nex.scrapping.cc/shell-fm/trunk@306 7df44517-d413-0410-91cf-82ca28b36b55
  • Loading branch information...
1 parent e5b48d8 commit 08750ee5cb0324aa31a35c6a10574f2f91e6fdd1 jkr committed Apr 2, 2008
View
37 AUTHORS
@@ -1,28 +1,17 @@
-Jonas Kramer (shell-monkey)
- * everything else that's not listed below :)
+* Jonas Kramer
+* Bart Trojanowski
+* Jacek Nitkiewicz
+* Helmut Maierthaler
+* Nguyen Thai Ngoc Duy
+* Ondrej Novy
+* Csaba Henk
-Bart Trojanowski (bartman)
- * radio station URI completion
- * several bugfixes
- * command line help
- * Makefile fixes / improvements
+NOTE: I've removed the information about who did what, since during the
+development almost everything anyone added has been changed/replaced at some
+time by me or others and it's impossible to track everything. So I'll just list
+all the names of the people who contributed something at some time here. Of
+course the details are still in the subversion commit log.
-Jacek Nitkiewicz (jacek)
- * several bugfixes and improvements
- * configure / Makefile stuff
-
-Helmut Maierthaler (b1u3)
- * pause and stop keys
-
-Nguyen Thai Ngoc Duy (pclouds)
- * libao support
-
-Ondrej Novy
- * improvements on shell-fm bevaviour when last.fm lags
-
-Csaba Henk
- * proxy support
-
-Please mail me (jonas.kramer@gmx.net) if your name is missing here.
+Please mail me (jonas.kramer@gmail.com) if your name is missing here.
If you want to praise or blame a developer for something particular,
search the SVN log.
View
9 CHANGES
@@ -1,3 +1,12 @@
+* 2008-04-02, jkramer
+ - printing non-printable characters in readline now
+ - fixed pause timer
+ - added patch by Lars-Dominik Braun that allows to change the time after
+ which a track may be scrobbled
+ - fixed radio history so the last station comes up first on arrow-up on the
+ prompt
+ - extended manual
+
* 2008-02-10, jkramer
- added helper scripts
View
14 INSTALL
@@ -1,5 +1,5 @@
-Shell.FM 0.4 Installation
+Shell.FM 0.5 Installation
Requirements:
@@ -12,3 +12,15 @@ Installation:
1. Run "make".
2. Run "make install" as root.
3. Read the manual for per-user setup information.
+
+NOTE: The Makefile uses /usr as destdir and $DESTDIR/man as MANDIR by default.
+You can override those on the command line. For example, Debian/Ubuntu users
+usually have their manuals in /usr/share/man, so they would install shell-fm
+like this:
+
+$ make install DESTDIR=/usr MANDIR=/usr/share/man
+
+NOTE: To install a stripped version of shell-fm (about 10K smaller), use
+"install-strip" instead of "install":
+
+$ make install-strip
View
37 manual/shell-fm.1
@@ -92,7 +92,8 @@ Quit.
.TP
.B r
Change radio station. This will prompt you for an Last.FM radio station URI.
-The tabulator key helps if you don't know what to type.
+The tabulator key helps if you don't know what to type. Arrow-Up and Arrow-Down
+allow you to browse your radio history.
.TP
.B R
Recommend the currently played track/artist/album to another Last.FM user.
@@ -232,6 +233,14 @@ command line option).
.B title-format = format-string
This is the format of the track string that is printed to the console for every
track played. Default is 'Now playing "%t" by %a.'.
+.TP
+.B minimum = percentage
+With this option you can change the minimum duration a track must have been
+played to be scrobbled (in percent, but without the % sign). For example, if
+this option is set to 75, the track will not be scrobbled if it has not been
+played for at least 75% of its total duration. If you skip or stop the track
+before it has been played for 75%, it will not be scrobbled. Default is 50%, as
+specified in the scrobbling protocol version 1.2.
.SH FORMAT FLAGS
There are several format flags allowed for some options. Here is the list.
.TP
@@ -370,6 +379,32 @@ Returns the tags of the currently played track.
.TP
.B stop
Stop stream.
+.SH FILES
+This section describes the meanings of the files in $HOME/.shell-fm/.
+.TP
+.B autoban
+This file contains the auto-banned artists.
+.TP
+.B bookmarks
+This file contains the bookmarked stations in the format "[digit] = [url]".
+.TP
+.B cache/
+This directory contains cached sites fetched from Last.FM for faster tab-completion etc.
+.TP
+.B i-template
+If this file exists, it will be used as a template for the output of 'i'. It
+may contain usual format flags.
+.TP
+.B radio-history
+The radio stations you have listened to. The history is used for the radio prompt.
+.TP
+.B scrobble-cache
+If Shell.FM can't scrobble the data of a track for any reason before you quit,
+it stores the track data in here and it will try to submit the tracks the next
+time it is run.
+.TP
+.B shell-fm.rc
+Your configuration file as described above.
.SH BUGS
No bugs known at the moment. Please send bug reports to <shell-fm@nex.scrapping.cc>.
.SH COPYRIGHT
View
3 source/autoban.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - autoban.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
View
3 source/bookmark.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - bookmark.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
View
7 source/completion.c
@@ -1,11 +1,6 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - interface.c
Copyright (C) 2006 by Jonas Kramer
- Copyright (C) 2006 by Bart Trojanowski <bart@jukie.net>
-
- Published under the terms of the GNU General Public License (GPLv2).
+ Published under the terms of the GNU General Public License (GPL).
*/
#define _GNU_SOURCE
View
4 source/feeds.c
@@ -1,3 +1,7 @@
+/*
+ Copyright (C) 2006 by Jonas Kramer
+ Published under the terms of the GNU General Public License (GPL).
+*/
#define _GNU_SOURCE
View
2 source/getln.c
@@ -1,6 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
View
3 source/hash.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - hash.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
View
42 source/history.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - history.c
Copyright (C) 2007 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
@@ -20,47 +17,34 @@
#include "strary.h"
#include "util.h"
-int grep(char **, char *);
void histapp(const char * radio) {
+ char ** history;
+ const char * path = rcpath("radio-history");
FILE * fd;
- int match = 0;
if(!radio)
return;
if(!strncasecmp("lastfm://", radio, 9))
radio += 9;
- if((fd = fopen(rcpath("radio-history"), "r")) != NULL) {
- char * line = NULL;
- unsigned size = 0;
+ history = slurp(path);
+
+ if((fd = fopen(path, "w")) != NULL) {
+ if(history != NULL) {
+ unsigned i;
- while(!feof(fd)) {
- if(!getln(& line, & size, fd))
- continue;
-
- if(strlen(line) > 1) {
- char * ptr;
- if((ptr = strrchr(line, 10)) != NULL)
- * ptr = (char) 0;
- ptr = strncasecmp("lastfm://", line, 9) ? line : line + 9;
- match = !strncasecmp(line, radio, strlen(line));
+ for(i = 0; history[i] != NULL; ++i) {
+ if(strcmp(history[i], radio))
+ fprintf(fd, "%s\n", history[i]);
}
}
- if(line)
- free(line);
-
+ fprintf(fd, "%s\n", radio);
fclose(fd);
}
- if(!match) {
- if((fd = fopen(rcpath("radio-history"), "a+")) != NULL) {
- fprintf(fd, "%s\n", radio);
- fclose(fd);
- }
- }
-
- return;
+ if(history != NULL)
+ purge(history);
}
View
5 source/http.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - http.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
@@ -32,7 +29,7 @@
#ifndef USERAGENT
-#define USERAGENT "Shell.FM/0.4"
+#define USERAGENT "Shell.FM/" PACKAGE_VERSION
#endif
View
2 source/include/settings.h
@@ -5,7 +5,7 @@
#ifndef SHELLFM_SETTINGS
#define SHELLFM_SETTINGS
-#define PACKAGE_VERSION "0.4"
+#define PACKAGE_VERSION "0.5"
#include "hash.h"
View
3 source/interface.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - interface.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
View
28 source/main.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - main.c
Copyright (C) 2006-2008 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
@@ -251,14 +248,28 @@ int main(int argc, char ** argv) {
playfork would still be running.
*/
if(playnext) {
- unsigned
- duration = atoi(value(& track, "duration")) / 1000,
+ playfork = 0;
+
+ if(enabled(RTP)) {
+ unsigned duration, played, minimum;
+
+ duration = atoi(value(& track, "duration")) / 1000;
played = time(NULL) - changeTime - pauselength;
- playfork = 0;
+ /* Allow user to specify minimum playback length (min. 50%). */
+ if(haskey(& rc, "minimum")) {
+ unsigned percent = atoi(value(& rc, "minimum"));
+ if(percent < 50)
+ percent = 50;
+ minimum = duration * percent / 100;
+ }
+ else {
+ minimum = duration / 2;
+ }
- if(enabled(RTP) && duration > 29 && (played >= 240 || played > (duration / 2)))
- enqueue(& track);
+ if(duration >= 30 && (played >= 240 || played > minimum))
+ enqueue(& track);
+ }
submit(value(& rc, "username"), value(& rc, "password"));
@@ -288,6 +299,7 @@ int main(int argc, char ** argv) {
if(!playfork) {
if(play(& playlist)) {
time(& changeTime);
+ pauselength = 0;
set(& track, "stationURL", currentStation);
View
4 source/mix.c
@@ -1,3 +1,7 @@
+/*
+ Copyright (C) 2006 by Jonas Kramer
+ Published under the terms of the GNU General Public License (GPL).
+*/
#include <fcntl.h>
#include <sys/ioctl.h>
View
4 source/pipe.c
@@ -1,3 +1,7 @@
+/*
+ Copyright (C) 2006 by Jonas Kramer
+ Published under the terms of the GNU General Public License (GPL).
+*/
#define _GNU_SOURCE
View
4 source/play.c
@@ -1,8 +1,4 @@
-
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - play.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
View
1 source/playlist.c
@@ -1,5 +1,4 @@
/*
- Shell.FM - service.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
View
23 source/radio.c
@@ -1,10 +1,5 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - interface.c
Copyright (C) 2006 by Jonas Kramer
- Copyright (C) 2006 by Bart Trojanowski <bart@jukie.net>
-
Published under the terms of the GNU General Public License (GPLv2).
*/
@@ -39,24 +34,6 @@ static int radiocomplete(char *, const unsigned, int);
static char ** users = NULL, ** artists = NULL, ** overall = NULL;
-/*
- * This function is called to change the station
- * the user is prompted for the new radio station.
- *
- * Something like:
- *
- * lastfm://user/BartTrojanowski/loved
- * lastfm://user/BartTrojanowski/personal
- * lastfm://user/BartTrojanowski/neighbour
- * lastfm://user/BartTrojanowski/recommended/100
- * lastfm://usertags/BartTrojanowski/trance
- * lastfm://artist/QED/similarartists
- * lastfm://artist/QED/fans
- * lastfm://globaltags/goa
- * lastfm://globaltags/classical,miles davis,whatever
- * lastfm://multipleartists/QED,Chicane
- * lastfm://play/tracks/########[,#####, ...]
- */
void radioprompt(const char * prompt) {
char * url, * decoded = NULL;
View
9 source/readline.c
@@ -1,3 +1,7 @@
+/*
+ Copyright (C) 2006 by Jonas Kramer
+ Published under the terms of the GNU General Public License (GPL).
+*/
#define _GNU_SOURCE
@@ -122,13 +126,12 @@ char * readline(struct prompt * setup) {
break;
}
}
- } else if(isprint(key)) {
+ }
+ else {
if(length < sizeof(line)) {
line[length++] = key;
fputc(key, stderr);
}
- } else {
- fprintf(stderr, "<%d>", key);
}
}
}
View
4 source/recommend.c
@@ -1,3 +1,7 @@
+/*
+ Copyright (C) 2006 by Jonas Kramer
+ Published under the terms of the GNU General Public License (GPL).
+*/
#include <stdlib.h>
#include <stdio.h>
View
3 source/ropen.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - ropen.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
View
3 source/sckif.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - sckif.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
View
1 source/service.c
@@ -1,5 +1,4 @@
/*
- Shell.FM - service.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
View
3 source/settings.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - settings.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
View
3 source/split.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - split.c
Copyright (C) 2006 by Jonas Kramer
Published under the terms of the GNU General Public License (GPL).
*/
View
4 source/strary.c
@@ -1,10 +1,8 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
Copyright (C) 2006 by Jonas Kramer
Copyright (C) 2006 by Bart Trojanowski <bart@jukie.net>
- Published under the terms of the GNU General Public License (GPLv2).
+ Published under the terms of the GNU General Public License (GPL).
*/
#define _GNU_SOURCE
View
4 source/submit.c
@@ -1,3 +1,7 @@
+/*
+ Copyright (C) 2006 by Jonas Kramer
+ Published under the terms of the GNU General Public License (GPL).
+*/
#include <stdio.h>
#include <string.h>
View
3 source/tag.c
@@ -1,7 +1,4 @@
/*
- vim:syntax=c tabstop=2 shiftwidth=2 noexpandtab
-
- Shell.FM - interface.c
Copyright (C) 2006 by Jonas Kramer
Copyright (C) 2006 by Bart Trojanowski <bart@jukie.net>
View
4 source/util.c
@@ -1,3 +1,7 @@
+/*
+ Copyright (C) 2006 by Jonas Kramer
+ Published under the terms of the GNU General Public License (GPL).
+*/
#define _GNU_SOURCE
View
4 source/xmlrpc.c
@@ -1,3 +1,7 @@
+/*
+ Copyright (C) 2006 by Jonas Kramer
+ Published under the terms of the GNU General Public License (GPL).
+*/
#include <string.h>
#include <stdarg.h>

0 comments on commit 08750ee

Please sign in to comment.