aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-09 19:24:21 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-09 19:24:21 +0000
commit4abf1b7d56425be009c8d6826a753b8682bc7c22 (patch)
tree36cbd797eafc8478439edb4b771cdfb921bda322 /src
parent6a87c49d2b619afb599a7961521f685a497ec9d4 (diff)
downloadmpd-4abf1b7d56425be009c8d6826a753b8682bc7c22.tar.gz
mpd-4abf1b7d56425be009c8d6826a753b8682bc7c22.tar.xz
mpd-4abf1b7d56425be009c8d6826a753b8682bc7c22.zip
remove all tables.... (stupid crappy code)
git-svn-id: https://svn.musicpd.org/mpd/branches/r2562-metadata-handling-rewrite@2564 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/command.c4
-rw-r--r--src/main.c3
-rw-r--r--src/player.c2
-rw-r--r--src/song.c10
-rw-r--r--src/stats.c5
-rw-r--r--src/tables.c200
-rw-r--r--src/tables.h43
8 files changed, 4 insertions, 265 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 5897f5e1c..98a5412fe 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,7 +51,6 @@ mpd_headers = \
song.h \
stats.h \
tag.h \
- tables.h \
utf8.h \
utils.h \
volume.h
@@ -93,7 +92,6 @@ mpd_SOURCES = \
signal_check.c \
song.c \
stats.c \
- tables.c \
tag.c \
utils.c \
volume.c \
diff --git a/src/command.c b/src/command.c
index 6341972cf..a179c2af4 100644
--- a/src/command.c
+++ b/src/command.c
@@ -21,7 +21,6 @@
#include "playlist.h"
#include "ls.h"
#include "directory.h"
-#include "tables.h"
#include "volume.h"
#include "path.h"
#include "stats.h"
@@ -588,7 +587,8 @@ int handleList(FILE * fp, unsigned int * permission, int argArrayLength,
char * arg1 = NULL;
if(argArrayLength==3) arg1 = argArray[2];
- return printAllKeysOfTable(fp,argArray[1],arg1);
+ //return printAllKeysOfTable(fp,argArray[1],arg1);
+ return 0;
}
int handleMove(FILE * fp, unsigned int * permission, int argArrayLength,
diff --git a/src/main.c b/src/main.c
index bb1146cb0..63fd5380f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -20,7 +20,6 @@
#include "command.h"
#include "playlist.h"
#include "directory.h"
-#include "tables.h"
#include "player.h"
#include "listen.h"
#include "conf.h"
@@ -415,7 +414,6 @@ int main(int argc, char * argv[]) {
initPermissions();
initReplayGainState();
- initTables();
initPlaylist();
initInputPlugins();
@@ -450,7 +448,6 @@ int main(int argc, char * argv[]) {
freeAllInterfaces();
closeAllListenSockets();
closeMp3Directory();
- closeTables();
finishPlaylist();
freePlayerData();
finishAudioDriver();
diff --git a/src/player.c b/src/player.c
index c16cad22e..8f217b091 100644
--- a/src/player.c
+++ b/src/player.c
@@ -25,7 +25,6 @@
#include "listen.h"
#include "log.h"
#include "utils.h"
-#include "tables.h"
#include "directory.h"
#include "volume.h"
#include "playerData.h"
@@ -116,7 +115,6 @@ int playerInit() {
freeAllInterfaces();
closeMp3Directory();
finishPlaylist();
- closeTables();
finishPermissions();
finishCommands();
finishVolume();
diff --git a/src/song.c b/src/song.c
index 06dd67a89..fac103fad 100644
--- a/src/song.c
+++ b/src/song.c
@@ -19,13 +19,11 @@
#include "song.h"
#include "ls.h"
#include "directory.h"
-#include "tables.h"
#include "utils.h"
#include "tag.h"
#include "log.h"
#include "path.h"
#include "playlist.h"
-#include "tables.h"
#include "inputPlugin.h"
#define SONG_KEY "key: "
@@ -72,7 +70,6 @@ Song * newSong(char * utf8url, SONG_TYPE type) {
freeSong(song);
song = NULL;
}
- else addSongToTables(song);
}
return song;
@@ -80,7 +77,6 @@ Song * newSong(char * utf8url, SONG_TYPE type) {
void freeSong(Song * song) {
deleteASongFromPlaylist(song);
- if(song->type == SONG_TYPE_FILE) removeASongFromTables(song);
free(song->utf8url);
if(song->tag) freeMpdTag(song->tag);
free(song);
@@ -172,23 +168,19 @@ void insertSongIntoList(SongList * list, ListNode ** nextSongNode, char * key,
if(!(*nextSongNode)) {
insertInList(list,key,(void *)song);
- addSongToTables(song);
}
else if(cmpRet == 0) {
Song * tempSong = (Song *)((*nextSongNode)->data);
if(tempSong->mtime != song->mtime) {
- removeASongFromTables(tempSong);
freeMpdTag(tempSong->tag);
tempSong->tag = song->tag;
tempSong->mtime = song->mtime;
song->tag = NULL;
- addSongToTables(tempSong);
}
freeJustSong(song);
*nextSongNode = (*nextSongNode)->nextNode;
}
else {
- addSongToTables(song);
insertInListBeforeNode(list,*nextSongNode,key,(void *)song);
}
}
@@ -272,7 +264,6 @@ int updateSongInfo(Song * song) {
if(song->type == SONG_TYPE_FILE) {
InputPlugin * plugin;
- removeASongFromTables(song);
if(song->tag) freeMpdTag(song->tag);
song->tag = NULL;
@@ -283,7 +274,6 @@ int updateSongInfo(Song * song) {
if(song->tag) validateUtf8Tag(song->tag);
}
if(!song->tag || song->tag->time<0) return -1;
- else addSongToTables(song);
}
return 0;
diff --git a/src/stats.c b/src/stats.c
index b114e1764..1daeb26e7 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -18,7 +18,6 @@
#include "stats.h"
-#include "tables.h"
#include "directory.h"
#include "myfprintf.h"
#include "player.h"
@@ -35,8 +34,8 @@ void initStats() {
}
int printStats(FILE * fp) {
- myfprintf(fp,"artists: %li\n",numberOfArtists());
- myfprintf(fp,"albums: %li\n",numberOfAlbums());
+ /*myfprintf(fp,"artists: %li\n",numberOfArtists());
+ myfprintf(fp,"albums: %li\n",numberOfAlbums());*/
myfprintf(fp,"songs: %i\n",stats.numberOfSongs);
myfprintf(fp,"uptime: %li\n",time(NULL)-stats.daemonStart);
myfprintf(fp,"playtime: %li\n",(long)(getPlayerTotalPlayTime()+0.5));
diff --git a/src/tables.c b/src/tables.c
deleted file mode 100644
index a29f60163..000000000
--- a/src/tables.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/* the Music Player Daemon (MPD)
- * (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
- * This project's homepage is: http://www.musicpd.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "tables.h"
-#include "list.h"
-#include "command.h"
-#include "utils.h"
-#include "myfprintf.h"
-
-#include <string.h>
-
-#define TABLES_ARTIST "artist"
-#define TABLES_ALBUM "album"
-
-List * albumTable;
-List * artistTable;
-
-typedef struct _ArtistData {
- int songs;
- List * albums;
-} ArtistData;
-
-ArtistData * newArtistData() {
- ArtistData * ad = malloc(sizeof(ArtistData));
-
- ad->songs = 0;
- ad->albums = makeList(free);
-
- return ad;
-}
-
-void freeArtistData(ArtistData * ad) {
- freeList(ad->albums);
-}
-
-void initTables() {
- albumTable = makeList(free);
- artistTable = makeList((ListFreeDataFunc *)freeArtistData);
-}
-
-void closeTables() {
- freeList(albumTable);
- freeList(artistTable);
-}
-
-void addSongToSomeAlbumTable(List * table, Song * song) {
- void * songs;
- if(!song->tag) return;
- if(!song->tag->album || !strlen(song->tag->album)) return;
- if(!findInList(table,song->tag->album,&songs)) {
- songs = malloc(sizeof(int));
- *((int *)songs) = 0;
- insertInList(table,song->tag->album,songs);
- }
- (*((int *)songs))++;
-}
-
-void addSongToAlbumTable(Song * song) {
- addSongToSomeAlbumTable(albumTable,song);
-}
-
-void addSongToArtistTable(Song * song) {
- void * artist;
- if(!song->tag) return;
- if(!song->tag->artist || !strlen(song->tag->artist)) return;
- if(!findInList(artistTable,song->tag->artist,&artist)) {
- artist = newArtistData();
- insertInList(artistTable,song->tag->artist,artist);
- }
- ((ArtistData *)artist)->songs++;
- addSongToSomeAlbumTable(((ArtistData *)artist)->albums,song);
-}
-
-void addSongToTables(Song * song) {
- addSongToAlbumTable(song);
- addSongToArtistTable(song);
-}
-
-void removeSongFromSomeAlbumTable(List * table, Song * song) {
- void * songs;
-
- if(!song->tag) return;
- if(!song->tag->album || !strlen(song->tag->album)) return;
- if(findInList(table,song->tag->album,&songs)) {
- (*((int *)songs))--;
- if(*((int *)songs)<=0) {
- deleteFromList(table,song->tag->album);
- }
- }
-}
-
-void removeSongFromAlbumTable(Song * song) {
- removeSongFromSomeAlbumTable(albumTable,song);
-}
-
-void removeSongFromArtistTable(Song * song) {
- void * artist;
-
- if(!song->tag) return;
- if(!song->tag->artist || !strlen(song->tag->artist)) return;
- if(findInList(artistTable,song->tag->artist,&artist)) {
- removeSongFromSomeAlbumTable(((ArtistData *)artist)->albums,
- song);
- ((ArtistData*)artist)->songs--;
- if(((ArtistData *)artist)->songs<=0) {
- deleteFromList(artistTable,song->tag->artist);
- }
- }
-}
-
-void removeASongFromTables(Song * song) {
- removeSongFromAlbumTable(song);
- removeSongFromArtistTable(song);
-}
-
-unsigned long numberOfSongs() {
- return 0;
-}
-
-unsigned long numberOfArtists() {
- return artistTable->numberOfNodes;
-}
-
-unsigned long numberOfAlbums() {
- return albumTable->numberOfNodes;
-}
-
-int printAllArtists(FILE * fp) {
- ListNode * node = artistTable->firstNode;
-
- while(node) {
- myfprintf(fp,"Artist: %s\n",node->key);
- node = node->nextNode;
- }
-
- return 0;
-}
-
-int printAllAlbums(FILE * fp, char * artist) {
- if(artist==NULL) {
- ListNode * node = albumTable->firstNode;
-
- while(node) {
- myfprintf(fp,"Album: %s\n",node->key);
- node = node->nextNode;
- }
- }
- else {
- void * ad;
-
- if(findInList(artistTable,artist,&ad)) {
- ListNode * node = ((ArtistData *)ad)->albums->firstNode;
- while(node) {
- myfprintf(fp,"Album: %s\n",node->key);
- node = node->nextNode;
- }
- }
- else {
- commandError(fp, ACK_ERROR_NO_EXIST,
- "artist \"%s\" not found", artist);
- return -1;
- }
- }
-
- return 0;
-}
-
-int printAllKeysOfTable(FILE * fp, char * table, char * arg1) {
- if(strcmp(table,TABLES_ARTIST)==0) {
- if(arg1!=NULL) {
- commandError(fp, ACK_ERROR_ARG,
- "%s table takes no args", table);
- return -1;
- }
- return printAllArtists(fp);
- }
- else if(strcmp(table,TABLES_ALBUM)==0) {
- return printAllAlbums(fp,arg1);
- }
- else {
- commandError(fp, ACK_ERROR_ARG, "unknown table", table);
- return -1;
- }
-}
diff --git a/src/tables.h b/src/tables.h
deleted file mode 100644
index e797f638a..000000000
--- a/src/tables.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* the Music Player Daemon (MPD)
- * (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
- * This project's homepage is: http://www.musicpd.org
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef TABLES_H
-#define TABLES_H
-
-#include "../config.h"
-
-#include "song.h"
-
-#include <stdio.h>
-
-void initTables();
-void closeTables();
-
-void addSongToTables(Song * song);
-
-void removeASongFromTables(Song * song);
-
-unsigned long numberOfSongs();
-
-unsigned long numberOfArtists();
-
-unsigned long numberOfAlbums();
-
-int printAllKeysOfTable(FILE * fp, char * table, char * arg1);
-
-#endif