Exemple #1
0
/* ------------------------------------------------------------------------*/
static bool write_bookmark(bool create_bookmark_file, const char *bookmark)
{
    bool ret=true;

    if (!bookmark)
    {
       ret = false; /* something didn't happen correctly, do nothing */
    }
    else
    {
        if (global_settings.usemrb)
            ret = add_bookmark(RECENT_BOOKMARK_FILE, bookmark, true);


        /* writing the bookmark */
        if (create_bookmark_file)
        {
            char* name = playlist_get_name(NULL, global_temp_buffer,
                                       sizeof(global_temp_buffer));
            if (generate_bookmark_file_name(name))
            {
                ret = ret & add_bookmark(global_bookmark_file_name, bookmark, false);
            }
            else
            {
                ret = false; /* generating bookmark file failed */
            }
        }
    }

    splash(HZ, ret ? ID2P(LANG_BOOKMARK_CREATE_SUCCESS)
           : ID2P(LANG_BOOKMARK_CREATE_FAILURE));

    return ret;
}
Exemple #2
0
/* ----------------------------------------------------------------------- */
bool bookmark_exists(void)
{
    bool exist=false;

    char* name = playlist_get_name(NULL, global_temp_buffer,
                                   sizeof(global_temp_buffer));
    if (generate_bookmark_file_name(name))
    {
        exist = file_exists(global_bookmark_file_name);
    }
    return exist;
}
Exemple #3
0
/* ------------------------------------------------------------------------*/
bool bookmark_autoload(const char* file, const char *track)
{
    char* bookmark;

    if(global_settings.autoloadbookmark == BOOKMARK_NO)
        return false;

    /*Checking to see if a bookmark file exists.*/
    if(!generate_bookmark_file_name(file))
    {
        return false;
    }

    if(!file_exists(global_bookmark_file_name))
        return false;

    if(global_settings.autoloadbookmark == BOOKMARK_YES)
    {
        return bookmark_load(global_bookmark_file_name, true);
    }
    else
    {
        /* normal "ask" mode does not filter by track */
        if (global_settings.autoloadbookmark == BOOKMARK_ASK)
            track = NULL;
        int ret = select_bookmark(global_bookmark_file_name, true, track, &bookmark);
        if (bookmark != NULL)
        {
            if (!play_bookmark(bookmark))
            {
                /* Selected bookmark not found. */
                splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
            }

            /* Act as if autoload was done even if it failed, since the 
             * user did make an active selection.
             */
            return true;
        }

        return ret != BOOKMARK_SUCCESS;
    }
}
Exemple #4
0
/* ----------------------------------------------------------------------- */
int bookmark_load_menu(void)
{
    char* bookmark;
    int ret = BOOKMARK_FAIL;

    push_current_activity(ACTIVITY_BOOKMARKSLIST);

    char* name = playlist_get_name(NULL, global_temp_buffer,
                                       sizeof(global_temp_buffer));
    if (generate_bookmark_file_name(name))
    {
        ret = select_bookmark(global_bookmark_file_name, false, &bookmark);
        if (bookmark != NULL)
        {
            ret = play_bookmark(bookmark) ? BOOKMARK_SUCCESS : BOOKMARK_FAIL;
        }
    }

    pop_current_activity();
    return ret;
}