Exemple #1
0
static int
file_open_dir(prop_t *page, const char *url)
{
  prop_t *model;
  int type;
  char parent[URL_MAX];
  int r;
  fa_handle_t *ref;

  ref = fa_reference(url);
  type = fa_probe_dir(NULL, url);
  if(type == CONTENT_DVD) {
    r =  backend_open_video(page, url);
  } else {

    model = prop_create(page, "model");
    prop_set_string(prop_create(model, "type"), "directory");

    /* Find a meaningful page title (last component of URL) */
    set_title_from_url(prop_create(model, "metadata"), url);

    // Set parent
    if(!fa_parent(parent, sizeof(parent), url))
      prop_set_string(prop_create(page, "parent"), parent);

    fa_scanner(url, model, NULL);
    r = 0;
  }
  fa_unreference(ref);

  return r;
}
Exemple #2
0
/**
 * Try to open the given URL with a playqueue context
 */
static int
file_open_audio(prop_t *page, const char *url)
{
  char parent[URL_MAX];
  char parent2[URL_MAX];
  struct fa_stat fs;
  prop_t *model;

  if(fa_parent(parent, sizeof(parent), url))
    return 1;

  if(fa_stat(parent, &fs, NULL, 0))
    return 1;
  
  model = prop_create(page, "model");
  prop_set_string(prop_create(model, "type"), "directory");

  /* Find a meaningful page title (last component of URL) */
  set_title_from_url(prop_create(model, "metadata"), parent);

  // Set parent
  if(!fa_parent(parent2, sizeof(parent2), parent))
    prop_set_string(prop_create(page, "parent"), parent2);

  fa_scanner(parent, model, url);
  return 0;
}
Exemple #3
0
/**
 * Try to open the given URL with a playqueue context
 */
static int
file_open_audio(prop_t *page, const char *url)
{
    char parent[URL_MAX];
    char parent2[URL_MAX];
    struct fa_stat fs;
    prop_t *model;

    if(fa_parent(parent, sizeof(parent), url))
        return 1;

    if(fa_stat(parent, &fs, NULL, 0))
        return 1;

    model = prop_create(page, "model");
    prop_set_string(prop_create(model, "type"), "directory");

    /* Find a meaningful page title (last component of URL) */
    rstr_t *title = title_from_url(parent);
    prop_set(model, "metadata", "title", NULL, PROP_SET_RSTRING, title);

    // Set parent
    if(!fa_parent(parent2, sizeof(parent2), parent))
        prop_set_string(prop_create(page, "parent"), parent2);

    fa_scanner(parent, fs.fs_mtime, model, url, prop_create(page, "directClose"),
               title);
    rstr_release(title);
    return 0;
}
Exemple #4
0
static void
file_open_browse(prop_t *page, const char *url, time_t mtime)
{
    prop_t *model;
    char parent[URL_MAX];

    model = prop_create(page, "model");
    prop_set_string(prop_create(model, "type"), "directory");

    /* Find a meaningful page title (last component of URL) */

    rstr_t *title = title_from_url(url);

    prop_set(model, "metadata", "title", NULL, PROP_SET_RSTRING, title);

    // Set parent
    if(!fa_parent(parent, sizeof(parent), url))
        prop_set_string(prop_create(page, "parent"), parent);

    fa_scanner(url, mtime, model, NULL, prop_create(page, "directClose"),
               title);
    rstr_release(title);
}