'); else page_header( str('SETUP_SEARCH_NEW_MEDIA')); // Display a message to the user echo font_tags(32).str('REFRESH_RUNNING'); // and then the current status echo '
'; $menu->add_item(str('CONTINUE'),'/'); $menu->display(); page_footer( 'config.php' ); } /** * Refresh all categories and all media types * */ function do_refresh_all() { set_sys_pref('MEDIA_SCAN_TYPE','MEDIA'); set_sys_pref('MEDIA_SCAN_REFRESH_METADATA','NO'); set_sys_pref('MEDIA_SCAN_ITUNES','NO'); set_sys_pref('MEDIA_SCAN_CLEANUP','NO'); set_sys_pref('MEDIA_SCAN_STATUS',str('MEDIA_SCAN_STATUS_PENDING')); media_refresh_now(); show_progress(); } /** * Refresh all media locations defined for a particular category * * @param integer $spec - the category ID to refresh */ function do_refresh_cat( $spec ) { set_sys_pref('MEDIA_SCAN_CATEGORY',$spec); do_refresh_all(); } /** * Refresh all media locations for a particular media type * * @param ineteger $spec - the media type to refresh */ function do_refresh_type( $spec ) { set_sys_pref('MEDIA_SCAN_MEDIA_TYPE',$spec); do_refresh_all(); } /** * Choose the method to refresh: all, by type or by category * */ function choose_main_opt() { $menu = new menu(); page_header( str('SETUP_SEARCH_NEW_MEDIA')); $menu->add_item(str('SETUP_SEARCH_ALL'),'/do_refresh.php?type=all'); $menu->add_item(str('SETUP_SEARCH_TYPE'),'/do_refresh.php?type=media_type',true); $menu->add_item(str('SETUP_SEARCH_CATEGORY'),'/do_refresh.php?type=category',true); echo '
'; $menu->display(); page_footer( 'config.php' ); } /** * Choose the category to refresh * */ function choose_category() { $menu = new menu(); page_header( str('SETUP_SEARCH_NEW_MEDIA')); echo '
'; foreach (db_toarray("select * from categories order by cat_name") as $cat) { $menu->add_item($cat["CAT_NAME"],'/do_refresh.php?type=category&spec='.$cat["CAT_ID"]); } $menu->display_page( nvl($_REQUEST["page"],1) ); page_footer( '/do_refresh.php' ); } /** * Choose the media type to refresh * */ function choose_type() { $menu = new menu(); page_header( str('SETUP_SEARCH_NEW_MEDIA')); echo '
'; $menu->add_item( str('MUSIC') ,'/do_refresh.php?type=media_type&spec='.MEDIA_TYPE_MUSIC); $menu->add_item( str('PHOTOS') ,'/do_refresh.php?type=media_type&spec='.MEDIA_TYPE_PHOTO); $menu->add_item( str('TVSERIES') ,'/do_refresh.php?type=media_type&spec='.MEDIA_TYPE_TV); $menu->add_item( str('VIDEO') ,'/do_refresh.php?type=media_type&spec='.MEDIA_TYPE_VIDEO); $menu->display(); page_footer( '/do_refresh.php' ); } /** * Main Logic * */ $type = $_REQUEST["type"]; $spec = $_REQUEST["spec"]; $status = get_sys_pref('MEDIA_SCAN_STATUS',str('MEDIA_SCAN_STATUS_COMPLETE')); if ( $type == 'show' || $status != str('MEDIA_SCAN_STATUS_COMPLETE') ) show_progress(); elseif ( $type == 'all' ) { clear_media_scan_prefs(); do_refresh_all(); } elseif ( $type == 'media_type' && empty($spec) ) choose_type(); elseif ( $type == 'media_type' ) { clear_media_scan_prefs(); do_refresh_type($spec); } elseif ( $type == 'category' && empty($spec) ) choose_category(); elseif ( $type == 'category' ) { clear_media_scan_prefs(); do_refresh_cat($spec); } else choose_main_opt(); /************************************************************************************************** End of file **************************************************************************************************/ ?>