- Finished up cddb_daemon. Still some cleanup needed here and there but it works.
- Added it to the image. - Anyone wants to come up with an icon for it? :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30736 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -86,7 +86,7 @@ SYSTEM_LIBS = libbe.so $(HAIKU_LIBSTDC++) libmedia.so libtracker.so
|
||||
;
|
||||
SYSTEM_SERVERS = registrar debug_server syslog_daemon media_server
|
||||
net_server media_addon_server input_server app_server fake_app_server
|
||||
midi_server print_server mail_daemon
|
||||
midi_server print_server mail_daemon cddb_daemon
|
||||
;
|
||||
|
||||
SYSTEM_NETWORK_DEVICES = ethernet loopback ;
|
||||
|
||||
@@ -2,6 +2,8 @@ SubDir HAIKU_TOP src servers cddb_daemon ;
|
||||
|
||||
UsePrivateHeaders drivers ;
|
||||
|
||||
AddResources cddb_daemon : cddb_daemon.rdef ;
|
||||
|
||||
Server cddb_daemon :
|
||||
cddb_daemon.cpp
|
||||
cddb_server.cpp
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <Directory.h>
|
||||
#include <Entry.h>
|
||||
#include <NodeMonitor.h>
|
||||
#include <Message.h>
|
||||
#include <Volume.h>
|
||||
@@ -193,12 +194,54 @@ CDDBDaemon::_WriteCDData(dev_t device, QueryResponseData* diskData,
|
||||
BVolume volume(device);
|
||||
|
||||
status_t result;
|
||||
if ((result = volume.SetName((diskData->title).String())) != B_OK) {
|
||||
BString name = diskData->artist << " - " << diskData->title;
|
||||
if ((result = volume.SetName(name.String())) != B_OK) {
|
||||
printf("Can't set volume name.\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
return B_ERROR;
|
||||
// Rename tracks and add relevant Audio attributes.
|
||||
BDirectory cddaRoot;
|
||||
volume.GetRootDirectory(&cddaRoot);
|
||||
|
||||
BEntry entry;
|
||||
int cnt = 0;
|
||||
while (cddaRoot.GetNextEntry(&entry) == B_OK) {
|
||||
TrackData* data = (TrackData*)((readResponse->tracks).ItemAt(cnt));
|
||||
|
||||
// Update name.
|
||||
if ((result = entry.Rename((data->title).String())) != B_OK) {
|
||||
// Failed renaming one entry. Abort processing.
|
||||
printf("Failed renaming entry at index %d. Aborting.\n", cnt);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Add relevant attributes. We consider an error here as non-fatal.
|
||||
BNode node(&entry);
|
||||
node.WriteAttr("Audio:Title", B_STRING_TYPE, 0, (data->title).String(),
|
||||
(data->title).Length());
|
||||
node.WriteAttr("Audio:Album", B_STRING_TYPE, 0,
|
||||
(readResponse->title).String(),
|
||||
(readResponse->title).Length());
|
||||
node.WriteAttr("Audio:Genre", B_STRING_TYPE, 0,
|
||||
(readResponse->genre).String(),
|
||||
(readResponse->genre).Length());
|
||||
node.WriteAttr("Audio:Year", B_INT32_TYPE, 0, &(readResponse->year),
|
||||
sizeof(int32));
|
||||
|
||||
if (data->artist == "") {
|
||||
node.WriteAttr("Audio:Artist", B_STRING_TYPE, 0,
|
||||
(readResponse->artist).String(),
|
||||
(readResponse->artist).Length());
|
||||
} else {
|
||||
node.WriteAttr("Audio:Artist", B_STRING_TYPE, 0,
|
||||
(data->artist).String(), (data->artist).Length());
|
||||
}
|
||||
|
||||
cnt++;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
resource app_signature "application/x-vnd.Haiku-cddb_daemon";
|
||||
|
||||
resource app_flags B_BACKGROUND_APP;
|
||||
|
||||
resource app_version {
|
||||
major = 1,
|
||||
middle = 0,
|
||||
minor = 0,
|
||||
|
||||
variety = B_APPV_FINAL,
|
||||
internal = 3,
|
||||
|
||||
short_info = "Haiku CDDB Daemon",
|
||||
long_info = "Haiku CDDB Daemon ©2009 Haiku"
|
||||
};
|
||||
Reference in New Issue
Block a user