Assembla home | Assembla project page
 

Changeset 1025

Show
Ignore:
Timestamp:
07/19/08 15:14:38 (4 months ago)
Author:
Pernod
Message:

Added option to select a playlist to be automatically loaded upon startup.

Fixes #154

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/swisscenter/config/config_playlists.php

    r849 r1025  
    44 *************************************************************************************************/ 
    55   
     6  require_once( realpath(dirname(__FILE__).'/../base/browse.php')); 
     7 
    68  // ---------------------------------------------------------------------------------- 
    79  // Display current config 
     
    1012  function playlists_display( $message = '' ) 
    1113  { 
     14    // Get list of available playlists 
     15    $dir_list  = array(); 
     16    $file_list = array(); 
     17    dir_contents_FS(str_suffix(get_sys_pref('PLAYLISTS'),'/'), media_exts_playlists(), $dir_list, $file_list); 
     18    $playlists = array(); 
     19    foreach ($file_list as $file) 
     20      $playlists[file_noext($file["filename"])] = $file["dirname"].$file["filename"]; 
     21     
    1222    echo '<p><h1>'.str('PLAYLISTS').'<p>'; 
    1323    message($message); 
     
    1929    form_input('itunes',str('ITUNES_LIBRARY'),50,'',get_sys_pref('ITUNES_LIBRARY')); 
    2030    form_label(str('ITUNES_CONFIG_PROMPT')); 
     31    form_list_static('autoload',str('PLAYLIST_AUTOLOAD'),$playlists,get_sys_pref('PLAYLIST_AUTOLOAD',''),false,false); 
     32    form_label(str('PLAYLIST_AUTOLOAD_PROMPT')); 
    2133    form_submit(str('SAVE_SETTINGS'),2); 
    2234    form_end(); 
     
    3143    $dir = rtrim(str_replace('\\','/',un_magic_quote($_REQUEST["location"])),'/'); 
    3244    $itunes_library = rtrim(str_replace('\\','/',un_magic_quote($_REQUEST["itunes"])),'/'); 
     45    $autoload = $_REQUEST["autoload"]; 
    3346     
    3447    if (empty($_REQUEST["location"])) 
     
    4659      set_sys_pref('PLAYLISTS',$dir); 
    4760      set_sys_pref('ITUNES_LIBRARY',$itunes_library); 
     61      if (!empty($autoload)) 
     62        set_sys_pref('PLAYLIST_AUTOLOAD',$autoload); 
     63      else 
     64        delete_sys_pref('PLAYLIST_AUTOLOAD'); 
    4865      playlists_display(str('SAVE_SETTINGS_OK')); 
    4966    } 
  • trunk/swisscenter/index.php

    r990 r1025  
    7575   
    7676    /** 
     77     * Automatically load playlist 
     78     */ 
     79     
     80    if ( !isset($_SESSION["playlist_autoloaded"]) && get_sys_pref('PLAYLIST_AUTOLOAD','')!=='' ) 
     81    { 
     82      $fsp    = get_sys_pref('PLAYLIST_AUTOLOAD'); 
     83      $name   = file_noext(basename($fsp)); 
     84      $tracks = load_pl($fsp, $failed); 
     85      set_current_playlist($name, $tracks); 
     86      $_SESSION["playlist_autoloaded"] = 'yes'; 
     87    } 
     88     
     89    /** 
    7790     * Output the page header immediately, as it performs the authentication check and will redirect 
    7891     * the user to the "change_user" screen if there are multiple users to choose from or a password 
  • trunk/swisscenter/lang/en/en.xml

    r1024 r1025  
    26642664      </string> 
    26652665      <string> 
     2666        <id>PLAYLIST_AUTOLOAD</id> 
     2667        <text>Playlist to autoload</text> 
     2668        <version>1.20.1</version> 
     2669      </string> 
     2670      <string> 
     2671        <id>PLAYLIST_AUTOLOAD_PROMPT</id> 
     2672        <text>Select a playlist to be automatically loaded at startup. This is useful if you find yourself always having to select the same playlist for background music before viewing photos.</text> 
     2673        <version>1.20.1</version> 
     2674      </string> 
     2675      <string> 
    26662676        <id>PLAYLIST_CLEAR</id> 
    26672677        <text>Clear the playlist</text>