1 #define VERSION "1.5" 2 3 #define IVAL_HOUR 1 4 #define IVAL_MIN 2 5 6 #include "pool.h" 7 #include "mynet.h" 8 #include "icy.h" 9 10 /* Currently played song */ 11 typedef struct currentSong 12 { 13 char *title; 14 char *artist; 15 } currentSong; 16 17 /* Command line arguments are stored here */ 18 typedef struct commandLine 19 { 20 char *dir; 21 char *logFile; 22 char *pidFile; 23 char *Next; 24 int pige; 25 int quiet; 26 int live; 27 int background; 28 int usePigeMeta; 29 int intervalType; 30 int useNumbers; 31 int weekBackup; 32 int interval; 33 int skipSongs; 34 int useGUI; 35 long long timeToStop; 36 } commandLine; 37 38 typedef struct cPigeUptime 39 { 40 unsigned int day; 41 unsigned int hour; 42 unsigned int min; 43 unsigned int sec; 44 } cPigeUptime; 45 46 typedef struct lastCut 47 { 48 int hour; 49 int min; 50 int sec; 51 } lastCut; 52 53 /* explicit ? */ 54 void print_credits (); 55 56 /* fetch song title from metadata */ 57 char *getTitle(char *titleString); 58 59 /* parse metadata */ 60 char *readMeta(int serversocket); 61 62 /* return a string pointer to print informations about current stream, 63 * like title, bytes received, ... 64 */ 65 char *statusLine(long long unsigned int uptime, long long unsigned int metacounter, int metaint, char *titre, char *nexttitre); 66 67 /* store informations about title currently played (for id3v1) */ 68 currentSong *getCurrentSong(char *titre); 69 70 /* Parse command line arguments */ 71 commandLine *parseCommandLine(int argc, char **argv); 72 void testCommandLine(); 73 74 /* print help ... */ 75 void print_help(); 76 77 /* getUptime */ 78 cPigeUptime *getUptime(long long unsigned int uptime); 79 char *getStats(long long unsigned int uptime, long long unsigned int metacounter, int metaint); 80 81 /* Intervals */ 82 int checkInterval(); 83 int mustCut(lastCut *cut); 84 int getCloserInterval(int now, int interval); 85 void checkWeekBackup(); 86 87 #ifndef WIN32 88 int getSongs(char *dir); 89 #endif 90 91 #define IS_PRINTABLE(c) (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9')) || (c == '-') || (c == ' ') || (c == '@')) 92 93