129
133
g_skype_dbus_conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
131
135
if (!g_skype_dbus_conn) {
132
LOG_ERROR("dbus_player_connect_to_dbus: Cannot connect to DBus: %s\n",
133
error ? error->message : "");
136
LOG_ERROR("skype_connect_to_dbus: Cannot connect to DBus: %s\n", (error ? error->message : ""));
136
139
g_error_free(error);
379
382
if (gui_msg1_sent < 2) {
380
383
// Send message to the GUI (normally a red message label)
381
dbus_player_send_notification(NULL,
382
// Translators: The "Public API" setting refers to Skype's Options -> Public API menu.
383
_("Access to Skype denied.\nAnswer YES to grant access to Skype.\nYou can enable/disable this in the Skype's \"Public API\" settings."));
384
skype_send_notification(
385
// Translators: The "Public API" setting refers to Skype's Options -> Public API menu.
386
_("Access to Skype denied.\nAnswer YES to grant access to Skype.\nYou can enable/disable this in the Skype's \"Public API\" settings."));
385
388
// Send only once
386
389
gui_msg1_sent += 1;
393
396
if (gui_msg2_sent < 2) {
394
397
// Send message to the GUI (normally a red message label)
395
398
// Translators: This message is shown in the GUI. A red label.
396
dbus_player_send_notification(NULL, _("Skype is offline. Cannot connect to Skype unless you login."));
399
skype_send_notification(_("Skype is offline. Cannot connect to Skype unless you login."));
398
401
// Send only once
399
402
gui_msg2_sent += 1;
442
445
// Got a sensible answer.
444
447
// Reset the GUI/error label
445
dbus_player_send_notification(NULL, NULL);
448
skype_send_notification(NULL);
447
450
// Settle PROTOCOL. Strictly, we should test the return value from skype_settle_protocol.
448
451
skype_settle_protocol();
466
void skype_get_app_name(MediaPlayerRec *player) {
467
// Set application name.
469
gchar *skype_get_app_name() {
470
// Return application name.
469
// Name of Skype application.
470
// Translators: English "Skype" name is OK:
471
player->app_name = g_strdup(_("Skype"));
472
// Name of the Skype application.
473
// Translators: English "Skype" name is OK:
474
return g_strdup(_("Skype"));
474
477
void skype_get_info(gpointer player_rec) {
475
MediaPlayerRec *player = (MediaPlayerRec*)player_rec;
480
481
gchar *skype_send_message(gchar *command) {
913
914
g_skype.paused = FALSE;
915
// Call dbus-player and rec-manager.
916
// We simply create a MediaPlayer record and send it to the dbus-player.c (it passes this further to rec-manager.c and gst-recorder.c)
918
MediaPlayerRec *player = mpris2_player_new(NULL);
919
TrackInfo *track = &player->track;
922
track->status = PLAYER_STATUS_PLAYING;
916
// Send message to rec-manager.c
918
// Create new RecorderCommand
919
RecorderCommand *cmd = g_malloc0(sizeof(RecorderCommand));
920
cmd->type = RECORDING_START;
924
922
// Set track name
925
str_copy(track->track, g_skype.filename, MPRIS_STRLEN-1);
923
cmd->track = g_strndup(g_skype.filename, DEF_STR_LEN);
927
925
// Set folder name as artist ;-)
928
str_copy(track->artist, skype_folder, MPRIS_STRLEN-1);
926
cmd->artist = g_strndup(skype_folder, DEF_STR_LEN);
930
928
// Set (call) partner name as album ;-)
931
str_copy(track->album, partner_name, MPRIS_STRLEN-1);
933
/// Send to the dbus-player.c
934
dbus_player_process_data(player);
936
// Now delete this MediaPlayerRec
937
dbus_player_delete_item(player);
929
cmd->album = g_strndup(partner_name, DEF_STR_LEN);
931
// We do not set these:
932
// cmd->track_pos = 0
933
// cmd->track_len = 0;
936
// Send command to rec-manager.c.
937
// It will free the cmd structure after processing.
938
rec_manager_send_command(cmd);
940
941
g_free(skype_program);
961
961
finished_ok = status && (!g_strcmp0(status, "FINISHED"));
964
// Call dbus-player and rec-manager.
965
// We simply create a MediaPlayer record and send it to the dbus-player.c (it passes this further to rec-manager.c and gst-recorder.c)
966
MediaPlayerRec *player = mpris2_player_new(NULL);
964
// Create new RecorderCommand
965
RecorderCommand *cmd = g_malloc0(sizeof(RecorderCommand));
966
cmd->type = RECORDING_STOP;
968
str_copy(player->track.track, g_skype.filename, MPRIS_STRLEN-1);
969
player->track.status = PLAYER_STATUS_STOPPED;
969
cmd->track = g_strndup(g_skype.filename, DEF_STR_LEN);
971
971
// Got DURATION messages and ok?
972
972
if (g_skype.call_duration < 1 && !finished_ok) {
975
975
LOG_SKYPE("Skype determines that the file is empty. Delete the recorded %s file.\n", g_skype.filename);
977
977
// Set the delete flag
978
player->track.flags = RECORDING_DELETE_FILE;
978
cmd->flags = RECORDING_DELETE_FILE;
981
/// Send to the dbus-player.c
982
dbus_player_process_data(player);
984
// Now delete this MediaPlayerRec
985
dbus_player_delete_item(player);
981
// Send command to rec-manager.c.
982
// It will free the cmd structure after processing.
983
rec_manager_send_command(cmd);
988
986
g_skype.call_no = 0;
989
987
g_skype.call_duration = 0;
990
988
g_skype.paused = FALSE;
992
if (g_skype.filename)
990
if (g_skype.filename) {
993
991
g_free(g_skype.filename);
995
994
g_skype.filename = NULL;
1001
1000
g_skype.paused = TRUE;
1002
1001
LOG_SKYPE("Skype: pause recording.\n");
1004
// Call dbus-player and rec-manager.
1005
// We simply create a MediaPlayer record and send it to the dbus-player.c (it passes this further to rec-manager.c and gst-recorder.c)
1006
MediaPlayerRec *player = mpris2_player_new(NULL);
1008
player->track.status = PLAYER_STATUS_PAUSED;
1010
/// Send to the dbus-player.c
1011
dbus_player_process_data(player);
1013
// Now delete this MediaPlayerRec
1014
dbus_player_delete_item(player);
1003
// Create new RecorderCommand
1004
RecorderCommand *cmd = g_malloc0(sizeof(RecorderCommand));
1005
cmd->type = RECORDING_PAUSE;
1008
cmd->track = g_strndup(g_skype.filename, DEF_STR_LEN);
1010
// Send command to rec-manager.c.
1011
// It will free the cmd structure after processing.
1012
rec_manager_send_command(cmd);
1017
1015
void skype_handle_CALL(gchar *msg) {
1257
static void skype_send_notification(gchar *msg) {
1258
RecorderCommand *cmd = g_malloc0(sizeof(RecorderCommand));
1259
cmd->type = RECORDING_NOTIFY_MSG;
1260
cmd->track = g_strndup(msg, DEF_STR_LEN);
1262
// Send command to rec-manager.c.
1263
// It will free the cmd structure after processing.
1264
rec_manager_send_command(cmd);