You are here

function _video_cck_yahoomusic_locale_lookup in Embedded Media Field 5

3 calls to _video_cck_yahoomusic_locale_lookup()
theme_video_cck_yahoomusic_flash in contrib/video_cck/providers/yahoomusic.inc
The embedded flash displaying the yahoomusic video.
video_cck_yahoomusic_embedded_link in contrib/video_cck/providers/yahoomusic.inc
hook video_cck_PROVIDER_embedded_link($video_code) returns a link to view the video at the provider's site
video_cck_yahoomusic_thumbnail in contrib/video_cck/providers/yahoomusic.inc
hook video_cck_PROVIDER_thumbnail returns the external url for a thumbnail of a specific video TODO: make the args: ($embed, $field, $item), with $field/$item provided if we need it, but otherwise simplifying things

File

contrib/video_cck/providers/yahoomusic.inc, line 205
This include processes Yahoo Music API media files for use by emfield.module.

Code

function _video_cck_yahoomusic_locale_lookup($value = 'code') {

  // Taken from http://developer.yahoo.com/music/api_guide/GettingStartedLocales.html
  //  Locale                    API Hostname            eID       ympsc       lang
  //  United States             us.music.yahooapis.com  1301797   4195351     en

  //  Canada                    ca.music.yahooapis.com  1307409   642778131   en
  //  Mexico                    mx.music.yahooapis.com  8257040   640680961   es
  //  Australia                 au.music.yahooapis.com  1307669   638583826   en
  //  New Zealand               nz.music.yahooapis.com  5300947   638583833   en
  //  United Kingdom            uk.music.yahooapis.com  1301655   529531933   uk
  //  Germany                   de.music.yahooapis.com  1307668   535823380   de
  //  Spain                     es.music.yahooapis.com  1307660   534774806   es
  //  Italy                     it.music.yahooapis.com  1307667   533726232   it
  //  France                    fr.music.yahooapis.com  1307665   536871959   fr
  static $locales = array();
  $code = variable_get('video_cck_yahoomusic_locale', 'us');
  switch ($code) {
    case 'us':
      $locales[$code] = array(
        'name' => 'United States',
        'eid' => 1301797,
        'ympsc' => 4195351,
        'lang' => 'en',
      );
      break;
    case 'e1':
      $locales[$code] = array(
        'name' => 'United States (Espanol)',
        'eid' => 1307666,
        'ympsc' => 559940629,
        'lang' => 'es',
      );
      break;
    case 'ca':
      $locales[$code] = array(
        'name' => 'Canada',
        'eid' => 1307409,
        'ympsc' => 642778131,
        'lang' => 'en',
      );
      break;
    case 'mx':
      $locales[$code] = array(
        'name' => 'Mexico',
        'eid' => 8257040,
        'ympsc' => 640680961,
        'lang' => 'es',
      );
      break;
    case 'au':
      $locales[$code] = array(
        'name' => 'Australia',
        'eid' => 1307669,
        'ympsc' => 638583826,
        'lang' => 'en',
      );
      break;
    case 'nz':
      $locales[$code] = array(
        'name' => 'New Zealand',
        'eid' => 5300947,
        'ympsc' => 638583833,
        'lang' => 'en',
      );
      break;
    case 'uk':
      $locales[$code] = array(
        'name' => 'United Kingdom',
        'eid' => 1301655,
        'ympsc' => 529531933,
        'lang' => 'uk',
      );
      break;
    case 'de':
      $locales[$code] = array(
        'name' => 'Germany',
        'eid' => 1307668,
        'ympsc' => 535823380,
        'lang' => 'de',
      );
      break;
    case 'es':
      $locales[$code] = array(
        'name' => 'Spain',
        'eid' => 1307660,
        'ympsc' => 534774806,
        'lang' => 'es',
      );
      break;
    case 'it':
      $locales[$code] = array(
        'name' => 'Italy',
        'eid' => 1307667,
        'ympsc' => 533726232,
        'lang' => 'it',
      );
      break;
    case 'fr':
      $locales[$code] = array(
        'name' => 'France',
        'eid' => 1307665,
        'ympsc' => 536871959,
        'lang' => 'fr',
      );
      break;
    default:
      $code = 'us';
      $locales[$code] = array(
        'name' => 'United States',
        'eid' => 1301797,
        'ympsc' => 4195351,
        'lang' => 'en',
      );
  }
  $locales[$code]['hostname'] = $code . '.music.yahooapis.com';
  switch ($value) {
    case 'code':
      return $code;
      break;
    case 'name':
      return $locales[$code]['name'];
      break;
    case 'hostname':
      return $locales[$code]['hostname'];
      break;
    case 'eid':
      return $locales[$code]['eid'];
      break;
    case 'ympsc':
      return $locales[$code]['ympsc'];
      break;
    case 'lang':
      return $locales[$code]['lang'];
      break;
    default:
      drupal_set_message(t('Bad locale lookup request.'), 'warning');
      return '';
  }
}