#define MP_REQ_TYPE_SHORTCUT_DESC "shortcut_desc"
//for supprot nowplaying list in PD
-#define MP_NOWPLAYING_LIST_DATA MP_INI_DIR"/MpPlayingList.dat"
+#define MP_NOWPLAYING_LIST_DATA "MpPlayingList.dat"
//for supprot group list in PD
-#define MP_GROUP_LIST_DATA MP_INI_DIR"/MpGroupList.dat"
+#define MP_GROUP_LIST_DATA "MpGroupList.dat"
-#define MP_NOWPLAYING_INI_FILE_NAME MP_INI_DIR"/now_playing.ini"
+#define MP_NOWPLAYING_INI_FILE_NAME "now_playing.ini"
#define MP_AUTO_PLAYLIST_ITEM_MAX 50
#endif
/*as all the items are removed, remove now-playing.ini to avoid copy the same track but in DB, they are different*/
- mp_file_remove(MP_NOWPLAYING_INI_FILE_NAME);
+ char *data_path = app_get_data_path();
+ char nowplaying_ini[1024] = {0};
+ snprintf(nowplaying_ini, 1024, "%s%s", data_path, MP_NOWPLAYING_INI_FILE_NAME);
+ mp_file_remove(nowplaying_ini);
/* remove playing_track.ini to avoid lockscreen still using the file content*/
+ char playing_ini[1024] = {0};
#ifndef MP_SOUND_PLAYER
- mp_file_remove(MP_PLAYING_INI_FILE_NAME_MUSIC);
+ snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_MUSIC);
+ free(data_path);
+ mp_file_remove(playing_ini);
#else
- mp_file_remove(MP_PLAYING_INI_FILE_NAME_SOUND);
+ snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_SOUND);
+ free(data_path);
+ mp_file_remove(playing_ini);
#endif
} else if (next_play) {
mp_play_new_file(ad, true);
ERROR_TRACE("Fail to register KEY_MUSIC_MENU_CHANGE key callback [%d]", retcode);
res = FALSE;
}
- ecore_file_monitor_add(MP_NOW_PLAYING_ID_INI, mp_app_now_playing_id_changed_cb, ad);
+ char *path = app_get_data_path();
+ char now_playing_id[1024] = {0};
+
+ snprintf(now_playing_id, 1024, "%s%s", path, MP_NOW_PLAYING_ID_INI);
+ free(path);
+ ecore_file_monitor_add(now_playing_id, mp_app_now_playing_id_changed_cb, ad);
if (storage_set_state_changed_cb(ad->externalStorageId, _mp_app_storage_state_changed_cb, ad) < 0) {
ERROR_TRACE("Fail to register storage state changed callback");
mp_common_create_playlist_mgr();
mp_playlist_mgr_clear(ad->playlist_mgr);
- mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, MP_NOWPLAYING_LIST_DATA, last_played_path, -1);
+ char *data_path = app_get_data_path();
+ char nowplaying_list_data[1024] = {0};
+ snprintf(nowplaying_list_data, 1024, "%s%s", data_path, MP_NOWPLAYING_LIST_DATA);
+ free(data_path);
+ mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, nowplaying_list_data, last_played_path, -1);
if (mp_playlist_mgr_count(ad->playlist_mgr) == 0) {
mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, &count);
}
#endif
+ char *data_path = app_get_data_path();
/*as all the items are removed, remove now-playing.ini to avoid copy the same track but in DB, they are different*/
- mp_file_remove(MP_NOWPLAYING_INI_FILE_NAME);
+ char nowplaying_ini[1024] = {0};
+ snprintf(nowplaying_ini, 1024, "%s%s", data_path, MP_NOWPLAYING_INI_FILE_NAME);
+ mp_file_remove(nowplaying_ini);
/* remove playing_track.ini to avoid lockscreen still using the file content*/
+
+ char playing_ini[1024] = {0};
#ifndef MP_SOUND_PLAYER
- mp_file_remove(MP_PLAYING_INI_FILE_NAME_MUSIC);
+ snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_MUSIC);
+ free(data_path);
+ mp_file_remove(playing_ini);
#else
- mp_file_remove(MP_PLAYING_INI_FILE_NAME_SOUND);
+ snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_SOUND);
+ free(data_path);
+ mp_file_remove(playing_ini);
#endif
} else if (next_play) {
mp_play_new_file(ad, true);
int i;
- fp = fopen(MP_NOWPLAYING_LIST_DATA, "w");
+ char *data_path = app_get_data_path();
+ char nowplaying_list_data[1024] = {0};
+ snprintf(nowplaying_list_data, 1024, "%s%s", data_path, MP_NOWPLAYING_LIST_DATA);
+ free(data_path);
+ fp = fopen(nowplaying_list_data, "w");
if (fp == NULL) {
- SECURE_ERROR("Failed to open ini files. : %s", MP_NOWPLAYING_LIST_DATA);
+ SECURE_ERROR("Failed to open ini files. : %s", nowplaying_list_data);
return;
}
{
startfunc;
- FILE *fp = fopen(MP_NOW_PLAYING_ID_INI, "w"); /* make new file. */
+ char *path = app_get_data_path();
+ char now_playing_id[1024] = {0};
+
+ snprintf(now_playing_id, 1024, "%s%s", path, MP_NOW_PLAYING_ID_INI);
+ free(path);
+ FILE *fp = fopen(now_playing_id, "w"); /* make new file. */
if (fp == NULL) {
- SECURE_ERROR("Failed to open ini files. : %s", MP_NOW_PLAYING_ID_INI);
+ SECURE_ERROR("Failed to open ini files. : %s", now_playing_id);
return;
}
FILE *fp = NULL;
char line[MAX_NAM_LEN + 1];
int pid = -1;
- if ((fp = fopen(MP_NOW_PLAYING_ID_INI, "r")) == NULL) {
- DEBUG_TRACE("unable to open %s/shared/data/NowPlayingId.ini", DATA_PREFIX);
+ char *path = app_get_data_path();
+ char now_playing_id[1024] = {0};
+
+ snprintf(now_playing_id, 1024, "%s%s", path, MP_NOW_PLAYING_ID_INI);
+ free(path);
+ if ((fp = fopen(now_playing_id, "r")) == NULL) {
+ DEBUG_TRACE("unable to open %s", now_playing_id);
return -1;
}
if (fgets(line, MAX_NAM_LEN, fp)) { /* #Nowplaying */
return;
}
- FILE *fp = fopen(MP_PLAY_STATE, "w"); /* make new file. */
+ char *path = app_get_data_path();
+ char play_state[1024] = {0};
+ snprintf(play_state, 1024, "%s%s", path, MP_PLAY_STATE);
+ free(path);
+ FILE *fp = fopen(play_state, "w"); /* make new file. */
if (fp == NULL) {
- SECURE_ERROR("Failed to open ini files. : %s", MP_PLAY_STATE);
+ SECURE_ERROR("Failed to open ini files. : %s", play_state);
return;
}
MP_CHECK(item);
MP_CHECK(ad->current_track_info);
+ char *data_path = app_get_data_path();
+ char playing_ini[1024] = {0};
#ifndef MP_SOUND_PLAYER
- fp = fopen(MP_PLAYING_INI_FILE_NAME_MUSIC, "w"); /* make new file. */
+ snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_MUSIC);
+ free(data_path);
+ fp = fopen(playing_ini, "w"); /* make new file. */
#else
- fp = fopen(MP_PLAYING_INI_FILE_NAME_SOUND, "w"); /* make new file. */
+ snprintf(playing_ini, 1024, "%s%s", data_path, MP_PLAYING_INI_FILE_NAME_SOUND);
+ free(data_path);
+ fp = fopen(playing_ini, "w"); /* make new file. */
#endif
if (fp == NULL) {
#ifndef MP_SOUND_PLAYER
- ERROR_TRACE("Failed to open ini files. : %s", MP_PLAYING_INI_FILE_NAME_MUSIC);
+ ERROR_TRACE("Failed to open ini files. : %s", playing_ini);
#else
- ERROR_TRACE("Failed to open ini files. : %s", MP_PLAYING_INI_FILE_NAME_SOUND);
+ ERROR_TRACE("Failed to open ini files. : %s", playing_ini);
#endif
return;
}
if (path == NULL) {
return;
}
- snprintf(playing_status, 1024, "%s%s", path, "NowPlayingStatus");
+ snprintf(playing_status, 1024, "%s%s", path, MP_SHARED_PLAYING_STATUS_INI);
free(path);
FILE *fp = fopen(playing_status, "w"); /* make new file. */
startfunc;
FILE *fp = NULL;
- fp = fopen(MP_NOWPLAYING_INI_FILE_NAME, "w"); /* make new file. */
+ char *data_path = app_get_data_path();
+ char nowplaying_ini[1024] = {0};
+ snprintf(nowplaying_ini, 1024, "%s%s", data_path, MP_NOWPLAYING_INI_FILE_NAME);
+ free(data_path);
+ fp = fopen(nowplaying_ini, "w"); /* make new file. */
if (fp == NULL) {
- SECURE_ERROR("Failed to open ini files. : %s", MP_NOWPLAYING_INI_FILE_NAME);
+ SECURE_ERROR("Failed to open ini files. : %s", nowplaying_ini);
return;
}
fprintf(fp, " \n");
char line[MAX_NAM_LEN + 1];
FILE *fp = NULL;
- if(access(MP_NOWPLAYING_INI_FILE_NAME, F_OK) != -1)
+ char *data_path = app_get_data_path();
+ char nowplaying_ini[1024] = {0};
+ snprintf(nowplaying_ini, 1024, "%s%s", data_path, MP_NOWPLAYING_INI_FILE_NAME);
+ free(data_path);
+ if(access(nowplaying_ini, F_OK) != -1)
{
- fp = fopen(MP_NOWPLAYING_INI_FILE_NAME, "r");
+ fp = fopen(nowplaying_ini, "r");
if (!fp) {
- SECURE_ERROR("unable to open %s...", MP_NOWPLAYING_INI_FILE_NAME);
+ SECURE_ERROR("unable to open %s...", nowplaying_ini);
return;
}
if (fgets(line, MAX_NAM_LEN, fp)) { /* audio id */
MP_CHECK(item);
MP_CHECK(ad->current_track_info);
- fp = fopen(MP_NOWPLAYING_INI_FILE_NAME, "w"); /* make new file. */
+ char *data_path = app_get_data_path();
+ char nowplaying_ini[1024] = {0};
+ snprintf(nowplaying_ini, 1024, "%s%s", data_path, MP_NOWPLAYING_INI_FILE_NAME);
+ free(data_path);
+ fp = fopen(nowplaying_ini, "w"); /* make new file. */
if (fp == NULL) {
- SECURE_ERROR("Failed to open ini files. : %s", MP_NOWPLAYING_INI_FILE_NAME);
+ SECURE_ERROR("Failed to open ini files. : %s", nowplaying_ini);
return;
}
int valid_uri = 0;
int valid_status = 0;
char *path = app_get_data_path();
+ if (!path) {
+ return -1;
+ }
+ DEBUG_TRACE("Data Path is: %s", path);
char playing_status[1024] = {0};
if (path == NULL) {
return -1;
}
- snprintf(playing_status, 1024, "%s%s", path, "NowPlayingStatus");
+ snprintf(playing_status, 1024, "%s%s", path, MP_SHARED_PLAYING_STATUS_INI);
free(path);
FILE *fp = fopen(playing_status, "r"); /* read MP_SHARED_PLAYING_STATUS_INI file. */
mp_setting_remove_now_playing_shared_status();
} else {
char *path = app_get_data_path();
- DEBUG_TRACE("Path is: %s", path);
+ char *shared_path = app_get_shared_resource_path();
+ DEBUG_TRACE("Data Path is: %s", path);
+ DEBUG_TRACE("Shared Resource Path is: %s", shared_path);
char playing_status[1024] = {0};
if (path == NULL) {
return;
}
- snprintf(playing_status, 1024, "%s%s", path, "NowPlayingStatus");
+ snprintf(playing_status, 1024, "%s%s", path, MP_SHARED_PLAYING_STATUS_INI);
free(path);
FILE *fp = fopen(playing_status, "w"); /* make new file. */
#define MP_FILE_PREFIX "file://"
-#define MP_NOW_PLAYING_ID_INI DATA_PREFIX"/shared/data/NowPlayingId.ini" //playing thread id
+#define MP_NOW_PLAYING_ID_INI "NowPlayingId.ini" //playing thread id
#ifdef MP_SOUND_PLAYER
-#define MP_SHARED_PLAYING_STATUS_INI DATA_PREFIX"/shared/data/nowplaying.ini" //share track info of sound-player
+#define MP_SHARED_PLAYING_STATUS_INI "nowplaying.ini" //share track info of sound-player
#else
-#define MP_SHARED_PLAYING_STATUS_INI DATA_PREFIX"/shared/data/NowPlayingStatus" //share track info of music-player
+#define MP_SHARED_PLAYING_STATUS_INI "NowPlayingStatus" //share track info of music-player
#endif
//@@ MP_PLAYING_INI_FILE_NAME
//this hard corded value is used for music player & sound player.
//if this is need to be changed, you need to inform about it to lockscreen.
-#define MP_PLAYING_INI_FILE_NAME_MUSIC DATA_PREFIX"/data/playing_track_music.ini"
-#define MP_PLAYING_INI_FILE_NAME_SOUND DATA_PREFIX"/data/playing_track_sound.ini"
+#define MP_PLAYING_INI_FILE_NAME_MUSIC "playing_track_music.ini"
+#define MP_PLAYING_INI_FILE_NAME_SOUND "playing_track_sound.ini"
/* music play state for livebox and music player and sound player */
-#define MP_PLAY_STATE DATA_PREFIX"/shared/data/MusicPlayStatus.ini" //player state
+#define MP_PLAY_STATE "MusicPlayStatus.ini" //player state
#ifndef MP_SOUND_PLAYER
-#define MP_LSCR_CONTROL DATA_PREFIX"/data/lock_music_ctrl"
+#define MP_LSCR_CONTROL "lock_music_ctrl"
#else
-#define MP_LSCR_CONTROL DATA_PREFIX"/data/lock_sound_ctrl"
+#define MP_LSCR_CONTROL "lock_sound_ctrl"
#endif
mp_common_create_playlist_mgr();
mp_playlist_mgr_clear(ad->playlist_mgr);
- mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, MP_GROUP_LIST_DATA, NULL, index);
+ char *data_path = app_get_data_path();
+ char group_list_data[1024] = {0};
+ snprintf(group_list_data, 1024, "%s%s", data_path, MP_GROUP_LIST_DATA);
+ free(data_path);
+ mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, group_list_data, NULL, index);
return true;
}
if (ad->playlist_mgr && ad->current_track_info) {
if (ad->current_track_info->uri) {
- mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, MP_NOWPLAYING_LIST_DATA, ad->current_track_info->uri, -1);
+ char *data_path = app_get_data_path();
+ char nowplaying_list_data[1024] = {0};
+ snprintf(nowplaying_list_data, 1024, "%s%s", data_path, MP_NOWPLAYING_LIST_DATA);
+ free(data_path);
+ mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, nowplaying_list_data, ad->current_track_info->uri, -1);
}
}
}
mp_common_create_playlist_mgr();
mp_playlist_mgr_clear(ad->playlist_mgr);
- mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, MP_NOWPLAYING_LIST_DATA, last_played_path, -1);
+ char *data_path = app_get_data_path();
+ char nowplaying_list_data[1024] = {0};
+ snprintf(nowplaying_list_data, 1024, "%s%s", data_path, MP_NOWPLAYING_LIST_DATA);
+ free(data_path);
+ mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, nowplaying_list_data, last_played_path, -1);
if (mp_playlist_mgr_count(ad->playlist_mgr) == 0) {
mp_media_info_list_count(MP_TRACK_ALL, NULL, NULL, NULL, 0, &count);
mp_common_create_playlist_mgr();
mp_playlist_mgr_clear(ad->playlist_mgr);
- mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, MP_GROUP_LIST_DATA, NULL, index);
+ char *data_path = app_get_data_path();
+ char group_list_data[1024] = {0};
+ snprintf(group_list_data, 1024, "%s%s", data_path, MP_GROUP_LIST_DATA);
+ free(data_path);
+ mp_playlist_mgr_lazy_append_with_file(ad->playlist_mgr, group_list_data, NULL, index);
*start_playback = true;
return true;
}
ad->b_lockmini_show = TRUE;
mp_lockscreenmini_update(ad);
- FILE *fp = fopen(MP_LSCR_CONTROL, "w");
+ char *path = app_get_data_path();
+ char lscr_state[1024] = {0};
+ snprintf(lscr_state, 1024, "%s%s", path, MP_LSCR_CONTROL);
+ free(path);
+ FILE *fp = fopen(lscr_state, "w");
if (fp) {
fclose(fp);
}
mp_ecore_timer_del(ad->lockmini_button_timer);
ad->lockmini_visible = false;
- ecore_file_remove(MP_LSCR_CONTROL);
+ char *path = app_get_data_path();
+ char lscr_state[1024] = {0};
+ snprintf(lscr_state, 1024, "%s%s", path, MP_LSCR_CONTROL);
+ free(path);
+ ecore_file_remove(lscr_state);
return 0;
}